空頭持倉,在計算止損價時,怎么atr出現了負值? [開拓者 TB]
-
咨詢內容:
else If(MarketPosition == -1) ? ? ? ? ? ? ? //空頭時,從前高開始計算
函數 量化
?? ??? ?{
?? ??? ??? ?//If(my_exitprice == 0)
?? ??? ??? ?If(BarsSinceEntry == 0)
?? ??? ??? ?{
?? ??? ??? ??? ?//Return EntryPrice + Abs(ratio_atr * atr);? //加絕對值后,才恢復正常(ratio_atr為自然常數)
?? ??? ??? ??? ?Return EntryPrice + ratio_atr * atr;?//返回的值比開倉價還小!?旗艦版策略正常,tbq多頭正常,空頭幾乎都是開倉bar就被平倉
?? ??? ??? ??? ?//Return EntryPrice +100;
?? ??? ??? ??? ?
?? ??? ??? ?}
?? ??? ??? ?//Else If(my_exitprice <> 0)
?? ??? ??? ?Else If(BarsSinceEntry > 0)
?? ??? ??? ?{
?? ??? ??? ??? ?num = Min(my_exitprice,high[1] + ratio_atr * atr);
?? ??? ??? ??? ?//num = high[1] +50;
?? ??? ??? ??? ?Return num;
?? ??? ??? ?}?
?來源:CXH99.COM
-
TBQuant技術回復:
是系數問題,ratio_atr * atr改為數字2*atr,就正常了。?
有思路,想編寫各種指標公式,交易模型,選股公式,還原公式的朋友
可聯系技術人員 QQ: 262069696 或微信號:cxh99cxh99 進行 有償收費 編寫!
(注:由于人數限制,QQ或微信請選擇方便的一個聯系我們就行,加好友時請簡單備注下您的需求,否則無法通過。謝謝您!)
相關文章
-
沒有相關內容