المشاركة الأصلية كتبت بواسطة the lord ksa
اشارة البيع والشراء مع البحث المعادلة
_section_begin("price");
setchartoptions(0,chartshowarrows|chartshowdates);
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 );
_section_end();
_section_begin("zzt");
para = paramtoggle("plot zz0","off,on");
cbar = param("cbar",4,2,50,1);
per = param("per",5,1,30,1);
zz0 = zig(c,per);
zz1 = ref( zz0, -1 );
zz2 = ref( zz0, -2 );
tr = valuewhen(zz0 > zz1 and zz1 < zz2, zz1);
pk = valuewhen(zz0 < zz1 and zz1 > zz2, zz1);
pu = tr + 0.01 * abs(tr)*per;
pd = pk - 0.01 * abs(pk)*per;
zzt = iif(c>= pu and zz0 > zz1, 1,
iif(c<= pd and zz0 < zz1, -1, 0 ) );
zzt= valuewhen( zzt != 0, zzt );
colorp2= iif((c>o)or(c<o),colorwhite,coloryellow);
plot(iif(para,zz0,null)," ",colorwhite,styleline);
pr=peakbars(c,5)==0;
ps =troughbars(c,5)==0;
plot(pr,"",colorred,stylearea|styleownscale);
plot(ps,"",colorgreen,stylearea|stylehistogram|styleownscale);
rf=valuewhen(pr,c);
sf=valuewhen(ps,c);
rf1 = iif(rf and barssince(pr) <=cbar,rf,null);
sf1 = iif(sf and barssince(ps ) <=cbar,sf,null);
plot(rf1,"",colorwhite,styledots | stylenoline);
plot(sf1,"",colorwhite,styledots | stylenoline);
plot(rf,"",colorblack,40+16);
plot(sf,"",colorblack,40+16);
plotshapes(iif(pr, shapesmallsquare,shapenone),coloryellow,0,c,10);
plotshapes(shapesmallcircle*pr,colorblack,0,c,10);
plotshapes(iif(ps, shapesmallsquare,shapenone),coloryellow,0,c,-10);
plotshapes(shapesmallcircle*ps,colorblack,0,c,-10);
numbars = selectedvalue(cum(status("barvisible")));
fraction= iif(strright(name(),3) == "",3.2,3.2);
hts = param ("text shift", -50,-100,100,10);
plottext(">>>" + writeval(c,fraction),
selectedvalue(barindex())-(numbars/hts),selectedvalue(c),2);
plottext("" + writeval(rf,fraction),
selectedvalue(barindex()+2)-(numbars/hts),selectedvalue(rf),colorcustom12);
plottext("" + writeval(sf,fraction),
selectedvalue(barindex()+2)-(numbars/hts),selectedvalue(sf),5);
_section_end();
buy=cross(zzt,0);
sell=cross(0,zzt);
plotshapes(iif(buy,shapesmalluptriangle,shapenone),coloryellow,0,l,-15);
plotshapes(iif(sell,shapesmalldowntriangle, shapenone),coloryellow,0,h,-15);
_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();