DrawText on each candle
DrawText on each candle
31 Oct 2012, 13:13
Hello,
Can you please send an example of how can I drawing text to each candle not only for one (e.g. last one).
I try this code but in this case the text displayed only on last candle.
string test = Convert.ToString(MarketSeries.Close[index]);
ChartObjects.DrawText("test",test,index,MarketSeries.High[index],VerticalAlignment.Top,HorizontalAlignment.Center,Colors.White);
Thanks for your help!
Replies
TraderM
30 Dec 2012, 22:04
Hi, does this only work in real time? Backtesting, I get nothing written to the screen.
The example in the API reference under DrawText (example 1) starts:
if(IsRealTime)
....
which implies that this is indeed a solution for real time. If so, is it possible to write to the chart when backtesting?
What I really want to do is to highlight in the charts where I create/delete pending orders, enter and exit trades and so on, when back testing. Currently I have to find the places in the charts going back and forth using the account history or the log with my Print functions. This takes ages...
Any ideas how to do this?
/M
@TraderM
admin
03 Jan 2013, 10:49
Hello,
Visual Backtesting will be available in the future, then it will be possible to use DrawText while backtesting. For the time being the print log seems to be the only way to do this. Maybe you can create an indicator from this log if you save it to file and then you can visualize it on the chart?
@admin
atrader
31 Oct 2012, 14:19
Hello,
The object name needs to be unique, otherwise it will be the same object assuming a new position.
Therefore modify the object name for each new instance of text.
For example:
string test = Convert.ToString(MarketSeries.Close[index]);
string objectName = "test" + index.ToString();
ChartObjects.DrawText(objectName, test, index, MarketSeries.High[index], VerticalAlignment.Top, HorizontalAlignment.Center, Colors.White);
@atrader