Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to add new strategy

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

    Unable to add new strategy

    I'm trying to add a strategy to a chart and to the Strategies tab. It's a simple strategy, started in the wizard and finished up with manual editing.

    When I try to add it, it doesn't get added. When I try to add it to a chart, the chart turns white/blank. I'm able to close the strategy dialog, but the chart never comes back. When I try to add it directly to the Strategies tab, the Add Strategy dialog box closes without an error and the strategy doesn't appear on the tab.

    I found this error message in the trace file, but don't know what to do next. Can you advise -- I'd appreciate it. My strategy is called mpPairs:

    2015-05-12 09:51:08:503 in OnUnhandledThreadException
    2015-05-12 09:51:08:531 *************** unhandled exception trapped ***************
    2015-05-12 09:51:08:531 There was an error reflecting type 'NinjaTrader.Strategy.mpPairs'.
    2015-05-12 09:51:08:531 at System.Xml.Serialization.XmlReflectionImporter.Imp ortTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.Imp ortElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.Imp ortTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)
    at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
    at NinjaTrader.Cbi.XmlSerializerDictionary.get_Item(T ype type)
    at NinjaTrader.Cbi.Serializer.Serialize()
    at NinjaTrader.Strategy.StrategyBase.SetDefault()
    at NinjaTrader.Strategy.NewStrategyForm.OnSetDefault( Object sender, EventArgs e)
    at System.Windows.Forms.ToolStripItem.RaiseEvent(Obje ct key, EventArgs e)
    at System.Windows.Forms.ToolStripMenuItem.OnClick(Eve ntArgs e)
    at System.Windows.Forms.ToolStripItem.HandleClick(Eve ntArgs e)
    at System.Windows.Forms.ToolStripItem.HandleMouseUp(M ouseEventArgs e)
    at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEven tArgs mea)
    at System.Windows.Forms.ToolStripDropDown.OnMouseUp(M ouseEventArgs mea)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ToolStrip.WndProc(Message& m)
    at System.Windows.Forms.ToolStripDropDown.WndProc(Mes sage& 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)

    #2
    I figured it out! There were internal variables that I had to change from public to private. That fixed the issue.

    Comment


      #3
      I'm having the same issue. The thing is I had a private var that I now want to expose publicly. As soon as I turned it public, I started getting this exception. I'm using NT8.

      Is there any way to fix this? I still need that var to be public, as I'm looking to access that data from outside the indicator.

      Also why would this exception come? Is it trying to determine the type of object by data members?

      Comment


        #4
        Just found out a solution. I added the [XmlIgnore] tag, and it works after being declared publicly too now.

        Comment


          #5
          Hello,

          You can also refer to the reference sample at the following link: http://ninjatrader.com/support/forum...ead.php?t=4991

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by usazencort, Today, 01:16 AM
          0 responses
          1 view
          0 likes
          Last Post usazencort  
          Started by kaywai, 09-01-2023, 08:44 PM
          5 responses
          603 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          6 responses
          22 views
          0 likes
          Last Post xiinteractive  
          Started by Pattontje, Yesterday, 02:10 PM
          2 responses
          20 views
          0 likes
          Last Post Pattontje  
          Started by flybuzz, 04-21-2024, 04:07 PM
          17 responses
          230 views
          0 likes
          Last Post TradingLoss  
          Working...
          X