Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Development - 3 asynchronous conditions for an entry condition

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

    Strategy Development - 3 asynchronous conditions for an entry condition

    Hi all,

    I´ve been reading the forum the last couple of days, but haven´t figured it out by myself yet. I really appreciate any help.
    I´m using the Strategy builder to develop a strategy pretty straightforward. I´m using RSI, Some Moving Average Ribbon and Renko bars.
    The idea is to enter Long whenever the Fast Moving Average Ribbon is greater than the slow Moving Average Ribbon + RSI is Oversold ( Crosses over the 10avg line) and there is a change in color (I´ve used Close logic and N bars). I use Booleans condition as other threat suggested (Reference: https://ninjatrader.com/support/foru...ut-how-to-made
    https://paul-ninjatrader.tinytake.co...OF8xMDYwMjE0OA )

    The problem is that on top the Renko bars, I´m using a Heiken Ashi Doji Indicator, which filters the "noise" on the Renko bars. When I compile the script I see the input data in the show box is using The Renko bars Closes and Opens which is different from the data of the HA Indicator. I´ve tried to do pretty much everything I can think of including Prints to try to find the error.

    I will attach everything, so It could be easier to understand the example above.
    Please let me know If you have any idea that might help.
    Thanks very much,
    Attached Files

    #2
    Hello josedaniel,

    Thanks for your post.

    First a comment about the RSI, it looks like you are using RSI.Avg line and may be okay if that is what you want but the average line lags the true RSI line.

    When the HeikenAshiDoji indicator is used, it will change the bar colors and bar values. (you can see the open/close values flipped) You've identified a spot where without the Heiken-Ashi the bar is green and with the Heiken Ashi it is Red and this is what you get with Heiken-Ashi which is a trending type indicator. So this would be expected.









    ​​​​​​​

    Comment


      #3
      Hi Paul,

      Thanks for your reply, regarding the RSI so far so good.
      On the other hand, I understand that HA changes the values of the bar vs the spot value of renko.
      This is exactly my point. I want to use the HA values, but when compiling the strategy it only reads the spot bars value, not the HA values.
      What could I do so the strategy reads the Open and close of the Heiken Ashi values?
      I´ve tried this in the Strategy builder using:
      HeikenAshiDoji().HAClose[0] >HeikenAshiDoji().HAClose[1]
      But the problem this still uses the Spot value of the renko bars and not the Values from the HA.
      Attached Files

      Comment


        #4
        Hello josedaniel,

        Thanks for your reply.

        "But the problem this still uses the Spot value of the Renko bars and not the Values from the HA." Looking at the code of the NBarsUp and NBarsDown, the code has been written to use the Open, High, Low, and Close price series, so even though you use the HeikenAshi indicator as the input series the NBars indicators will use the chart bars.

        I would suggest using the HeikenAshiDoji indicator price values directly.

        HeikenAshiDoji().HAClose[0] >HeikenAshiDoji().HAOpen[0] would be a green bar

        HeikenAshiDoji().HAClose[0] <HeikenAshiDoji().HAOpen[0] would be a red bar
        Last edited by NinjaTrader_PaulH; 08-31-2021, 07:33 AM. Reason: fixed last logic to [0]

        Comment


          #5
          Hi again Paul,

          Yes I did [*Image attached*] use the logic:
          HeikenAshiDoji().HAClose[0] >HeikenAshiDoji().HAOpen[0]
          But again, the strategy builder is getting the spot Renko data and not the HA close and open
          He is triggering the orders using the Renko Spot bars value as you can see.

          Any ideas why this might be?
          Kind Regards,

          Attached Files

          Comment


            #6
            Hello josedaniel,

            Thanks for your reply.

            I think we will need you to Print from within the strategy builder itself.

            You will want to print out the values of the HeikenAshi Close and open, the Renko close and open and the state of the bools you are using.

            Here is a link to a short video that will help with how to construct a print statement and how to view the actual output: https://paul-ninjatrader.tinytake.co...NV8xMDk5MDc5Nw

            Comment


              #7
              Hi Paul,
              Thanks for the video.
              I run the Print test, I´m getting mixed results regarding the logic:
              HeikenAshiDoji().HAClose[0] >HeikenAshiDoji().HAOpen[0]
              Please find attached the results, on the same logic I´m getting True and False statements.
              Also I´m getting an order execution on a False statement which is weirder.
              There are tons of True where should be False and Viceversa.
              Any Idea what the problem could be?
              KR,
              Jose



              Attached Files

              Comment


                #8
                Hello josedaniel,

                Thanks for your reply.

                Did the print answer the question that the Heiken-ashi values (open and Close) match what is shown on the chart? (I would not expect then to match the underlying Renko bars) I just want to know if what you can see on the chart in terms of values and bar color matches what the print indicates.

                If not, can you post your code again with the print statement?


                Comment


                  #9
                  Hi Paul,
                  Indeed it did. The print exercise shown that the HAclose[0] and HAOpen[0] matches what is shown in the chart. Also they are different from the underlying values of the Spot Renko values.

                  The problem is that the Boolean statement:
                  HeikenAshiDoji().HAClose[0] >HeikenAshiDoji().HAOpen[0] = TRUE
                  Is giving mixed results, which is confusing. I can see in the print results some TRUE values where they should be FALSE becuase the Close value of the HA bar is lower than the Open value of the HA bar and viceversa.

                  Any next step to follow?
                  KR
                  Jose

                  Comment


                    #10
                    Hello josedaniel,

                    Thanks for your post.

                    The bool is set to true only when the condition is true. When the condition is actually false, the bool is remaining true because nothing except the entry set is setting back to false. From your previous code, you were only setting the bool false when you placed the entry order.

                    You may want to consider adding another set that changes the bool to false when the condition is not true.

                    Comment


                      #11
                      Hi Paul,
                      Could you lead me the way to some material I can watch or read regarding the how to add another bool to false, or about the Booleas topic.
                      To be honest I´m a bit lost on this subject.
                      KR,
                      Jose

                      Comment


                        #12
                        Hello Jose,

                        Thanks for your reply.

                        I'll link you (below) to the Strategy Builder reference materials but I am unsure that they will provide what you need.

                        What you would need to keep in mind is that a bool does not change states by itself. Just because a condition that would set it to true does not occur does not mean the bool would then be false. The only action you have taken is to set it to true, so you would need to create another condition, in another set, that when true would set the bool to a false state.

                        Here are the educational resource available on 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

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by NullPointStrategies, Yesterday, 05:17 AM
                        0 responses
                        62 views
                        0 likes
                        Last Post NullPointStrategies  
                        Started by argusthome, 03-08-2026, 10:06 AM
                        0 responses
                        134 views
                        0 likes
                        Last Post argusthome  
                        Started by NabilKhattabi, 03-06-2026, 11:18 AM
                        0 responses
                        75 views
                        0 likes
                        Last Post NabilKhattabi  
                        Started by Deep42, 03-06-2026, 12:28 AM
                        0 responses
                        45 views
                        0 likes
                        Last Post Deep42
                        by Deep42
                         
                        Started by TheRealMorford, 03-05-2026, 06:15 PM
                        0 responses
                        50 views
                        0 likes
                        Last Post TheRealMorford  
                        Working...
                        X