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!

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    144 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    71 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    79 views
    0 likes
    Last Post PaulMohn  
    Working...
    X