?
?
問題1:是的,因為這是初始風(fēng)險
問題2:是的,6筆
問題3:是的,浮動虧損10000就全部出場。計算在內(nèi)的,只要虧損10000就離場,不贏不虧就不離場。
問題4:利潤寫錯了,應(yīng)該是利潤達到150000就離場。
?
input: in_loss(10000), num(5), lot(1);
var: flag(0), prof(0);
once (true) begin?
? ? ? ? for value2=1 to num+1 begin
? ? ? ? ? ? ? ? prof=prof+value2;
? ? ? ? end;
? ? ? ? prof=prof*10000;
end;
setstopposition;
setprofittarget(prof);
setstoploss(in_loss);
{condition1和condition2分別賦值為多頭進場和空頭進場的條件,需要您加一下}
if marketposition=0 and condition1 then
? ? ? ? buy("b_kaicang") lot shares next bar at market;
if marketposition=0 and condition2 then
? ? ? ? sellshort("s_kaicang") lot shares next bar at market;
flag=postradecount(0)-1;
value1=openentryprofit(flag);
if marketposition=1 and value1>=10000 then
? ? ? ? buy("b_jiacang") lot shares next bar at market;
if marketposition=-1 and value1>=10000 then
? ? ? ? sellshort("s_jiacang") lot shares next bar at market;
圖表策略屬性中屬性欄位中的部位限制,設(shè)置成最多允許6筆與目前倉位同向的進場,并且設(shè)置“無論委托是否由同一進場語句產(chǎn)生。
?
input: in_loss(10000), num(5), lot(1);
var: flag(0), prof(0);
once (true) begin?
? ? ? ? for value2=1 to num+1 begin
? ? ? ? ? ? ? ? prof=prof+value2;
? ? ? ? end;
? ? ? ? prof=prof*10000;
end;
setstopposition;
setprofittarget(prof);
setstoploss(in_loss);
{condition1和condition2分別賦值為多頭進場和空頭進場的條件,需要您加一下}
if marketposition=0 and condition1 then
? ? ? ? buy("b_kaicang") lot shares next bar at market;
if marketposition=0 and condition2 then
? ? ? ? sellshort("s_kaicang") lot shares next bar at market;
flag=postradecount(0)-1;
value1=openentryprofit(flag);
if marketposition=1 and value1>=10000 then
? ? ? ? buy("b_jiacang") lot shares next bar at market;
if marketposition=-1 and value1>=10000 then
? ? ? ? sellshort("s_jiacang") lot shares next bar at market;
圖表策略屬性中屬性欄位中的部位限制,設(shè)置成最多允許6筆與目前倉位同向的進場,并且設(shè)置“無論委托是否由同一進場語句產(chǎn)生。