Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with Strategy Wizard question

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

    Help with Strategy Wizard question

    I am trying to use the strategy builder wizard to accomplish the following:

    SMA= SMA of last 20 bars

    if (SMA > SMA[1]) then buy at (SMA + AverageTrueRange(of last 20 bars))

    if (SMA < SMA[1]) then sell at (SMA - AverageTrueRange(of last 20 bars))



    Can this be done using the wizard? I can't get it to work.
    If it can't be done with the wizard, can you reply with the code?


    Thanks!

    #2
    99% possible with the wizard. You just can't tell your limit order to be SMA(14)[0] + ATR(20)[0].

    Code:
    if (SMA(14)[0] > SMA(14)[1])
               EnterLongLimit(DefaultQuantity, (SMA(14)[0] + ATR(20)[0]), "");
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh!! This is great!


      Originally posted by Josh View Post
      99% possible with the wizard. You just can't tell your limit order to be SMA(14)[0] + ATR(20)[0].

      Code:
      if (SMA(14)[0] > SMA(14)[1])
                 EnterLongLimit(DefaultQuantity, (SMA(14)[0] + ATR(20)[0]), "");

      Comment


        #4
        Now that I have a long position entered, I want to be able to close it when:

        The price hits the SMA(20). How can I do that?

        Thanks!


        Originally posted by Josh View Post
        99% possible with the wizard. You just can't tell your limit order to be SMA(14)[0] + ATR(20)[0].

        Code:
        if (SMA(14)[0] > SMA(14)[1])
                   EnterLongLimit(DefaultQuantity, (SMA(14)[0] + ATR(20)[0]), "");

        Comment


          #5
          The same way as you entered. Create your exit condition from an if statement and then exit your position with ExitLong().

          Code:
          if (Close[0] > SMA(20)[0])
               ExitLong();
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Thanks Josh!!


            Originally posted by Josh View Post
            The same way as you entered. Create your exit condition from an if statement and then exit your position with ExitLong().

            Code:
            if (Close[0] > SMA(20)[0])
                 ExitLong();

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X