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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    108 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    55 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    37 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    39 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    75 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X