Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue with running strategy in analyzer

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

    Issue with running strategy in analyzer

    Hi I have a strategy that i can run in market replay, however its not running in strategy analyzer. Upon opening VS i noticed there is this error to how i call BOP indicator. Could this be the issue? It seems right to me..
    private BOP bopMaster,

    BOPMPeriod = 14;

    in dataloaded
    bopMaster = BOP(BOPMPeriod);

    Click image for larger version

Name:	image.png
Views:	79
Size:	274.5 KB
ID:	1255743

    #2
    Hello, thanks for writing in. Does this code compile in the NinjaScript Editor? Visual Studio does not need to compile this code, the only thing that needs to compile is the NinjaScript editor in order for the scrip to work. When you run the script in the Analyzer, do you get any errors in the Log tab of the Control Center?
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi yes this code compiles and runs and i can even run in it market replay.
      When i hit RUN button in analyzer i get this error
      Strategy 'NameOfTheStrategy': Error on calling 'OnStateChange' method: Object reference not set to an instance of an object.

      however this strategy is not the same one i am trying to run. Previously I copied pasted boilerplate code from that strategy to this one.. And there is no where "NameOfTheStrategy" in the strategy code i am tryinig to run.

      Comment


        #4
        I am sorry i had State != State.Realtime in my code

        How can i create a logic if bool ShowHistoricalTrades is selected then i can see historical trades, if not then no.

        if(ShowHistoricalTrades)
        {
        State = State.Realtime
        }
        if (State != State.Realtime) //Only trades realtime. Ignores historical trades.
        {
        return;
        }​

        Comment


          #5
          Hi, the State can not be assigned with the = operator. That would be written as

          if(!ShowHistorical && State == State.Historical)
          return;
          else
          {
          //run the strategy code here.
          }
          Chris L.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Mountain_cast, 02-10-2025, 11:14 PM
          3 responses
          20 views
          0 likes
          Last Post beobast
          by beobast
           
          Started by defa0009, 12-13-2024, 09:19 AM
          21 responses
          210 views
          1 like
          Last Post marcus2300  
          Started by ttrader23, Today, 04:48 PM
          0 responses
          6 views
          0 likes
          Last Post ttrader23  
          Started by wisdomspoon, Today, 03:50 PM
          3 responses
          15 views
          0 likes
          Last Post rockmanx00  
          Started by Robotman, Today, 01:06 PM
          2 responses
          37 views
          0 likes
          Last Post Robotman  
          Working...
          X