تفضل المعادلة وما يعيب مؤشرك كثرة اشارات الدخول والخروج
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", colorblack ), stylenotitle | paramstyle("style") | getpricestyle() );
plot( open, "open", 0, stylehidden );
plot(close, "close", 0, stylehidden );
plot(high, "high", 0, stylehidden );
plot(low, "low", 0, stylehidden );
plot(ema(c,8),"",colorgreen,styledots);
plot(ema(c,13),"",colorblue,styledots);
plot(ema(c,21),"",colorblack,styledots);
plot(linearreg(c,8),"",coloryellow,styledots);
plot(ma(c,40),"",colorteal,styledots);
buy1=cross(ema(c,8),ema(c,13)) and cross(ema(c,8),ema(c,21));
buy2=cross(ema(c,8),ema(c,21));
buy3=linearreg(c,8)>ref(linearreg(c,8),-1) and linearreg(c,8)>ma(c,40);
buy=buy1 or buy2 or buy3;
sell1=cross(ema(c,13),ema(c,8)) and cross(ema(c,21),ema(c,8));
sell2=cross(ema(c,21),ema(c,8));
sell3=linearreg(c,8)<ref(linearreg(c,8),-1) and linearreg(c,8)<ma(c,40);
sell=sell1 or sell2 or sell3;
plotshapes(iif(buy,shapesmalluptriangle,shapenone),colorgreen,0,l,-22);
plotshapes(iif(sell,shapesmalldowntriangle, shapenone),colorred,0,h,-22);
_section_begin("exploration");
filter=close;
var = writeif(buy,"buy",writeif(sell,"sell",""));
addtextcolumn( var , "buy/sell", 1.2 , colorwhite, iif( buy, colorblue,iif(sell,colorred,colorwhite) ));
_section_end();
