Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set indicator for market trend

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

    Set indicator for market trend

    Hello,

    I`m just buisy with a strategy, and i would like to know how to config a indicator that it orders the strategy only to trade to the trend the indicator is showing.

    basically 1 indicator seeks trend
    the 2nd indicator makes the trades in the direction of indicator 1

    I hope this is a clear question

    thanks

    #2
    Rienb,

    It depends how your indicators are programmed. You would need to access either plot values or something that is exposed in your indicator to know what the indicator is saying.

    For example, to access the SMA indicator you would do SMA(somePeriod)[0] to get the SMA value of the current bar.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hello Josh,

      Thanks for the quick reply.

      I understand what you're telling me, i have searched everywhere in the ninjascript wizard but could not find the condition that gives permission to the other indicators to trade long or short in stead of trading long or short itself.

      How can i set that in the conditions creator in ninjascript wizard?

      Comment


        #4
        Rienb, it would depend what your trend indicators offers to access, you could applpy it to a chart and check with the databox what plots are used to generate your trend condition. Then recreate those in the wizard, to learn how to access the individual plots from indicator in our wizard, please see this -

        Comment


          #5
          I understand that part,

          i have made 2 sma`s that cross, and they trade now when they cross, but i want them to set the trend in stead of trading.

          how can i set this into the condition builder?

          Comment


            #6
            You could set for example a user defined variable to 1 for 'current trend is long' and - 1 'current trend is short' and then check those off in other rules where you actually trigger trades then...

            Comment


              #7
              ok,

              i have now made 2 Bools, 1 trend short, 1 long

              i have them editted on the entry indicators as following:

              for a long trade
              the long user defined variable needs to be True

              for short
              the short user defined variable needs to be True

              but i`m stuck now on how to let the 2x moving averages control the Bools

              can one of you guys tell me how to do that?

              Comment


                #8
                You will need to work with the user variables in the wizard, as you can set those via the the wizards strategy actions (Misc section), this is then essentially the same as working with bools.

                Comment


                  #9
                  can you please tell me exactly how to do that?

                  i cannot make a proper strategy without errors with the user variables

                  Comment


                    #10
                    Hello Reinb,

                    User Variables in the strategy wizard can function like bools using the following approach

                    Condition - A condition is expressed checking a user variable value. If you only want to work with two states, it is common to use values 0 and 1.

                    Action (Assignment) - An action is set assigning the value of a user variable.

                    Reset - At some point you will want to reset the value of your user variable. This could be at a certain time of day or when you exit a trade.

                    Moving averages don't "control" the bools. You just use the approach above to create the sequence you're after. Outline your specifications more objectively and we can help assist in where to check, assign, and reset your user variables.
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      It works now

                      i tought i needed to edit the user variable first, but its just simpeler than i was thinking of!

                      Thanks!

                      Comment


                        #12
                        Hello,

                        i have now got everything set correctly, but i have one question now:

                        ive have a indicator that spots the trend, when a other indicator has pulled off a trade he doesnt trade again until the trend changes.

                        i would like to allow the system to trade in the same trend if it is the next day and the trend is still the same, how can i make the computer aware of the fact that it`s a new day?

                        Comment


                          #13
                          Great to hear rienb, you could for example check for a new day in the wizard by comparing the CurrentDay open with the PriorDay open, both would be accessible as indicators, if those do not equal each other (!=) we have a new day present.

                          Comment


                            #14
                            Great,

                            Done that, i have also put in the session open time as a requirement to change the user variable to long or short, is it correct if i inserted it like this:

                            09.00 == 09.00

                            Regards

                            Comment


                              #15
                              You're welcome, you would need to setup your time conditions like this - http://www.ninjatrader-support.com/H...mparisons.html

                              By working with the time series on the left side you actually access the bar timestamp, so you could then compare it to a time value you've set on the right side (like your 9:00 AM one).

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              666 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              377 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              110 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              575 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              580 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X