Guide
How does the Moving Stop-Loss mechanism + alerts to MT4/MT5 strategy work ?
The Moving Stop-Loss mechanism strategy utilizes a dynamic approach by adjusting the stop-loss level each time a new pivot high or low is identified while a trade is active. The adjustment is accomplished by mutating the stoploss_long or stoploss_short variables upon detecting UpdateLongStopLoss or UpdateShortStopLoss events, respectively. This alteration must be encapsulated within the strategy.exit() function to execute correctly.
Entry signals are generated by Stochastic (Stoch) crossovers, where a long position is initiated if the Stoch crosses above the signal line and remains under 80 (overbought threshold), and a short position is taken if the Stoch crosses below the signal line and is over 20 (oversold threshold).
Moreover, the last portion of the script integrates commands to formulate updates and trigger alerts that are sent to MetaTrader through TradingConnector for application in Forex, indices, commodities, and crypto markets. Notably, with the recent update, single-position trades do not require a tradeid= parameter, thus simplifying the alert mechanism.