Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator prints a message only after strategy is live

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

    indicator prints a message only after strategy is live

    Have a strategy that uses a custom indicator.
    both have a Print debugging command.

    please advise,
    why would the Print of the indicator only start printing AFTER the strategy has processed the history and waits for live data ?
    I expected that in the history mode, both the indicator as well as a strategy will be printing messages .

    what can be the issue
    before the "enabling NinjaScript strategy " line is the print from the strategy and after that line I get the print from the processing of the indicator.
    Click image for larger version  Name:	image.png Views:	0 Size:	190.9 KB ID:	1337328
    I can post the code if needed, but thought maybe a quick direction what to look for....?​
    Last edited by dadarara; 03-11-2025, 05:50 AM.

    #2
    Hello dadarara,

    May I confirm the indicator is adding a plot and setting plot values?

    May I confirm the strategy is calling indicator and using the plot value?

    (The use of a series causes the indicator to update)

    Are you printing the State property in both the strategy and indicator with the time of the bar in OnBarUpdate()?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      i attach the files.
      basically my problem is that the indicator instantiated in the strategy, plots correctly but no values are getting updated. it is as if indeed the indicator is running all the history values ONLY AFTER the strategy processes the history.

      Attached Files

      Comment


        #4
        Hello dadarara,

        It's helpful to create a simplified test script with only a few lines of code to demonstrate the issue.

        There are multiple indicators in the script you provided.

        Which indicator is the indicator in question?

        On which line are you calling a plot value?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          hi
          there is only one customer indicator FVGICT
          it is called "fvgIndicator" in the strategy
          ​​in line 905 of the indicator I have the print command
          and in the line 753 of the strategy one more Print command.
          the strategy has all the trading command commented out. but either way it doesnt work because the list. "fvgIndicator.notfilledRed" is not being populated with values and fvgIndicator.notfilledRed.Count = 0
          as i said before , it looks like this list starts to be populated with values only after the strategy runs through the history data. and only then the indicator runs as well.
          thats why the value of the count = 0.

          hope that makes sense and clear.

          Comment


            #6
            Hello dadarara,

            On line 753 I am seeing:

            Print(Time[0].ToString() + " print in strategy " + fvgIndicator.notfilledRed.Count);

            This is not a plot series.

            This appears to be a List<FVG> object.

            Try printing the plot series.

            Print(string.Format("{0} | fvgIndicator[0]: {1}", Time[0], fvgIndicator[0]));
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              there is no plot , i use DRAW object
              the indicator finds gaps in price action and identifies them using the high price low price start time and end time. it uses these value to DRAW a rectangle.
              it also saves these value as a list of values (CLASS FVG). there are several lists with the same structure based on this class.
              all i am trying to do is to access the value of these lists.
              my expectation is that the indicator and the strategy runs the OnBarUpdate in synchronization. so that any update in the indicator and a consequent update of the lists values is being done on the historical data together with the process of the strategy. so that if there is one new record in the list "fvgIndicator.notfilledRed" within the indicator, I can get the value of "fvgIndicator.notfilledRed.Count = 1". in the strategy.

              maybe to describe it simply; I want to reach from the strategy the values of a list that exists in the indicator.
              Last edited by dadarara; 03-11-2025, 09:54 AM.

              Comment


                #8
                Hello dadarara,

                "there is only one customer indicator FVGICT"

                Note, I am seeing two indicators in this strategy: IGTDSequentialZAFI and FVGICT.


                "there is no plot"

                The indicator adds a plot series on line 569 and assigns a plot value on line 872.


                Calling a plot series causes the indicator to update.

                If you want values from other public objects that are calculated and assigned in OnBarUpdate(), call a plot series.​

                Please let me know if this does not correct the behavior.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  oops. didnt notice i added another indicator.
                  so, the indicator will only update itself if there will be some PLOT running inside.
                  correct ?

                  Comment


                    #10
                    Hello dadarara,

                    "so, the indicator will only update itself if there will be some PLOT running inside.
                    correct ?​"

                    Basically, yes.

                    You can call <Indicator>.Update() on the indicator, however this will update the historical data after the strategy has updated its historical data.
                    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

                    This doesn't happen if the host script calls a plot series in the symbiote hosted indicator.
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by NullPointStrategies, Today, 05:17 AM
                    0 responses
                    50 views
                    0 likes
                    Last Post NullPointStrategies  
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    126 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    69 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    42 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    46 views
                    0 likes
                    Last Post TheRealMorford  
                    Working...
                    X