[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Add chart to backtester report?



PureBytes Links

Trading Reference Links

Hi Keith,

Thanks for the reply, but I think this code plots an equity curve on 
the chart window.  I want to create a chart in the backtest report.  
See below (I added some more text for clarification)

Is there any way to add an equity curve chart to the backtest report 
on the charts tab? (same tab as the profit distribution, Max. 
Adverse Excursion distribution, and Max. Adverse Excursion 
distribution)

This would be awesome because you could run an individual backtest 
on multiple symbols and then view the results of each test using the 
report explorer and see the equity curve for each test.

Best,
Steve




--- In amibroker@xxxxxxxxxxxxxxx, Keith McCombs <kmccombs@xxx> wrote:
>
> Steve --
> Copy and paste the code below at the end of your system.  
Next 'insert' 
> indicator to see a new chart (it will be either empty or look just 
like 
> the old chart.  Right click on the new chart and select 
> Parameters>Axis&Grid.  Note the new Chart ID at the bottom of the 
box.  
> Change 1405 in second line of code to your new Chart ID.
> 
> If you don't want your old 'plot' displayed in this new chart, get 
the 
> Chart ID for old chart and insert your old 'plot' statements in  
> if(GetChartID()== (old Chart ID)){ old plot statements }
> 
> The best part is that you don't even have to run a back test for 
this to 
> work.  However, be careful, it will use the "settings" and dates 
from 
> the most recent AA that you run.  You can overcome some of this 
with 
> SetOption(), SetTradeDelays(), and a few others.  (Gosh, I wish TJ 
would 
> come up with one-and-only-one way of setting *all* the AA settings 
from 
> within .afl code.)
> 
> // plot Equity
> if(GetChartID()==1405){
> //    GraphXSpace=5;
>     GraphZOrder=1;
>     Plot( Equity(2, -2), "Equity", colorRed, styleThick);
> 
>     shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
>     PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0 );
>     // now buy and hold simulation
>     Short=Cover=0;
> //    Buy=Status("firstbarintest");  // uncomment to display B&H 
from 
> beginning of time.
>     Sell=Status("lastbarintest");
>     ApplyStop(0,0,0,0);
>     ApplyStop(1,0,0,0);
>     ApplyStop(2,0,0,0);
>     SellPrice = Close;    // Correct SellPrice for buy and hold
>     Plot( Equity( 0, -2 ), "Buy&Hold", colorBlue, styleThick);
> }
> 
> sslack88 wrote:
> >
> > Is there any way to add an equity curve chart to the backtest 
report
> > on the charts tab?
> >
> > This would be awesome because you could run an individual 
backtest on
> > multiple symbols and then view the results of each test using the
> > report explorer.
> >
> > Best,
> > Steve
> >
> >
>