Type/to search

Dynamic Stop Loss Alert TradingView Strategy

Cryptocurrency
Created: 2023-09-18 17:20:06
Last modified: 3 years ago
1
Follow
1781
Followers

Overview

This strategy demonstrates passing dynamic stop loss prices via TradingView alerts for execution in MT4/5 platforms using TradingConnector. Entries are determined using Stochastic indicator with dynamic stops set at recent pivots. Partial profit taking is also possible.

Strategy Logic

Long and short entries on Stochastic K and D line crosses. Recent pivot highs/lows are calculated as dynamic stop loss prices. These are passed real-time to the broker via alerts on entry. Partial profits are taken at certain percentage of stop loss distance. Profit prices can also be dynamically alerted.

Advantages

  • Dynamic stops allow surgical stop loss placement
  • Partial profit taking improves capital efficiency
  • Real-time passing of stop loss price to broker account
  • Backtested stop loss mimics live, realistic simulation

Risks

  • Lag exists in Stochastic indicator
  • Frequent partial profit taking disturbs holding
  • Dynamic variables behave differently across timeframes
  • Partial profit percentage needs optimization

Risks can be managed by tuning Stochastic parameters, adjusting partial profit ratio etc.

Enhancements

  • Test different Stochastic parameter combinations
  • Optimize partial profit take ratio
  • Explore other stop loss approaches like trailing stop
  • Test robustness across markets and products

Conclusion

This strategy demonstrates executing dynamic stop loss trades from TradingView to MT4/5 using new features. It can serve as a framework for further backtesting. Optimization is required for specific assets.

Source
Pine
/*backtest
start: 2023-08-18 00:00:00
end: 2023-09-17 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
// strategy(title="TradingView Alerts to MT4 MT5 Strategy example", commission_type=strategy.commission.cash_per_order, commission_value=0.00003, overlay=false, default_qty_value=100000, initial_capital=1000)
// study(title="TradingView Alerts to MT4 MT5 Strategy example")  //uncomment this line and comment previous one to make it a study producing alerts
//
Strategy parameters
Strategy parameters
TakeProfitLevel
TakePartialProfitLevel
K
D
Smooth
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)