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 Torontobluejays, Today, 08:43 AM
    0 responses
    1 view
    0 likes
    Last Post Torontobluejays  
    Started by sastrades, 01-31-2024, 10:19 PM
    12 responses
    191 views
    0 likes
    Last Post sastrades  
    Started by Jimmyk, 01-26-2018, 05:19 AM
    8 responses
    864 views
    0 likes
    Last Post emuns
    by emuns
     
    Started by giulyko00, 04-24-2024, 12:03 PM
    6 responses
    29 views
    0 likes
    Last Post giulyko00  
    Started by 00nevest, 04-27-2024, 02:27 PM
    3 responses
    27 views
    0 likes
    Last Post 00nevest  
    Working...
    X