tso_trade

MACD with Support and Resistance - Signals, Alerts, TP and SL

tso_trade Updated   
MACD with Support and Resistance - Signals Alerts SL and TP by Tech Store On

The script uses MACD for entering/exiting trades and support/resistance lines to take TP1 (take profit 1). Both MACD and support/resistance lines are fully configurable to your preference, and you can back-test it via TradingView. Once TP1 is taken, you can either set the indicator to close the trade at the end of the US trading session day (4PM ET) or you can continue taking partial profits where you wish or just wait until reversal signal alert.
For example: If you will be day trading SPY and you wish to close your positions no matter what right before the market closes (3:45PM ET > 15min before closes): Make sure to checkbox “Intraday – Close Position Before Market Closes” in the strategy/indicator Settings, so that you are alerted soon before the market closes, if you wish to continue holding the position – leave this checkbox unchecked.

SL: SL is set to be slightly above/below the MACD signal candle, which is best suited for this strategy from manual backtesting.

Strategy Take Profit Approach
While the initial position open and SL hit is always based on a closed candle bar (can’t do otherwise, as otherwise you will have 10s of fake signal alerts), there are 2 ways on trading this strategy in terms of TP1 / TP1 taken > back to Entry, which is based off Alert type.
You can switch this as you like within the indicator settings, “Checked: TP1/TP1 taken > back to Entry per Price Touch | Unchecked: per Candle Close”.
Candle Close vs Price Touch: with the Default method - Candle Close for an alert for TP1 or if price comes back to Entry after TP1 is taken will only be triggered once candle bar fully closes crossing the area, while Price Touch will alert when price touches the area before candle bar closes.
For example: your trade is running well, you grab TP1 and the price reverses and hits your trade Entry area. With Price Touch – you are immediately alerted to close your trade with no loss and with TP1 profit. With Candle Close - you will receive an alert only once candle bar fully closes on top of the Entry crossing it backwards, meaning it may lower your TP1 profit or even completely reverse the trade into loss in case it will be a huge candle bar for any reason. However, it may touch the Entry area, looking like the price is reversing, but then continue per initial trade direction, sometimes becoming a trend. So, while Price Touch seem like a more conservative approach, Candle Close can give you much bigger profits if you catch a trend, but you can always change it via the Settings.
Note: TradingView back-testing engine does not have a feature to open/close orders IMMEDIATELY via Price Touch trigger, but only when the candle closes after price touches the scripted area/line/etc., so you for the most accurate results, test your strategy out via Candle Close setting. Otherwise, decide yourself. I personally like more Candle Close since I can test it out via back-testing with the most accurate results.
Note: If you will be observing the strategy LIVE, during LIVE candle bar movement – it will look weird, like it’s placing an order after order during any trigger – this seem like a TradingView bug, but is only observational, once the candle bar is closed and you refresh TradingView it will all look correct.

Back-Testing
If you wish to do some back-testing, just modify the strategy/indicator Settings:
-----1) STRATEGY: This is for back-testing/experimenting with the script inputs.
----------a. You can setup a start date (date, month, year) from which it will start opening back-test trades, select a position size and select TP1 size, the idea here is to close half (or whatever you choose) portion of the trade once you hit your TP1, then to either close at small profit or to catch a trend and close the second portion of the position long way ahead from Entry, otherwise it will alert you to close the position if price comes back to Entry, at reversal signal or at the end of US trading session if the option for it is checked. If you wish to close the whole position at TP1, just enter the same amount for TP1 to match backtest position size. Otherwise you can experiment with TP1 sizing – try it out!
-----2) Feel free to experiment with MACD settings and with S&R Left/Right bars, you may be amazed how results will differ and find some really cool combinations!
-----3) Make sure you select/de-select “Intraday – Close Position Before Market Closes” setting depending on what you are back-testing and on which conditions
-----4) Note: If you wish to do some deep back-testing (1+ years), use the “Deep Backtesting” feature within Strategy Tester on the TradingView as otherwise it may show wrong results or even fail to compute the results

Add the alerts
-----Right-click anywhere on the TradingView chart
-----Click on Add alert
-----Condition: MACD with Support and Resistance - Signals
----------o Right underneath the condition click on the drop-down menu and select “alert() function calls only”
-----Expiration time: Whatever you wish
-----Alert actions: Whatever notifications you wish
-----Alert name: DO NOT TOUCH THIS
-----Hit “Create”
-----Note: If you change ANY Settings within the indicator – you must DELETE the current alert and create a new one per steps above, otherwise it will continue triggering alerts per old Settings!
- Note: If you add the alert while the script is currently “In Position” it will not know that. So either wait when there will be no position open at all or close your position partially if the bot opens it twice bigger or so in case per script the bot will think it is already in position.

Note: Because of the slippage and the order processing time between TradingView, AutoView and the Broker (it’s usually about a second or so), it is suggested to not use a timeframe lower than 1min. The script is working really well with 15M/H1 timeframes per my back-testing, but feel free to explore via Strategy Back-testing what’s best for the instrument you wish to trade.
Release Notes:
* Fixed alerts to be triggered per "Checked: TP1 taken > back to Entry per Price Touch | Unchecked: per Candle Close" selection, if checked: alerts for TP1 and TP1 > Back to Entry will be triggered per Once Per Bar option (once price will touch the TP1 level or after TP1 price will touch Entry)
Release Notes:
* Minor fix check

Trading like a machine!
Invite-only script

Access to this script is restricted to users authorized by the author and usually requires payment. You can add it to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author. Contact tso_trade for more information, or follow the author's instructions below.

TradingView does not suggest paying for a script and using it unless you 100% trust its author and understand how the script works. In many cases you can find a good open-source alternative for free in our Community Scripts.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Author's instructions

Feel free to reach out if you wish to try this indicator out for free for a week or so.

Want to use this script on a chart?

Warning: please read before requesting access.