Posted By: Brax
Optimizing equity curve trading - 08/21/17 17:14
Hi,
I am trying to optimize the lowpass filter in equity curve trading for a basket of assets. It seems the optimization is not being performed, surely there is some kind of issue with Balance or ProfitClosed behaviour. This is my code:
ŋThe behaviour of equity curve trading is for the global equity produced from all the assets or itīs applied on every asset equity?
If globally, ŋCould i store the different asset equities and apply it separately with a function that receives that equity?.
Thanks.
I am trying to optimize the lowpass filter in equity curve trading for a basket of assets. It seems the optimization is not being performed, surely there is some kind of issue with Balance or ProfitClosed behaviour. This is my code:
Code:
static var opt_Filtered; static var opt_Signal; static var opt_Threshold; static var opt_Stop_Cntr; static int opt_EquityAvg; var equityCurveSizing() { if(Train) { return 1; } // no phantom trades in training mode vars EquityCurve = series(BalanceLong+BalanceShort); // vars EquityLP = series(LowPass(EquityCurve,10)); vars EquityLP = EquityCurve; if(EquityLP[0] < LowPass(EquityLP,opt_EquityAvg))// && falling(EquityLP)) return -1; // drawdown -> phantom trading else return 1; // profitable -> normal trading } function tradeCounterTrend() { vars Price = series(priceClose()); vars Filtered = series(BandPass(Price,opt_Filtered,0.5)); vars Signal = series(Fisher(Filtered,opt_Signal)); var Threshold = opt_Threshold; Stop = opt_Stop_Cntr * ATR(10); Trail = 4*ATR(10); if(crossUnder(Signal,-Threshold)) enterLong(); else if(crossOver(Signal,Threshold)) enterShort(); } function run() { set(LOGFILE+PARAMETERS); NumCores = -2; BarPeriod = 24*60; LookBack = 500; StartDate = 2005; EndDate = 2015; Capital = 10000; if(ReTrain) { UpdateDays = -1; SelectWFO = -1; reset(FACTORS); } while(asset(loop("EUR/USD","USD/JPY","GBP/USD","USD/CHF"))){ // Parameters opt_Filtered = optimize(30,20,40,1); opt_Signal = optimize(10,5,20,1); opt_Threshold = optimize(1,0.5,1.5,0.1); opt_Stop_Cntr = optimize(4,2,10,1); opt_EquityAvg = optimize(100,5,200,5); Lots = 5; Lots = equityCurveSizing() * Lots; tradeCounterTrend(); } PlotWidth = 1024; PlotHeight1 = 400; }
ŋThe behaviour of equity curve trading is for the global equity produced from all the assets or itīs applied on every asset equity?
If globally, ŋCould i store the different asset equities and apply it separately with a function that receives that equity?.
Thanks.