請教ALEX這樣的策略能寫嗎? [MC]
-
MC用戶求助:
?
-
MC回復討論一:
?
-
MC回復討論二:
問題1:是的,因為這是初始風險
問題2:是的,6筆
問題3:是的,浮動虧損10000就全部出場。計算在內的,只要虧損10000就離場,不贏不虧就不離場。
問題4:利潤寫錯了,應該是利潤達到150000就離場。
?
-
MC回復討論三:
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;
圖表策略屬性中屬性欄位中的部位限制,設置成最多允許6筆與目前倉位同向的進場,并且設置“無論委托是否由同一進場語句產生。
?
-
MC回復討論四:
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;
圖表策略屬性中屬性欄位中的部位限制,設置成最多允許6筆與目前倉位同向的進場,并且設置“無論委托是否由同一進場語句產生。
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容