Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Easiest way to plot a value from within a strategy?

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

    Easiest way to plot a value from within a strategy?

    What is the easiest way to plot a value from within a strategy?

    For example I have some intermediate result from a calculation that I want to plot for debugging purposes. It seems to work different compared to indicators.

    Sorry I'm asking quite basic questions. I'm not yet familiar with C#, always used EL before.

    #2
    Please check out the docs: http://www.ninjatrader-support.com/H...eV6/Print.html

    Works the same for strategies and indicators.

    Comment


      #3
      Originally posted by NinjaTrader_Dierk View Post
      Please check out the docs: http://www.ninjatrader-support.com/H...eV6/Print.html

      Works the same for strategies and indicators.
      I mean plotting a value as a graph, like an indicator.

      Comment


        #4
        a) You can not plot an "intermediate result from a calculation" on chart like an indicator, you only can plot actual values of a calculation to the output window using the Print() statement.

        b) Please see SampleMACrossStrategy for how to add an indicator plot to a chart as the strategy is executed on chart.

        Comment


          #5
          Yes I had looked at that already.
          But there you already have an indicator that you can plot and call from your strategy.

          What I would like to do for example is to plot the bid-ask spread along with the strategy that I'm testing. I guess I can create an indicator for this and then plot that indicator from within my strategy like in the SMACross example. But I was wondering if there is a quick and easy way to do something like that quickly directly from within the strategy.

          Sometimes it is useful to plot some 'internal' parameter as a graph for debugging purposes (this is what I meant) but I prefer not to create an indicator when I want to do that.

          I hope you get my idea (sorry for my not so clear initial explanation) but maybe there is no simple way to do this.

          Comment


            #6
            Right, as you already figured you would need to code an indicator or code additional plot series for the indicator, holding temporary calculation values.

            Comment


              #7
              FireFly,

              I appreciate your post and agree, it would be nice to have "one-the-fly" plotting capabilities from NinjaScript strategies without the need to prepare a separate indicator. But keep in mind you can also push out intermediate values with a bar identifier timestamp to the output window using the Print statement for debugging purposes although I realize this may not be as convenient or as useful as a plot on a chart.

              Regards,

              Whitmark
              whitmark
              NinjaTrader Ecosystem Vendor - Whitmark Development

              Comment


                #8
                Originally posted by whitmark View Post
                FireFly,

                I appreciate your post and agree, it would be nice to have "one-the-fly" plotting capabilities from NinjaScript strategies without the need to prepare a separate indicator. But keep in mind you can also push out intermediate values with a bar identifier timestamp to the output window using the Print statement for debugging purposes although I realize this may not be as convenient or as useful as a plot on a chart.

                Regards,

                Whitmark
                Yes, this is exactly how I have been doing it up to now.
                Just wondering if there is still some way to plot it...

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by CarlTrading, 03-31-2026, 09:41 PM
                1 response
                152 views
                1 like
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 04-01-2026, 02:41 AM
                0 responses
                87 views
                1 like
                Last Post CarlTrading  
                Started by CaptainJack, 03-31-2026, 11:44 PM
                0 responses
                131 views
                2 likes
                Last Post CaptainJack  
                Started by CarlTrading, 03-30-2026, 11:51 AM
                0 responses
                127 views
                1 like
                Last Post CarlTrading  
                Started by CarlTrading, 03-30-2026, 11:48 AM
                0 responses
                106 views
                0 likes
                Last Post CarlTrading  
                Working...
                X