[英]Stuck with Trading View strategy
我是 pine 腳本的新手,我需要幫助我嘗試創建但沒有成功的策略。 規則如下:
入場 - RSI(2) < 50
退出 - OpenCandlePrice > EMA(3) 或 CloseCandlePrice >= EMA(3)
蠟燭收盤時不會出現進場,蠟燭開盤或收盤時也不會出現退出。 有人可以幫我弄清楚我做錯了什么嗎? 當我使用“process_orders_on_close”時,條目在蠟燭關閉時正確出現,但出口仍然錯誤。
//@version=4
strategy("IFR2", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
//RSI
vrsi = rsi(close, 2)
//Moving Averages
shortema = ema(close,3)
//Strategy
`if (strategy.position_size == 0)`
`if (vrsi<50)`
`strategy.entry(id="EL", long=true, stop=close, comment="Open")`
`else if (strategy.position_size > 0)`
`if (open>shortema)`
`strategy.exit(id="ES", stop=open, comment="Close")`
`if (close>=shortema)`
`strategy.exit(id="ES", stop=close, comment="Close")`
嘗試在策略 function 的第一行中使用process_orders_on_close=true
。 您可以參考此鏈接 策略所需的幫助- 入場點差 2 根蠟燭。 即使問題沒有解決,那么可能的解決方案是在研究中制定完全相同的策略。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.