Hi,
In order to get the Draw Down chart in the report after doing a backtest, I have changed the original code from the Report Chart folder, but I would like to get the value in the chart with the comma as a separator of thousands values.
I know that with this line of code I get it,
Title = StrFormat("Drawdown = %.2f, Max. drawdown %.2f", DD, LastValue( MaxDD ) );
but for expample, If the number is 12535,25, I would like to get 12,535.25
Tomasz
March 22, 2019, 12:47am
2
Use NumToStr, it would add desired thousand separator for you
http://www.amibroker.com/f?numtostr
1 Like
Thank you very much @Tomasz !!!
Just to share how the final code would look like.
// Underwater Equity chart
// (C)2009 AmiBroker.com
// Should be used only on ~~~EQUITY or ~~~OSEQUITY symbol
// Changing numbers format with comma separator of thousands values
EQ = C;
MaxEQ = Highest( EQ );
DD = ( Eq - MaxEQ );
MaxDD = Lowest( DD );
Title = "Drawdown = " + NumToStr(DD, 1.2, True) + "Max. drawdown = " + NumToStr(LastValue( MaxDD ), 1.2, True) ;
SetGradientFill( GetChartBkColor(), colorBlue, 0 );
Plot( DD, "Drawdown ", colorBlue, styleGradient | styleLine );
Plot( MaxDD, "Max DD", colorRed, styleNoLabel );
SetChartOptions( 2, 0, chartGridMiddle );
if( Name() != "~~~EQUITY" AND Name() != "~~~OSEQUITY" ) Title = "Warning: wrong ticker! This chart should be used on ~~~EQUITY or ~~~OSEQUITY only";