Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Waiting for multiple bars...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Waiting for multiple bars...

    I have this code which is supposed to execute an order when the ema crosses the middle bollenger band && price action closes 2 ticks above the outer band (I also have it cross the outer band to make sure its coming from outside the bands).

    Here is the code: (real tight bands)
    if (CrossAbove(EMA(Median, x), Bollinger(Median, 0.xx, xx).Lower, 1)
    && CrossAbove(EMA(Median, x), Bollinger(Median, 0.xx, xx).Middle, 1)
    && CrossAbove(Close, Bollinger(Median, 0.xx, xx).Upper, 1))

    I think the last line should attempt to fill the order if the price action closes 2 ticks from the outer band.

    Two questions:
    1. How make the last line close between to values, say 2 and 4 ticks...
    2. I want the pending order to cancel if it is not filled within 3 bars or less. Any help with the code would be great?

    #2
    TD-Trader747, I would suggest moving to the NinjaScript editor for this advanced order placement ideas, you could for example set the order to liveUntilCancelled and then CancelOrder it after 3 bars have elapsed with no fill. If you place limit orders they will be default expire on the next on bar update call, this link provides more detail - http://www.ninjatrader-support.com/H...verview36.html

    Not sure on your first question, maybe you can clarify it - thanks!
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by maybeimnotrader, Yesterday, 05:46 PM
    5 responses
    24 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by NRITV, Today, 01:15 PM
    0 responses
    2 views
    0 likes
    Last Post NRITV
    by NRITV
     
    Started by quantismo, Yesterday, 05:13 PM
    2 responses
    16 views
    0 likes
    Last Post quantismo  
    Started by frankthearm, Today, 09:08 AM
    6 responses
    26 views
    0 likes
    Last Post frankthearm  
    Started by adeelshahzad, Today, 03:54 AM
    5 responses
    33 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X