Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 timmbbo, Today, 08:59 AM
                    2 responses
                    10 views
                    0 likes
                    Last Post bltdavid  
                    Started by alifarahani, Today, 09:40 AM
                    6 responses
                    40 views
                    0 likes
                    Last Post alifarahani  
                    Started by Waxavi, Today, 02:10 AM
                    1 response
                    18 views
                    0 likes
                    Last Post NinjaTrader_LuisH  
                    Started by Kaledus, Today, 01:29 PM
                    5 responses
                    15 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by Waxavi, Today, 02:00 AM
                    1 response
                    12 views
                    0 likes
                    Last Post NinjaTrader_LuisH  
                    Working...
                    X