Wunderbit

MACD Strategy with trailing ATR stop

This is a trend based strategy that uses EMA and SMA intersection for determining the direction of the trend and MACD for the entry signal. At the same time, the strategy uses ATR, which is working as a trailing stop.

The strategy entry will work when the Trend ribbon will turn green and MACD line will crossover the signal line. This strategy also takes into account the pyramiding and allows to enter the second time if the signal will repeat itself.

There are 3 exit points. The first 10% of the position will be closed when the price will increase by 1%. The second portion of 50% will be closed when the price reaches 5% Take profit target. The remaining 40 % of the position will wait for the exit signal which will occur when the price closes below the ATR line.

The strategy is using a fixed amount in dollars, each time the entry occurs the strategy will enter with 100$ in the order.

The strategy can be applied to other crypto assets. However, they will require input changes.

Best of luck with your trading.
發布通知: * Small code update for the script to work without errors.
開源腳本

秉持真正的TradingView精神,該腳本的作者將其開源發佈,因此交易者可以理解和驗證它。為作者加油!您可以免費使用它,但是在發佈中重複使用此程式碼受網站規則的約束。您可以把它加入到常用以在圖表上使用它。

想在圖表上使用此腳本?

評論

this repainting ?
+6 回覆
@KUNEF3, No, the strategy does not use any functions that repaint or multiple timeframes.
+4 回覆
@Wunderbit , When I try the strategy and create an alert I see the below messgae
MACD Strategy (39, 7, 23, close, 10, 15, 12, 80, 1, 20, 1.3, 2, 40, 2018, 1, 1, 2020, 12, 31): order {{strategy.order.action}} @ {{strategy.order.contracts}} filled on {{ticker}}. New strategy position is {{strategy.position_size}}

how is the value {{strategy.order.contracts}} calculated in the above code. Can we control the number of contracts ?
Also where is the action strategy determined {{strategy.order.action}. Please help
+4 回覆
The tutorial and the script do not match. How to I hook the alerts with the BOT?
Thanks.
+3 回覆
How can I do if I want to close 100% on the first Take Profit? is it possible? Try to delete the TP2 or ATR, but it does not work the whole strategy is deleted.
+3 回覆
It does not work now ,no signal
+1 回覆
trail_points=entry_price_long * long_trailing / syminfo.mintick

How do you define long_trailing ?
回覆
it would be very cool if it was possible to short ! Thank you for the great script kind strager
回覆
What happends with The strategy Wunderbit with ATR? something is wrong in the Script

I can't edit the alerts because it says the code has an error, but it has always worked perfectly.
It is very rare
And when I correct the error the SL with ATR doesn't work anymore.
回覆