• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
                  http://ninjatrader.com/support/helpG...a_strategy.htm
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by cociahange, Today, 03:53 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post cociahange  
                  Started by dukeoferl, Today, 03:26 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post dukeoferl  
                  Started by Titelluvifa, Today, 02:49 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post Titelluvifa  
                  Started by rehagen, Today, 01:44 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post rehagen
                  by rehagen
                   
                  Started by bouncetherubble, Yesterday, 07:33 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post bouncetherubble  
                  Working...
                  X