PDA

View Full Version : Easiest way to plot a value from within a strategy?


FireFly
06-11-2007, 03:39 AM
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.

NinjaTrader_Dierk
06-11-2007, 04:06 AM
Please check out the docs: http://www.ninjatrader-support.com/HelpGuideV6/Print.html

Works the same for strategies and indicators.

FireFly
06-11-2007, 04:14 AM
Please check out the docs: http://www.ninjatrader-support.com/HelpGuideV6/Print.html

Works the same for strategies and indicators.

I mean plotting a value as a graph, like an indicator.

NinjaTrader_Dierk
06-11-2007, 04:18 AM
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.

FireFly
06-11-2007, 04:31 AM
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.

NinjaTrader_Dierk
06-11-2007, 04:35 AM
Right, as you already figured you would need to code an indicator or code additional plot series for the indicator, holding temporary calculation values.

whitmark
06-11-2007, 07:05 AM
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

FireFly
06-11-2007, 08:33 AM
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...