Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
e-Ratio (Edge Ratio) Metric for Amibroker (AFL)
e-Ratio (Edge Ratio) metric for AmiBroker by Eldar Agalarov
e-Ratio is a metrics that measures the edge of a trading system component.
Similar Indicators / Formulas
Indicator / Formula
// e-Ratio implementation by Eldar Agalarov if (Status("action") == actionPortfolio) { bo = GetBacktesterObject(); bo.Backtest(True); stAll = bo.GetPerformanceStats(0); stLong = bo.GetPerformanceStats(1); stShort = bo.GetPerformanceStats(2); qtyProfitAll = stAll.GetValue("AllQty"); qtyProfitLong = stLong.GetValue("AllQty"); qtyProfitShort = stShort.GetValue("AllQty"); // e-Ratio avgMAEAll = avgMAELong = avgMAEShort = 0; avgMFEAll = avgMFELong = avgMFEShort = 0; barIndices = BarIndex(); dateTimes = DateTime(); for (trade = bo.GetFirstTrade(); !IsNull(trade); trade = bo.GetNextTrade()) { arrATR = Foreign("~ATR_" + trade.Symbol, "Close"); tradeBarIndex = LastValue(ValueWhen(trade.EntryDateTime == dateTimes, barIndices)); absMAE = trade.EntryPrice * trade.GetMAE() * 0.01; absMFE = trade.EntryPrice * trade.GetMFE() * 0.01; entryATR = arrATR[tradeBarIndex]; normMAE = absMAE / entryATR; normMFE = absMFE / entryATR; avgMAEAll += normMAE; avgMFEAll += normMFE; if (trade.IsLong()) { avgMAELong += normMAE; avgMFELong += normMFE; } else { avgMAEShort += normMAE; avgMFEShort += normMFE; } trade.AddCustomMetric("MAE ($)", absMAE, 2); trade.AddCustomMetric("MFE ($)", absMFE, 2); trade.AddCustomMetric("Entry ATR", entryATR, 2); } avgMAEAll /= qtyProfitAll; avgMAELong /= qtyProfitLong; avgMAEShort /= qtyProfitShort; avgMFEAll /= qtyProfitAll; avgMFELong /= qtyProfitLong; avgMFEShort /= qtyProfitShort; eRatioAll = avgMFEAll / abs(avgMAEAll); eRatioLong = avgMFELong / abs(avgMAELong); eRatioShort = avgMFEShort / abs(avgMAEShort); bo.AddCustomMetric("e-Ratio", eRatioAll, eRatioLong, eRatioShort, 2); bo.ListTrades(); }
6 comments
Leave Comment
Please login here to leave a comment.
Back
Links to referenced discussion with explanations:
http://www.automated-trading-system.com/e-ratio-amibroker-code/
http://www.automated-trading-system.com/e-ratio-trading-edge/
http://www.automated-trading-system.com/e-ratio-tradersstudio-excel/
Hi parfumeur,
Thanks for information.
Any DLL are required.
I do not see any buy sell signals & also eratio graphs.
Can you add the above things. If exploration is added, it would be great help
Thanks
Viswanth
My Ami V 5.5 , but there is nothing on screen.
Could you please give the picture and DLL ?
Regards,
Ayuraveda
@kv_maligi
There is no DLL required. This is AFL code. Just put the code to the new AFL file and in the AmiBroker Backtester Settings pick path to the current AFL file.
Next in the strategy code at the end put this code statement:
AddToComposite(avgTrueRange, “~ATR_” + Name(), “C”, atcFlagDeleteValues | atcFlagCompositeGroup | atcFlagEnableInBacktest);
This statement generates composite tickers with ATR data.
Was ist das?
A picture means 1000+ words!
No picture, no nothing!
No “Plot”, no nothing!
God damn it, can’t you read??
It’s a metric for the backtester. It uses the Custom backest interface.
Read the freaggin manual!
And here is additional info besides the manual
http://www.amibroker.org/userkb/2008/03/16/amibroker-custom-backtester-interface-2/