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

Strategy does not load

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

    Strategy does not load

    im trying to create a strategy mixing price breakout (a free strategy find here) and another one. i would like to use the same type of trail stop, but using different entry. so i copied the entry condition: and all other stuff like private ... and under propritie

    it gives me no error but i cannot enable it

    i have attached a txt with the code
    Attached Files

    #2
    here the the original one:
    Attached Files

    Comment


      #3
      Hello lorenzoP,

      Thanks for your posts.

      In general, if you cannot load the strategy then you would want to observe the "log" tab of the control center as there may be errors in the loading process of the strategy that will show in the log but would not be something the compiler would be able to catch.

      Taking a quick look at the first post attachment it looks like you are using AddChartIndicator(PriceBreakoutRectangularBase(upw ardBreakout,volumeMultiple)); The PriceBreakoutRectangularBase() is a strategy, not an indicator so it cannot be added to the chart like an indicator. AddChartIndicator() should only be used in State.DataLoaded.

      Your second line of code in OnBarUpdate() is: if ((Close[1] > EMA1[1]) this line will generate a run time error that you would see in the Log tab. On the very first bar of data loaded the code is trying to look back one bar which does not yet exist. You would need to employ a check of the "CurrentBar" to ensure enough bars are loaded before trying to access them. Reference: http://ninjatrader.com/support/helpG...currentbar.htm
      Later on, it appears you are accessing the index of [2] so you might want to use as the first line of code in OnBarUpdate() if (CurrentBar < 2) return; to prevent bar index access errors.

      Commenting out (or removing) the AddChartIndicator in State = State.Configure and adding the CurrentBar check should allow your strategy to load/run.
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Hi, there is also an indicator, with the same name of the strategy, as said i have not change nothing about the original strategy (you can find it in the download section)
        ill try changing the "current bur"

        Comment


          #5
          Hello lorenzoP,

          Thanks for your reply.

          I was not aware of that, thank-you.

          In that case, move the line AddChartIndicator(PriceBreakoutRectangularBase(upw ardBreakout,volumeMultiple)); to the state == state.Dataloaded section.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            ill do it, i have a general question:
            does the strategy analyzer uses leverage? if i set 1000 as order size this mean that im open a position for example with 1000 euro, right?

            Comment


              #7
              Hello lorenzoP,

              Thanks for your reply.

              In the strategy analyzer, it would be, in your example 1000 units of whatever the per unit value is of the instrument.
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Hi, another question, in the strategy analyzer, does the total net profit include commision or not?
                Last edited by lorenzoP; 05-27-2017, 05:41 AM.

                Comment


                  #9
                  Hello lorenzoP,

                  If 'Include Commission' is set to True, then yes, any commissions setup would be included with the Net Profit.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by algospoke, Today, 06:40 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post algospoke  
                  Started by maybeimnotrader, Today, 05:46 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post maybeimnotrader  
                  Started by quantismo, Today, 05:13 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post quantismo  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  8 responses
                  168 views
                  0 likes
                  Last Post jeronymite  
                  Started by cre8able, Today, 04:22 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post cre8able  
                  Working...
                  X