Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter as soon as indicator touch

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

    Enter as soon as indicator touch

    Hi
    ​​​​​​im doing a simple ema cross strategy. I want to enter a long when 9ema cross above 20ema. But I want to enter long as soon as 9ema touched 20ema. I don't want to wait until candle finish and enter in the next candle. I want in as soon as it touch.
    thank you

    #2
    Hello SuperDude123,

    Thanks for your post.

    As you are asking about a strategy we will move this thread into the NinjaTrader 8 strategy forum.

    From your description, it sounds like you are running your strategy with Calculate.OnBarClose which means your strategy would run once when the forming bar closes. The good of this is that the data does not change once the bar closes so you are assured that the EMA cross has occurred. The downside is as you have observed, the entry order is delayed.

    For live data, to enter on the first instance of the ema cross, you would need to use Calculate.OnPriceChange. The good is that your order is submitted immediately. The downside is that it is possible that by the end of the bar that the cross will have uncrossed (because of price retracement) and so it would "appear" that your order was submitted with no cross condition (when viewed historically). Also, with intrabar executions it will be possible that you can unintentionally place many orders in one bar because the cross condition can occur repeatedly as price oscillates within the bar. You would need to add further coding so that you only place one order. So you can enter as you wish using Calculate.OnPriceChange but you need to consider the risks in doing so.



    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X