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

Re: [amibroker] Add chart to backtester report?



PureBytes Links

Trading Reference Links

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
>
>