程式交易碼 編譯錯誤求救

不懂為何這個程式碼會出錯請大家教教我



var:Exitprice(N)

while marketposition=0 and Exitprice(1)+20 then
buy this bar;
if marketposition=0 and Exitprice(1)-20 then
sellshort this bar;
end;
2016-07-22 11:06 發佈
while if 還有 條件 出錯

151515151515151515

bestronger33 wrote:
不懂為何這個程式碼...(恕刪)


我也不懂,不確定這是什麼語言, 一般的語法:請檢查看看

marketposition=0 還是 marketposition==0.

Exitpeice(1)+20. 還是 (Exitprice(1)+20)<=0. 還是 (Exitprice(1)+20)>=0
Exitprice(1)-20 也是一樣

通常 marketposition=0. 結果是NUMBER 類別, 值是0
marketposition == 0, 才是 BOOLEAN 類別, 結果是 TRUE/FALSE

Exitprice(1)+20 結果也是數字, 加了 >=0 比較才會轉成Boolean

參考看看,不熟,隨便猜
var:Exitprice(N)

while marketposition=0 and Exitprice(1)+20 then
buy this bar on close;
if marketposition=0 and Exitprice(1)-20 then
sellshort this bar on close;
end;

-------------------------------------------------------------------------------
加上on close 就不會出現反覆的問題了
一般程式交易都是用 next bar

或是用限價突破 buy stop 或是 sellshort stop


-----------------大約是這樣 multichart 不是粉會用 但程式邏輯一般如此
應該是 HTS

151515151515151515151515

股海神經 wrote:
我也不懂,不確定這...(恕刪)
HTS 的語法

var:Exitprice(N)

If
MarketPosition = 0
AND Exitprice(1)+20
Then
Buy This Bar Market;
End If

If
MarketPosition = 0
AND Exitprice(1)-20
Then
Sell This Bar Market;
End If





使用 THIS BAR 要非常非常小心
記得要勾選
喔對不起忘了說我這是要寫MC的語言程式
剛剛測試了上面幾位大大的意見
還是不太行 不知怎麼了

bestronger33 wrote:
喔對不起忘了說我這...(恕刪)



我不太懂MC等等的程式語言,不過這問題應該可以去某論壇的程式交易討論區問,
那裡有實際在操作程式交易的人蠻多的。論壇網址已私訊給樓主了。
內文搜尋
X
評分
評分
複製連結
Mobile01提醒您
您目前瀏覽的是行動版網頁
是否切換到電腦版網頁呢?