IOG and RecalcLastbarAfter()

Questions about MultiCharts and user contributed studies.
dblend
Posts: 16
Joined: 11 Jul 2011
Been thanked: 1 time

IOG and RecalcLastbarAfter()

Postby dblend » 21 Jul 2011

I need help understanding how powerlanguage works regarding the use of intrabar order generation (IOG) used with RecalcLastbarAfter(). I am running a 30 sec chart with RecalcLastbarAfter(1) set to recalc every second. There reason for doing this, is that i am sharing information between charts using globalvariables.dll and need the data to be updated in "real-time" and not just every 30 seconds. With regards to trading i am happy to trade on the bar (30 second) and orders dont need to be IOG. What i am finding (in testing / not live) is that i set [IntrabarOrderGeneration = FALSE], but keep RecalcLastbarAfter(1), orders if valid will be sent numerous times during a single bar, i.e. the same effect as with IOG = true.

Can someone please help me understand how these two functions work together and if RecalcLastbarAfter(1) is on, will this override IOG=TRUE, or if IOG = FALSE, will no orders be sent intrabar?
some print statements showing the order is being sent multiple times
FSR Date 1110721.00 Time 1010 Sell: Vol: 7642.00 Prc: 1971.00
FSR Date 1110721.00 Time 1010 Sell: Vol: 7642.00 Prc: 1971.00
FSR Date 1110721.00 Time 1010 Sell: Vol: 7448.00 Prc: 1971.00

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: IOG and RecalcLastbarAfter()

Postby Dave Masalov » 25 Jul 2011

dblend,

RecalcLastbarAfter(1) will force the script to recalculate every second regardless of IOG mode turned on or off. However, if IOG = false, these intra-bar orders won't be sent to the broker (but you will see them in your print statements). If IOG = true, all the orders will be sent to the broker.

dblend
Posts: 16
Joined: 11 Jul 2011
Been thanked: 1 time

Re: IOG and RecalcLastbarAfter()

Postby dblend » 25 Jul 2011

Thanks Dave,

That makes sense, so effecively if i have IOG = false and RecalcLastbarAfter(1), the global variables will still update every second and be "up to date" but orders will only submit/ammend/cancel every new bar.


Return to “MultiCharts”