曾永政 發表於 13-12-7 21:42
我以為單口策略在績效會往右上線性走的狀況下,把資金量引入下單口數計算的 Reinvestment 模式,績效曲線 ...
阿政大
紅色是我自己寫的獲利加碼不分
就是從2007/01/01(MC是要用1070101)開始...
只要賺FM....就改做FM/GG的整數口數...
可能這樣寫有錯誤吧....
但我自己摸只能摸出這樣了....呵呵
================================
Input:
N(xx),
NV(x),
N1(x),
RR(900),
GG(1500),
TL(1070101),
SP(xxx),
SL(xxx);
variables:
BN(0),
Kbar(0),
ST(xxxx),
ET(xxxx),
KK(1),
MP(0),
FM(0);
KK = maxlist(IntPortion(FM/GG),1);
//=============PreSet ================================
if date<>date[1] then Kbar = 1;
if date<>date[1] then BN = BarNumber;
if time>=ST then Kbar = BarNumber - BN + 1;
//=============PreSet ================================
//=============Value =================================
value1 = xxxxxxxxxxxxxxxxxxxxxxxxxxx
value4 = xxxxxxxxxxxxxxxxxxxxx
//=============Value =================================
//=============Condition =============================
condition1 = condition3 and xxxxxxxxxxxxxxxxxx
condition2 = condition3 and xxxxxxxxxxxxxxxxxxxx
condition3 = xxxxxxxxxxxxxxxxxxxxxxxxxx
if time>ST and time<ET then begin
if condition1 then begin
if date>TL then FM = FM + o - entryprice else FM=0;
buy KK share next bar at market;
end;
if condition2 then begin
if date>TL then FM = FM - o + entryprice else FM=0;
sellshort KK share next bar at market;
end;
end;
setstoploss(sl*200*KK);
setprofittarget(sp*200*KK);
|