|
zaqimon 發表於 14-4-20 08:05
大概這樣寫吧
不過我沒測試過
你自己試試看
zaqimon,
this code will do the same as your code but is shorter and faster and without loop. ;-)
bars = 3;
dn = Datenum();
newday= dn != Ref( dn, -1 );
brssince = BarsSince( newday ) == bars-1;
sumdn = Sum( dn == Ref( dn, -1 ), bars-1 ) == bars -1;
Buy = ValueWhen( brssince, Sum( C > O, bars ) ) == bars AND sumdn;
Short = ValueWhen( brssince, Sum( C < O, bars ) ) == bars AND sumdn;
PlotShapes( Buy*shapeUpArrow, colorpalegreen, 0, L, -45 );
PlotShapes( Short*shapedownArrow, colorOrange, 0, H, -45 );
|
|