The Autopsy Indicator

oxusmorouz

Well-Known Member
#1
I've been spamming around for a while now and realized I haven't posted anything useful in the last few months. So here it goes!

This is one for those who'd like to do post-mortem with their study and play around with it manually. It plots the important but basic trade statistics as an indicator, perfectly customizable, so that you can visually view how a change in parameter affects system equity, profit factor or drawdowns. Customizable commission, price array for buy as well as sell and delay in bars included. The lookbackbars is the only flaw to rectify me thinks. In this case, consider it as the no of bars "after" which the autopsy takes place.

Position size is "non compounding" in nature.

The image sort of looks like this:


P.S: Not recommended for you U-18 kids without parental monitoring. Criticisms/rectification of any of my errors are most welcome! I'm an amateur coder.
 
Last edited:

chintan786

Well-Known Member
#4
It does not plot arrows because we need to insert Buy and sell conditions...Bimbo and sunandoDa plz go through the code itself..

@oxy... this code is having look back function.. then wht is the point of using this ..... i already have such AFL by the name Pivot Finder..or super pivots etc...

Chintan
 

oxusmorouz

Well-Known Member
#7
It does not plot arrows because we need to insert Buy and sell conditions...Bimbo and sunandoDa plz go through the code itself..

@oxy... this code is having look back function.. then wht is the point of using this ..... i already have such AFL by the name Pivot Finder..or super pivots etc...

Chintan
Chintan,
The lookback function is not in it's real use here. I just included the name.

Consider it as, "The number of initial bars in the chart you would like to skip before the backtest starts". Suppose you have a total of 10,000 bars loaded but would like to do a backtest on only 6,000bars, the number to be entered is 4,000. It's no big deal really.
 

oxusmorouz

Well-Known Member
#8
Ajay
Its showing syntax errors .
Sunando
It does not Plot the chart with Buy sell Arrows .
You will have to modify the code to include your buy-sell code. This just plots the trade statistics that follow. Attaching an example of a MA Crossover system for reference.

Stats included:
FinalStatistics = IIf(StatNo == 1, FinalEquity,
IIf(StatNo == 2, BuyHoldEquity,
IIf(StatNo == 3, ValueDrawdown,
IIf(StatNo == 4, PercentDrawdown,
IIf(StatNo == 5, NoofWins,
IIf(StatNo == 6, NoofLosses ,
IIf(StatNo == 7, TotalTrades,
IIf(StatNo == 8, PercentWins,
IIf(StatNo == 9, AverageProfit,
IIf(StatNo == 10, AverageLoss ,
IIf(StatNo == 11, AvgProfitByLoss,
IIf(StatNo == 12, MFE,
IIf(StatNo == 13, MAE,
IIf(StatNo == 14, SystemEfficiency,0))))))))))))));
 
#9
I have simplified the code and tested the chart with moving average code. The Buy and Sell signals are very late. one should expect heavy loss only if we follow this system with out any filter mechanism. The code to plot the chart with Buy sell Arrows is as follows :

_SECTION_BEGIN("RSX Direction Backtest");
//Inputs//
FLength = Param("Length",20,0,200,1);
SLength = Param("SLength",40,0,200,1);

// Indicators //
FAvg = EMA(C,FLength);
SAvg = EMA(C,SLength);

// Output //
Buy = Cross(FAvg,SAvg);
Sell = Cross(SAvg,FAvg);
Plot( C, "Price", colorBlue, styleBar | styleThick );
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,colorGreen,colorRed),0,IIf(Buy,Low,High));
_SECTION_END();
 
Last edited:

Similar threads