Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Double crossover

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

    Double crossover

    Hi, in the Strategy builder, I am trying to put in a condition to exit a trade if EMA crosses SMA twice, at first from above and then from below, but the Strategy builder does not get it.

    In the "conditions and actions" section, I used "CrossBelow(EMA(10), SMA(20), 1)" and "CrossAbove(EMA(10), SMA(20), 1)" conditions and "ExitShort(DefaultQuantity, "", "")" action.

    Any help appreciated. Thanks in advance. Regards, Luka

    P.S. I am pretty new at this

    #2
    Hello Luke1234,

    Thanks for your post and welcome to the NinjaTrader forums!

    While this won't directly answer your question, here are links to the educational resources for the Strategy Builder:
    Free live webinar every other Thursday at 4:00 PM EST, through this link to all webinars: https://ninjatrader.com/PlatformTraining
    Previous recording of the Strategy Builder 301 webinar: https://youtu.be/HCyt90GAs9k?list=PL...auWXkWe0Nf&t=2
    Help guide for the strategy builder: https://ninjatrader.com/support/help...gy_builder.htm

    Typically you would not get both a crossbelow and a crossabove in the same bar. What you could do is use a set that looks for the first cross direction and then set a bool variable you create to true. In another set when that bool variable is true and when you are in a short position and when the cross above happens, then exit short. You would need another set with some condition to reset the bool variable back to false, perhaps when you are in a flat market position?

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the swift answer, Paul

      Aha, so both conditions i used get a "true" answer by the Strategy builder only if they happen on the same bar, if I undestand correctly? The Strategy builder does not record that the first condition was fulfilled and then waits if/untill the other one is also, and then says: "Yes, let's do it!". I guess I'll have to dig into the material you provided... REgards, Luke

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cre8able, Today, 03:20 PM
      0 responses
      5 views
      0 likes
      Last Post cre8able  
      Started by Fran888, 02-16-2024, 10:48 AM
      3 responses
      47 views
      0 likes
      Last Post Sam2515
      by Sam2515
       
      Started by martin70, 03-24-2023, 04:58 AM
      15 responses
      114 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by The_Sec, Today, 02:29 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by jeronymite, 04-12-2024, 04:26 PM
      2 responses
      31 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X