ohhiyo7788 發表於 21-3-5 21:27

語法請教

功力不足,寫出來的東西很怪,可以告訴我哪裡寫錯嗎?或怎麼寫會比較恰當?
像我的inputs:len(N),N用2、3、4、....20,交易總次數都是2197次,怪怪的....

想法:當收盤價來到N根內最高點時,下一根K棒市價進場,進場後3根內結束本次操作,進場時間09:00~13:00以及16:00~隔天04:00,設定時間強制平倉,賺20點停利、賠20點停利。

inputs:len(N);
vars:HH(0);

SetStopLoss(BigPointValue*20);   
SetProfitTarget(BigPointValue*20);
if barssinceentry=3 then begin
sell next bar at market;
buytocover next bar at market;
end;

if marketposition<>0 and time=1340 then begin
sell next bar at market;
buytocover next bar at market;
end;
if marketposition<>0 and time=0440 then begin
sell next bar at market;
buytocover next bar at market;
end;

HH=highest(high,len);

condition1=Close cross over HH;
condition2=time>=0900 and time<=1300;
condition3=time>=1600 or time<=0400;
condition4=marketposition<1;

if condition1 and condition2 and condition3 and condition4
then buy next bar at market;

頁: [1]
查看完整版本: 語法請教