PDA

View Full Version : Limiting the number of Bars for Active Limit


TAJTrades
12-13-2007, 07:53 AM
I am suffering from a synapse meltdown!

I want to enter a Buy Limit order 4 ticks below the signal bar Close. ( Close[0] ). How can I cancel the order if not triggered within the next 3 bars.

I can even find documentation on this. Talk about a brain %$#@.

Thanks

NinjaTrader_Ray
12-13-2007, 08:19 AM
By default, orders automatically cancel at the end of a bar therefore, you need to determine a way to *not* re-submit the order after three bars. One approach would be to create a private "int" variable outside the OnBarUpdate() method at the class level. Track the bar number the signal and order was placed (use CurrentBar) then track if the CurrentBar is greater than the bar number stored + 3 etc..