請問如何圖表標記訊號名稱
假設MC我有一個訊號策略的進場語法如下A段
if X1<=100 thenSellShort 1 contracts next bar at Y2 limit else
buy 1 contracts next bar at Y2 limit;
B段
if x1>100 and X1<500 thenSellShort 1 contracts next bar at Y2 limit else
buy 1 contracts next bar at Y2 limit;
C段
if x1>=500and X1<1000 thenSellShort 1 contracts next bar at Y2 limit else
buy 1 contracts next bar at Y2 limit;
D段
if x1>=1000 thenSellShort 1 contracts next bar at Y2 limit else
buy 1 contracts next bar at Y2 limit;
上述ABCD4段,請問我要怎麼在圖表上顯示說,我今天進場做的單,是因為哪一段觸發才下單的(策略開發初期,所以要確定說訊號有沒有跑錯段)。
懇請大神協助,感謝~
好寫作架構,容易比較能找出邏輯上的失誤
所有的 else 混亂重疊在一起...
A段
if X1<=100 then
SellShort 1 contracts next bar at Y2 limit
else// 100 < X1
buy 1 contracts next bar at Y2 limit;
B段
if 100 < X1 and X1< 500 then
SellShort 1 contracts next bar at Y2 limit
else// X1 <= 100 or 500 <= X1
buy 1 contracts next bar at Y2 limit;
C段
if 500 <= X1 and X1<1000 then
SellShort 1 contracts next bar at Y2 limit
else// X1 < 500 or1000 <= X1
buy 1 contracts next bar at Y2 limit;
if x1>=1000 then
SellShort 1 contracts next bar at Y2 limit
else// X1 < 1000
buy 1 contracts next bar at Y2 limit;
如果不論4段於程式內的寫法安排,條件X1前後邏輯...等,只要幫它取個名字,因某條件觸發成交後,便會在圖上顯示出該條件對應名稱,例如:
A段
if X1<=100 thenSellShort ("SA") 1 contracts next bar at Y2 limit else
buy ("BA") 1 contracts next bar at Y2 limit;
B段
if x1>100 and X1<500 thenSellShort ("SB") 1 contracts next bar at Y2 limit else
buy ("BB") 1 contracts next bar at Y2 limit;
C段
if x1>=500and X1<1000 thenSellShort ("SC") 1 contracts next bar at Y2 limit else
buy ("BC") 1 contracts next bar at Y2 limit;
D段
if x1>=1000 thenSellShort("SD") 1 contracts next bar at Y2 limit else
buy ("BD") 1 contracts next bar at Y2 limit; DanielShih 發表於 18-12-25 21:53
如果不論4段於程式內的寫法安排,條件X1前後邏輯...等,只要幫它取個名字,因某條件觸發成交後,便會在圖上 ...
原來這麼簡單,感謝您的指點迷津,{:4_82:}
頁:
[1]