|
各位好 小弟有些問題想請教..
如果我的進場策略是用kd交叉來做判斷,例如:死亡交叉後,紀錄當根k棒高點,接下來有k棒close突破高點則做多..
問題來了,不管這筆交易是獲利或停損,系統又會馬上以上一筆交叉為基礎去判斷而進場,但我希望能讓系統等到下一次交叉出現在去做判斷...
不知這種控制語法該怎麼寫比較好...
思考很久沒頭緒..
value8=D值
value7=K值
謝謝
If value8 crosses above value7 then
value12=low;
If value8 crosses below value7 then
value13=high;
if DailyLosers(date)<=2 then begin
If marketposition=0 and close<value12 and value11<value11[1] then begin
sellshort 1 share this bar on close;
end;
If marketposition=0 and close>value13 and value11>value1[1] then begin
buy 1 share this bar on close;
end;
end;
If marketposition>0 and lowest(low,10)>entryprice then begin
sell 1 share next bar lowest(low,5) stop;
end;
If marketposition<0 and highest(high,10)<entryprice then begin
buytocover 1 share next bar highest(high,5) stop;
end;
If marketposition>0 and entryprice-close>=20 then begin
sell 1 share this bar on close;
end;
If marketposition<0 and close-entryprice>=20 then begin
buytocover 1 share this bar on close;
end;
If time=1344 then begin
sell all share this bar on close;
buytocover all share this bar on close;
end; |
|