Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder Variables

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

    Strategy Builder Variables

    Hello, I love the new Ninjatrader 8 but I'm having trouble building the following strategy in the strategy builder because of the variable involved. If price crosses below the 60 period SMA, I want to enter a short position, not right away, but wait until price reverses and crosses back above the 15 period SMA so I'm shorting on the retracement. So, I need to hold the state of the 60 period SMA cross below and then look and wait for the next condition which is price moving back above the 15 SMA and then enter a short position. Is that possible in the strategy builder?

    I also wish to reverse the strategy and go long when price crosses above the 60 SMA.

    Thanks, Trevor

    #2
    Hello Trevor.

    Thank you for the post and welcome to the NinjaTrader forum.

    You will have to set up a boolean variable that will act as a toggle for your short entry (Photo 1).
    When the 60 SMA crossbelow happens, set the bool to true (Photo 2) in set 1.

    Now make another set of conditions (Set 2) and enter short if the bool is true and if the SMA 15 crossabove happens (Photo 3). You might also want to set the bool variable back to false after you have entered short.

    Please let us know if we may be of any further assistance.
    Attached Files
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks very much, Chris. How do I set the bool variable back to false after I have entered short? Can you show me a screenshot? The strategy is working but it keeps continuing to short on every cross of the 15 SMA for the rest of the day and I just want to short once after the cross of the 60 SMA and not do it again until there's a new cross of the 60 SMA.

      Comment


        #4
        Hello,

        Thank you for the reply. In Set 2, in your "Actions" list. After you have entered short, set ShortTrade back to false.


        Please let us know if we may be of any further assistance.
        Attached Files
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hi Chris, regarding your proposal to turn off the Bool: What is the idea behind? Allowing only one signal in the direction? Instead would it be possible with the strategy builder to allow overall only 3 or 4 signals during a session? How do I do that?

          Comment


            #6
            Hi guw, thanks for posting.

            A counter would be needed to count the trades a strategy has made and that is unfortunately not possible in the builder. You would need to unlock the script and write this trade counter. We have an example here:
            https://ninjatrader.com/support/foru...ssions?t=19182

            Kind regards,
            -ChrisL
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Thank you very much. That helps

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by kaywai, Today, 06:26 AM
              1 response
              5 views
              0 likes
              Last Post kaywai
              by kaywai
               
              Started by ct, 05-07-2023, 12:31 PM
              6 responses
              203 views
              0 likes
              Last Post wisconsinpat  
              Started by kevinenergy, 02-17-2023, 12:42 PM
              118 responses
              2,780 views
              1 like
              Last Post kevinenergy  
              Started by briansaul, Today, 05:31 AM
              0 responses
              10 views
              0 likes
              Last Post briansaul  
              Started by traderqz, Yesterday, 12:06 AM
              11 responses
              28 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X