anyone have AFL which can find best moving avg crossover combination for each symbol and display returns at along with it?

pannet1

Well-Known Member
#2
anyone have AFL which can find best moving avg crossover combination for each symbol and display returns at along with it?
i have a tool that can allow you to change the moving averages with slider on the browser. it can show the payoff immediately upon completing the slide.
 
#3
anyone have AFL which can find best moving avg crossover combination for each symbol and display returns at along with it?
I think i had written something like that but have discarded most of that old stuff . . .
Will search on TJ, if it was posted here . . . else you will find may simple MA crossover AFLS

use them and run one ticker at a time, anyway its lock down,
it's better than rewashing the washed clothes in the house :)


EDIT: This not only optimizes the period but also the type of MA,
of course it's useless for trading, :down:

can't define curve fitting in better terms than this code :DD

Link: https://www.traderji.com/community/threads/simple-coding-help-no-promise.90119/page-5#post-874217

Post

MA Xross on a Single Time Frame

Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("MA_CROSS");
p = Optimize("PERIOD 1",Param("PERIOD 1",10,2,30,1),2,20,2);
q = Optimize("PERIOD 2",Param("PERIOD 2",90,10,200,10),10,100,10);
y = Optimize("MAType 1",Param("MAType 1",2,1,8,1),1,8,1);
z = Optimize("MAType 2",Param("MAType 2",2,1,8,1),1,8,1);

m=0;    if (y==1) m    =    MA(C,p); 
else    if (y==2) m    =    EMA(C,p); 
else    if (y==3) m    =    DEMA(C,p); 
else    if (y==4) m    =    TEMA(C,p); 
else    if (y==5) m    =    WMA(C,p); 
else    if (y==6) m    =    HMA(C,p); 
else    if (y==7) m    =    Wilders(C,p); 
else    if (y==8) m    =    LinearReg(C,p);

n=0;    if (z==1) n    =    MA(C,q); 
else    if (z==2) n    =    EMA(C,q); 
else    if (z==3) n    =    DEMA(C,q); 
else    if (z==4) n    =    TEMA(C,q); 
else    if (z==5) n    =    WMA(C,q); 
else    if (z==6) n    =    HMA(C,q); 
else    if (z==7) n    =    Wilders(C,q); 
else    if (z==8) n    =    LinearReg(C,q);
Plot(m," MA",IIf(m < Ref(m,-1),colorBlue,colorRed),styleThick);
Plot(n," MA",IIf(n < Ref(n,-1),colorBlue,colorRed),styleThick);

Buy  = CROSS(m,n);
Sell = cross(n,m);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = Sell; Cover = Buy;
PlotShapes(Buy+2*Sell,colorWhite,0,IIf(Buy,L,H));
SetPositionSize(1,4);
_SECTION_END();
 
Last edited: