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

Strategy Builder EMA cross not touching bars

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

    Strategy Builder EMA cross not touching bars

    I'm hoping someone can help me with the strategy builder. I want to modify my EMA crossover strategy to only fire if the crossover occurs 3 - 6 bars after it's not touching any wicks or bars. I don't know how to program this in the strategy builder. I'm including an image of when I want the EMA to be valid. ​ Thanks for your help. Mitch

    Click image for larger version

Name:	image.png
Views:	39
Size:	78.6 KB
ID:	1295477

    #2
    Hello mmenigma,

    Thank you for your reply.

    To check if the EMAs crossover and also that they are not touching any bars for the last 3-6 bars, you would need to make comparisons between the EMA values and the High and/or Low prices of the bars. For example, this is a condition that checks if an EMA with a period of 7 crosses above an EMA with a period of 14 and if each of the EMAs was greater than the High price for 0 bars ago, 1 bar ago, 2 bars ago, and 3 bars ago. This is just to give you an idea so that you could add similar conditions into your own strategy:


    As a tip, once you have a condition set up you may right-click the condition and select "Copy" then right-click again and select "Paste" to paste the copied condition. Then, you can simply edit the condition to modify something such as the period value or the number of bars ago.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thanks Emily, This is what you're talking about? I don't need think I need to set both TEMA's if one is good enough to satisfy my needs. I also have times settings and an RSI condition in there too but that should not affect these conditions. For ease of copying and pasting, could I put the TEMA cross and the following 4 conditions into a group instead of all separate as seen here?
      ​​
      ​​​​​
      Attached Files
      Last edited by mmenigma; 03-12-2024, 04:43 PM.

      Comment


        #4
        I tried various different variations of this and it's not firing at all. I remove the EMA>High and it fires on all crossovers. If i add just one EMA>High the strategy fails completely. I tired using close instead of High and that didn't work either.

        Comment


          #5
          Originally posted by mmenigma View Post
          I tried various different variations of this and it's not firing at all. I remove the EMA>High and it fires on all crossovers. If i add just one EMA>High the strategy fails completely. I tired using close instead of High and that didn't work either.
          To understand what values are being compared in your conditions and why the strategy does or does not submit orders as expected, you can add print statements as an "Action" on the Conditions and Actions screen. You may also enable TraceOrders on the "Default Properties" screen of the builder to get information about whether orders are ignored, submitted, changed, canceled, rejected, etc. Both of these tools send information to the Control Center > New > NinjaScript Output window that you may review to get more insight into your strategy's behavior. For more information about these tools, please see the links below:You mentioned, "If i add just one EMA>High the strategy fails completely." Please add print statements to show the indicator value and the High value for that condition and test it out by adding one condition at a time. This should help to break down the behavior and get a better understanding of how the newly added conditions affect your strategy.

          Please let us know if we may be of further assistance.
          Emily C.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          4 views
          0 likes
          Last Post rbeckmann05  
          Started by rhyminkevin, Today, 04:58 PM
          4 responses
          52 views
          0 likes
          Last Post dp8282
          by dp8282
           
          Started by iceman2018, Today, 05:07 PM
          0 responses
          5 views
          0 likes
          Last Post iceman2018  
          Started by lightsun47, Today, 03:51 PM
          0 responses
          8 views
          0 likes
          Last Post lightsun47  
          Started by 00nevest, Today, 02:27 PM
          1 response
          14 views
          0 likes
          Last Post 00nevest  
          Working...
          X