Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Offset in Strat Wizard doesn't appear in code

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

    Offset in Strat Wizard doesn't appear in code

    My apologies if this has already been addressed. I couldn't find it in searches of the forum.

    When I specify an offset using the Strategy Wizard for a crossAbove signal, nothing appears in the code. I need my close to cross above a moving average by at least 5 pips.

    I tried to edit the code, but the CrossAbove() function uses dataseries, so there must be a workaround somehow. Can anyone help with this please?

    #2
    Please post a screenshot of what you have already. Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      screen print and code

      protected override void OnBarUpdate()
      {


      // Condition set 1
      if (CrossAbove(Close, ADXVMA(ADX_Per).ADXVMAPlot, 1))
      {
      EnterLongLimit(DefaultQuantity, GetCurrentBid(), "EnterLongOnADXCross");
      }
      // Condition set 2
      if (CrossBelow(Close, ADXVMA(ADX_Per).ADXVMAPlot, 1))
      {
      EnterShortLimit(DefaultQuantity, GetCurrentAsk(), "");
      }
      }
      Attached Files

      Comment


        #4
        Please select the series on the left and the close on the right. See if that helps.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Sorry Josh,

          I reversed the respective members of the equation with each other and tried both combinations of where to set the offset (using the User Input), neither produced any changes in the code.

          I also tried creating the strategy anew to see if there could be a re-write problem in the code generator that prevented your suggestion from working in an edit.

          Further, I tried using a scalar (5), and still no sign of the offset being used in any calculation anywhere in the code.
          Last edited by crmcwi; 08-19-2009, 11:36 AM. Reason: forgot to include fact that I tried using a scalar

          Comment


            #6
            In that case, then unfortunately you will have to unlock your code to and custom program it. The Wizard compares series to series not series to double which is what you are trying to do.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              cool,

              Just wanted confirmation. So, could I create a DataSeries where Close + x and another where Close - x is stored?

              Comment


                #8
                With custom programming you don't need to create another DataSeries. You can just directly compare a series to a double.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  data series

                  Thanks Josh,

                  I didn't know the CrossAbove() would take take a double, so I did this with your help in another thread and per the help guide.

                  in variables, declare a DataSeries

                  private DataSeries shortSeries;
                  private DataSeries longSeries;

                  In OnInitialize(), instantiate the series

                  longSeries = new DataSeries(this);
                  shortSeries = new DataSeries(this);


                  and then Set() the values in OnBarUpdate():

                  longTrigger1 = (10000*thisClosingPrice - 10000*entryRange)/10000;
                  shortTrigger1 = (10000*thisClosingPrice + 10000*entryRange)/10000;

                  longSeries.Set(longTrigger1);
                  shortSeries.Set(shortTrigger1);

                  Comment


                    #10
                    That should work too.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    647 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    368 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    108 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    571 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    573 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X