Var:mom,media,periodo(50),MioTRADINGWEEK_M10,MioMACD0,
ValTakeRitracc(5),
ValStop(20);
MioTRADINGWEEK_M10 = TRADINGWEEK_M1(C, 6, 1, 5, 6, 5, 2);
MioMACD0 = MACD(C, 12, 26);
mom=momentum(C,periodo,D);
media=mov(c,periodo,e);
InstallTrailingProfit(INTICK, 30, ValTakeRitracc,"stop1",checkmax+exitonlyifcloseon);
InstallStopLoss(INTICK, ValStop);
if positiondir=0 and V>V[1] then
if MioMACD0>0 and mom>0 and c>MioTRADINGWEEK_M10 then
entershort(nextbar,atopen);
endif;
if MioMACD0<0 and mom<0 and c<MioTRADINGWEEK_M10 then
enterlong(nextbar,atopen);
endif;
endif;
if positionshort and MioMACD0<0 or mom<0 then
exitshort(nextbar,atopen);
endif;
if positionlong and MioMACD0>0 or mom>0 then
exitlong(nextbar,atopen);
endif;