Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AmaAdx

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

    AmaAdx

    Hello all,

    I am currently stumped. I am using the lizard indicator AmaAdx that produces uptrend, neutral and downtrend. I am using the strat builder and had a question. I am able to successfully get it to fire when new trends happen however it keeps firing. I have been trying to add a condition to only trade once per trend and then reset at neutral in case the same trend happens again but am having some issues.

    A bit of example. Trade1 happens when the trend hits uptrend. it hits the TP.
    Uptrend then hits neutral - (this is when I want to "reset" the signal)
    Trade 2 fires new uptrend - would like to take another long here.

    Any help would be appreciated.

    #2
    Hello sprks7979,

    Use a bool.

    In the condition set that triggers the action, include requiring the bool to be false. When the condition to submit the order is true, in the action block set the bool to true and submit the order (or trigger whatever other action).

    Code:
    private bool actionTriggered;
    
    if (actionTriggered == true && /* conditions to reset and allow for a new action here */)
    {
    actionTriggered = false;
    }
    
    if (actionTriggered == false /* && your conditions to trigger the action here*/)
    {
    actionTriggered = true;
    // trigger action here
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply NinjaTrader_ChelseaB. Thats what I had initially. My issue comes that when the signal goes neutral, and then in the same direction as before the new "condition" isnt met due to the previous condition setting the bool. I may be misunderstanding all of this though. I am using the strategy builder as my coding skills arent good enough yet. I have attached a screenshot of my long side. the short is the exact opposite. Would I need to add another set for neutral position to set the bool there maybe?
      Attached Files

      Comment


        #4
        Hello sprks7979,

        What is the specific issue you are having? Where are you stuck?

        I see you are doing the opposite of what I suggested and requiring the bool to be true in the condition that places the order, which is fine.
        Are you unsure of when the indicator value is 0 (or whatever value you consider 'neutral') how to set the bool to false?

        Are you printing the time of the bar and the bool to understand when its being set to true or false?
        https://ninjatrader.com/support/foru...121#post791121
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks for the reply. I am able to see what is considered neutral and in the strat builder it would be indicatorTrend = 0. I have attached a screenshot of my issue. In the screenshot it shows a sell, with TP reached. Further down it goes to neutral then back to red, I am wanting to "reset" the signal at the neutral so it can take another trade at the next red. I do realize that I have what you suggested backwards and didnt realize it but it should still work the same correct?

          When I use the bool and set the first signal to oktotrade = false I have the same set as a condition on the short side. then at trigger I set it to true so it wraps back around to the long side. However, it only makes one trade long until a short happens. I am wanting to reset at neutral so I could take another previous trend trade if it happens. Without using the bool though it makes a trade every bar since theoretically the condition is true every bar until its not.

          I apologize if i'm not explaining it correctly. Thanks for your help.
          Attached Files

          Comment


            #6
            Hello sprks7979,

            However, it only makes one trade long until a short happens.
            Long or short, no new entry should be allowed after an entry has been placed, correct?

            However, it only makes one trade long until a short happens.
            You are expecting a second long entry order to be submitted before a short entry order is submitted?

            Is the bool set back to false?

            Is the condition to submit a second long entry evaluating as true? (Use prints to find out)

            Is EntriesPerDirection set to 2 or the number of long entries you are wanting in a direction? (Use TraceOrders to confirm)

            I am wanting to reset at neutral
            What conditions are in the condition set where are you setting OkToTrade to false to reset it?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              However, it only makes one trade long until a short happens.
              Long or short, no new entry should be allowed after an entry has been placed, correct?
              Wanting no new trade until signal can be reset by a neutral signal. If a long happens, and the TP is hit, 3 bars later it goes neutral, then 3 bars later goes long again, I want to be able to make another long entry. The conditions are met just as with the first long. Same on short side.

              ​You are expecting a second long entry order to be submitted before a short entry order is submitted?
              Yes, as long as the conditions are met again AFTER the neutral signal.

              Is the bool set back to false?
              Once I set the bool for the first long trade I am unsure how/where to set it to opposite so it can take another trade same direction if condition met again.

              Is the condition to submit a second long entry evaluating as true?
              The condition is still true.

              Is EntriesPerDirection set to 2 or the number of long entries you are wanting in a direction?
              Set to 2 minimum

              What conditions are in the condition set where are you setting OkToTrade to false to reset it
              I think this is where my problem was.

              I managed to get it to work as intended by adding a new set after the long and after the short and setting the neutral to reset the condition. If there is a better way I am all ears.

              I appreciate your patience helping me through this.

              Comment


                #8
                Hello sprks7979,

                Once I set the bool for the first long trade I am unsure how/where to set it to opposite so it can take another trade same direction if condition met again.
                From my understanding you want to set the bool back to false when the indicator value is 0. Add new new condition set and move this to be set 1. In the conditions compare the indicator plot to numeric value 0. For the action set the bool to true.

                The condition is still true.
                Are you sure? Can you provide output showing all values compared in the condition evaluate as true? (The condition also requires the bool to be true. So if the condition is true, then the bool is true.)
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Thank you that worked. I guess Since it executes left to right that makes sense. However now I have the same kind of issue only with an indicator that does not plot zero.

                  I have an indicator that plots a point. I use it in con​junction with a trend indicator. It plots, I take a long if with trend. Then It plots short signal but still same trend as before. Then plots another long. I want to be able to use the short as a "reset" so the next long, as long as it is still with trend, is taken. Any suggestions? Would this be similar to the earlier issue just with 2 new sets, one before each long/short set?

                  Thanks for all you help.
                  Attached Files

                  Comment


                    #10
                    Hello sprks7979,

                    Yes, add a new condition set and another bool. Compare the indicator plot to the value that you want to reset on. Set the variable to true.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Thanks. However now I cant get it to work on this one. How can I export my strategy builder so someone on here could view it to see what i see?

                      Comment


                        #12
                        Hello sprks7979,

                        To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
                        1. Click Tools -> Export -> NinjaScript...
                        2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
                        3. Click the 'Export' button
                        4. Enter a unique name for the file in the value for 'File name:'
                        5. Choose a save location -> click Save
                        6. Click OK to clear the export location message
                        By default your exported file will be in the following location:
                        • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
                        Below is a link to the help guide on Exporting NinjaScripts.
                        http://ninjatrader.com/support/helpG...-us/export.htm


                        Use prints to understand what is not working.

                        Specifically, the variable is not being reset to true, is this correct?
                        What is the condition that sets the variable to true?

                        Add a condition set before this condition set and don't add any conditions.
                        In the actions add Misc -> Print, and print the date, and the values used in the condition.

                        Below is a link to a forum post that demonstrates using Print() to understand behavior.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Thanks for the explanation, however now I cant get it to make any short trades. lol. The longs act as I want, using the opposite signal as reset, but now it only makes longs. I have attached my builder script if someone can notice what I did wrong. Also used the print and it works for longs but not shorts since none are taken. Thanks.
                          Attached Files

                          Comment


                            #14
                            Hello sprks7979,

                            If the conditions to submit the short entry order are not evaluating as true, print the time and all values in the condition to the output window. This will tell you why the condition is not evaluating as true, so you can fix the condition.

                            What is the condition that submits the short order?

                            Be sure to watch the 'Debugging using prints with the Strategy Builder' which demonstrates adding prints using the strategy builder. Note that there are labels for all values and comparison operators.

                            Save the output to a text and include this with your next post.
                            Last edited by NinjaTrader_ChelseaB; 10-25-2022, 11:15 AM.
                            Chelsea B.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by NullPointStrategies, Yesterday, 05:17 AM
                            0 responses
                            58 views
                            0 likes
                            Last Post NullPointStrategies  
                            Started by argusthome, 03-08-2026, 10:06 AM
                            0 responses
                            133 views
                            0 likes
                            Last Post argusthome  
                            Started by NabilKhattabi, 03-06-2026, 11:18 AM
                            0 responses
                            73 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