討論區列表
MultiCharts
一般模式
討論串模式
標題:
[發問] [旗標設定] 停損後到結算不做單
by 2020-04-07 23:18:43
0
暱稱:
BigAllen
信箱:不顯示
成就:發文(0) / 回文(0) / 推薦(0)
請教大家,策略要停損後到結算不做單,我設了一個LLose_
Flag的旗標判斷是否停損,但結果不如預期:
1. 如圖, 1060608印出兩筆,第一筆和第二筆 的 LLose_Flag為何不一樣? 搞不懂? 也造成6/8停損當天還是買進。
程式該如何改才能讓尾盤買單不進場?
1060607.00, currentposition= 1.00,LLose_Flag= 0.00
1060608.00, currentposition= 0.00,LLose_Flag= 0.00
1060608.00,currentposition= 0.00,currentposition[1]= 1.00,LLose_Flag= 1.00,LLose_Flag[1]= 0.00
1060609.00, currentposition= 1.00,LLose_Flag= 1.00
1060612.00, currentposition= 1.00,LLose_Flag= 1.00
2. 如圖,似乎是同樣的原因,4/19結算後4/20的 LLose_Flag又變成"1" , 造成 4/24該要進場卻沒進場。
1060418.00, currentposition= 1.00,LLose_Flag= 0.00
1060419.00, currentposition= 1.00,LLose_Flag= 0.00
1060420.00, currentposition= 0.00,LLose_Flag= 0.00
1060420.00,currentposition= 0.00,currentposition[1]= 1.00,LLose_Flag= 1.00,LLose_Flag[1]= 0.00
1060421.00, currentposition= 0.00,LLose_Flag= 1.00
1060424.00, currentposition= 0.00,LLose_Flag= 1.00
1060425.00, currentposition= 0.00,LLose_Flag= 1.00
=== 程式 ====
====
====
//DayK
vars:LLose_Flag(0), currentposition(0);
value1=close-close of data2;
currentposition=
marketposition;
print(date,", currentposition=",
currentposition,",LLose_Flag="
,LLose_Flag);
if _Settlement=false and LLose_Flag=0 Then begin
if value1 < 0 and MP<=0 Then begin
buy this bar on close;
end;
end;
if _Settlement then begin
setexitonclose;
LLose_Flag=0;
end;
if marketposition>0 then begin
sell ("LLose") next bar entryprice(0)-500 stop;
end;
If currentposition[1]>0 and currentposition=0 then begin
LLose_Flag=1;
print(Date,",currentposition="
,currentposition,",
currentposition[1]=",
currentposition[1],",LLose_
Flag=",LLose_Flag,",LLose_
Flag[1]=",LLose_Flag[1]);
end;
===========
====
====
第一頁
上一頁
下一頁
最後頁
討論區列表
MultiCharts
MultiCharts
│
討論區
│
會員專區
│
教學講座
│
支援與服務
│
產品購買
│
申請試用
All rights for MultiCharts Trading Software are reserved by MultiCharts, LLC
凱衛資訊股份有限公司 營利事業統一編號(21261212) 著作權所有 本網站最佳瀏覽解析度為 1024 x 768
隱私權政策
│
網站安全政策
│
著作權說明
若不清楚點選圖片更新驗證碼
註冊帳號
忘記密碼
解除鎖定