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:	92
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?

    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.
          }

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          65 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          139 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X