Value1 = DirMovement(H,L,C,9,var4,var5,var6,var7,var8,var9);
If time = 0916 then begin If Close[1] > close[2] and close[2] > close[3]
and var4 > 30 then buy("TrB") next bar at Open;
If Close[1] < close[2] and close[2] < close[3]
and var5 > 30 then sellshort("TrS") next bar at Open;
end;
這語法很簡單,開盤後完成三根5分K時,若每根的收盤價都高於前一根,且DMI+>30買進
若每根的收盤價都低於前一根且DMI->30賣出,可是看下圖,前三根的收盤都低於前一根且DMI->30
但卻沒有跑出訊號,是不是語法哪裡寫錯了呢... (ps.但此數據某些情況下這個訊號還是會出現)
問題一
另一個問題也請大家看一下語法
If var4 cross under 30 and marketposition > 0 then begin
Lto = minlist(Low[1],Low[2],Low[3]);
If Low < Lto then sell("DMOS") next bar at open;
end;
If var5 cross under 30 and marketposition < 0 then begin
Hto = maxlist(High[1],High[2],High[3]);
If High > Hto then buytocover("DMOB") next bar at open;
If var4 cross over 30 and marketposition = 0 then buy("DMB") next bar at open;
If var5 cross over 30 and marketposition = 0 then sellshort("DMS") next bar at open;
Value1 = DirMovement(H,L,C,9,var4,var5,var6,var7,var8,var9);
If K=3 then begin
If Close[0] > close[1] and close[1] > close[2] and var4 > 30 then
buy("TrB") next bar at Open;
If Close[0] < close[1] and close[1] < close[2] and var5 > 30 then
sellshort("TrS") next bar at Open;