Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with strategy wizard

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

    Problem with strategy wizard

    Hello,

    why this simply strategy doesn't work?

    if (Close[0] > Close[20]
    && Close[0] > Close[60])
    {
    DrawDot("My dot" + CurrentBar, false, 0, High[0] + 15 * TickSize, Color.Green);
    }

    But if I change the parameters it works perfectly.

    if (Close[0] > Close[5]
    && Close[0] > Close[10])
    {
    DrawDot("My dot" + CurrentBar, false, 0, High[0] + 15 * TickSize, Color.Green);
    }

    I can't fins the logical reason why it is so. I am 100% sure that there are bars which have this conditions and dot shuld be draw.

    #2
    Hello,

    Thanks for your forum post.

    More then likely you do not have enough bars back in the chart to make the condition run. Please check the log tab in the control center when you run this strategy or indicator. Do you see a log error?

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #3
      I am backtesting on daily data. I have uploaded data since 2000 1 st january, so for it must be something different.

      Where I can se a log error in control center?

      Daniel

      Comment


        #4
        Hello,

        Please check in the control center->log tab. Do you see any errors listed here?
        BrettNinjaTrader Product Management

        Comment


          #5
          Hello,

          I checked. There is error but unfortunetly in Polisch language. I will try to translate:

          "Error on calling 'OnBardUpdate' method for strategy 'WyznaczanieTrendu': Index is outside the range. It must be not minus and lower than size of collection.

          Name of parameter:Index"

          I hope you understand my translation.

          Daniel

          Comment


            #6
            Hello,

            Yea this corresponds with what I think is occuring.

            Since your sample size is so large you will need to add a custom check for this by opening the code and unlocking the code in the strategy wizard and adding the following code:



            you will need to check to make sure you have 60 or more bars in the chart before you start calculating the indicator value.



            I look forward to assisting you further.
            BrettNinjaTrader Product Management

            Comment


              #7
              Thanks, it helps.

              Daniel

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CarlTrading, 03-31-2026, 09:41 PM
              1 response
              67 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 04-01-2026, 02:41 AM
              0 responses
              36 views
              0 likes
              Last Post CarlTrading  
              Started by CaptainJack, 03-31-2026, 11:44 PM
              0 responses
              59 views
              1 like
              Last Post CaptainJack  
              Started by CarlTrading, 03-30-2026, 11:51 AM
              0 responses
              62 views
              0 likes
              Last Post CarlTrading  
              Started by CarlTrading, 03-30-2026, 11:48 AM
              0 responses
              53 views
              0 likes
              Last Post CarlTrading  
              Working...
              X