本帖最後由 lantis 於 13-5-15 12:44 編輯
我寫了一個簡單 SMA (C, 3) 穿越 SMA (C, 200)的 strategy
結果回測有的會成功觸發, 有的卻不會, 怎麼回事啊?
我還加了箭頭標示, 結果 buy order OK
short sell marketorder 卻無效?
這是 2-point chart
move = minmove/pricescale;
mp = marketposition;
sma3 = averagefc(C, 3);
sma200 = averagefc(C, 200);
//long
if mp = 0 then begin
if sma3 cross over sma200
then begin
arw_id = arw_new_s(date, time_s, L - move, false); arw_setstyle(arw_id, 13);
arw_setcolor(arw_id, white);
text_new_s(date, time_s, L - 3 * move, numtostr(arw_id, 0));
buy next bar at market;
end;
end;
//short
if mp = 0 then begin
if sma3 cross under sma200
then begin
arw_id = arw_new_s(date, time_s, H + move, true);
arw_setstyle(arw_id, 13);
arw_setcolor(arw_id, white);
text_new_s(date, time_s, H + 3 * move, numtostr(arw_id, 0));
sell next bar at market;
end;
end;
|