Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Major strategy bug...

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

    Major strategy bug...

    I have a major issue with strategies. All my strategies that were working well in 6.5 are not working and creating exception all over the place.

    I tried to send the trace file by email but didn't work. Here is the important part I think from the trace file :

    2009-10-05 16:07:11:472 in OnUnhandledThreadException
    2009-10-05 16:07:11:566 ********* exception trapped *********
    2009-10-05 16:07:11:566 String was not recognized as a valid Boolean.
    2009-10-05 16:07:11:566 at System.Boolean.Parse(String value)
    at NinjaTrader.Strategy.Parameter.get_Value()
    at NinjaTrader.Strategy.Parameter.Clone()
    at NinjaTrader.Strategy.ParameterCollection.Clone()
    at NinjaTrader.Strategy.StrategyBase.Clone()
    at NinjaTrader.Gui.Chart.ChartControl.Add(StrategyBas e strategyTemplate)
    at NinjaTrader.Gui.Chart.ChartStrategies.Apply()
    at NinjaTrader.Gui.Chart.ChartStrategies.OnApplyButto nClick(Object sender, EventArgs e)
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    Hope it helps

    Bernard

    #2
    Hi Bernard,

    Thanks for reporting. We of course would need to take this step by step. Although the call stack is of value, it may not be enough to trap this particular issue.

    Is there any possible way we are able to get a reproducible scenario from you?
    RayNinjaTrader Customer Service

    Comment


      #3
      Ray


      I read the email you sent yesterday and I may have a few possibilities. In all my properties I still have the [Category("Parameters")]. I have changed it for
      [GridCategory("Parameters")].

      No change in the result.


      I am also using the .token value in my code like this :

      if (entryBOrder1 != null && entryBOrder1.Token == order.Token)

      Should I replace that ?



      I can send you My strategy template code by email if that could help.


      Bernard

      Comment


        #4
        Token influences the behavior of your orders and would not necessarily be the cause for the "String was not recognized as a valid Boolean" error.

        If you have a reproducible sample strategy we could test with, please attach it and we can try on our end. Thank you.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Guys

          I've played a bit with the code earsing part of it trying to find a way to get to this exception.


          It seems that when I erased the properties I could apply the strategy without exceptions being thrown.

          Here are my properties :

          [Description("No trades after this time")]
          [GridCategory("Parameters")]
          public int Last_Trade_Time
          {
          get { return lastTradeTime; }
          set { lastTradeTime = value; }
          }

          [Description("First Target contracts")]
          [GridCategory("Parameters")]
          public int Cnts_FirstTarget
          {
          get { return Cnts_firstTarget; }
          set { Cnts_firstTarget = value; }
          }

          [Description("Second Target Contracts")]
          [GridCategory("Parameters")]
          public int Cnts_SecondTarget
          {
          get { return secondTarget_Cnts; }
          set { secondTarget_Cnts = value; }
          }

          [Description("Third Target contracts")]
          [GridCategory("Parameters")]
          public int Cnts_ThirdTarget
          {
          get { return thirdTarget_Cnts; }
          set { thirdTarget_Cnts = value; }
          }

          [Description("Stop loss in ticks")]
          [GridCategory("Parameters")]
          public int StopLoss
          {
          get { return stopLoss; }
          set { stopLoss = value; }
          }

          [Description("First Target in ticks")]
          [GridCategory("Parameters")]
          public int Ticks_FirstTarget
          {
          get { return firstTarget_Ticks; }
          set { firstTarget_Ticks = value; }
          }

          [Description("Second Target in ticks")]
          [GridCategory("Parameters")]
          public int Ticks_SecondTarget
          {
          get { return secondTarget_Ticks; }
          set { secondTarget_Ticks = value; }
          }

          [Description("Third Target in ticks")]
          [GridCategory("Parameters")]
          public int Ticks_ThirdTarget
          {
          get { return thirdTarget_Ticks; }
          set { thirdTarget_Ticks = value; }
          }

          [Description("Do you need the trailing stop")]
          [GridCategory("Parameters")]
          public bool TrailingStop
          {
          get { return trailingStop; }
          set { trailingStop = value; }
          }

          [Description("Number of profitable ticks before the trailing stop is enabled")]
          [GridCategory("Parameters")]
          public int TrailStopTrigger
          {
          get { return trailStopTrigger; }
          set { trailStopTrigger = value; }
          }

          [Description("Number of ticks trailing behind market once enabled")]
          [GridCategory("Parameters")]
          public int TrailStopTicks
          {
          get { return trailStopTicks; }
          set { trailStopTicks = value; }
          }

          [Description("Filter Setup")]
          [GridCategory("Parameters")]
          public FilterState Filter_Setup
          {
          get { return filter_Setup; }
          set { filter_Setup = value; }
          }

          [Description("Filter Stategy")]
          [GridCategory("Parameters")]
          public FilterCase Filter_Method
          {
          get { return filter_Method; }
          set { filter_Method = value; }
          }


          Thanks

          Bernard

          Comment


            #6
            Looking at our code ... I have an idea what might be going wrong. Could you please go Tools->Options and just close the dialog by pressing OK?

            Would that resolve the issue?

            Comment


              #7
              Dierk


              Just did what you said.
              The problem is still there.

              It was working so well in NT6.5 !
              What could have happened ?




              Bernard

              Comment


                #8
                Hmm ... no sure then. Could you please post one of your strategies so we could take look? Thanks

                Comment


                  #9
                  They are big files that also rely on indicators.
                  Really complex, difficult to post I think





                  Bernard

                  Comment


                    #10
                    We needed something to work with. Could you please strip it down to a small sample which would exhibit the issue? Thanks

                    Comment


                      #11
                      Dierk

                      I will try to do that.
                      I am in Montreal and it is 12:41 in the night.
                      So I'll take some rest and do that tomorrow


                      Thanks for your help

                      Bernard

                      Comment


                        #12
                        Thanks for working on that with us. Appreciated. Later...

                        Comment


                          #13
                          After many tries it seems that it all comes back to this :

                          [Description("Do you need the trailing stop")]
                          [GridCategory("Parameters")]
                          public bool TrailingStop
                          {
                          get { return trailingStop; }
                          set { trailingStop = value; }
                          }

                          If I remove that property the strategy is running without exceptions BUT generate nothing.. no trades !!


                          Bernard

                          Comment


                            #14
                            Looking into ...

                            Comment


                              #15
                              A few more tests...


                              If I put a Print("What's up!") to follow code at run time I have found the following :


                              If I put this statement in the Initialize() method when I click on strategies...
                              in the context menu I see three print :
                              What's up!
                              What's up!
                              What's up!


                              If I put the statement at the start of the OnBarUpdate method I see
                              no Print statement at all


                              Bernard

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              612 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              355 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              561 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              564 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X