Job finished
Specification
Please provide me with a fully coded Expert Advisor (EA) that will execute automated trading on MT5, utilizing Deriv as broker and for the Volatility 75 index. Name of the EA should be Volatility Bot.
Please watch the video in this link which provides the basic strategy to be followed. Please note that this document takes preference over the video content as minor changes are proposed to that in the video in order to achieve a better strategy. However, the video should be able to explain the core strategy for better clarification.
Video Link: https://x.com/bkartnam/status/1991124911490805944?s=19
Components of the Strategy
- Asset and Timeframe:
- Volatility 75 index.
- Uses the M5 candlestick chart for analysis and entries for all trades.
- Inputs:
o Lot size (LS) – Percentage input for lot size, lot size should adapt percentage-wise to equity available as account increase or decrease. If the equity decrease to such an extent that it affects lot size to reach minimum lot size required Volatility 75 index by Deriv, it will continue entering trades at the minimum lot size until it reaches a point where potentially the equity increase again to be able to increase lot size as a percentage of equity.
o Points for calculating imaginary Trailing Stop (TS) – The imaginary trailing stop condition will activate with this input amount once the trade position reaches these points in profitable position from trade entry position. The imaginary trailing stop will not be an actual trailing stop in the trade, EA should calculate and follow open trade price action with this amount which will act as a trailing stop, if this following stop is triggered, close the trade.
o RSI Lower input margin (RSILow) – input for the lower margin on RSI with Period = 1, margin line to show in indicator window.
o RSI Higher input margin (RSIHigh) - input for the higher margin on RSI with Period = 1, margin line to show in indicator window.
- Indicators to be used (all indicators to be presented as per the attached diagram):
- Relative Strength Index (RSI) – added in Indicator Window 1 below main chart window:
- Period: 1.
- Apply to: Close prices.
- Levels as per inputs: oversold threshold = RSI Lower input margin and overbought threshold = RSI Higher input margin
- Moving Average (MA) – added in Main Chart window:
- Period: 35.
- Shift: 0.
- Method: Exponential.
- Apply to: Close prices.
- Style: Red
- This is added to the main chart window, use for trend confirmation.
- Envelope 1 – added to the RSI Indicator Window 1 below main chart window to envelope RSI movement:
- Period: 1.
- Shift: 0.
- Deviation: 6.000.
- Method: Smoothed.
- Apply to: Close prices.
- Levels: Upper band = OrangeRed and Lower band = Lime
- This creates bands around the RSI line or price, helping to identify extremes or volatility squeezes.
- Envelope 2 – added to the RSI Indicator Window 1 below main chart window to envelope RSI movement:
- Period: 1.
- Shift: 0.
- Deviation: 0.010.
- Method: Smoothed.
- Apply to: Close prices.
- Levels: Upper band = Lime and Lower band = OrangeRed
- This creates bands around the RSI line or price, helping to identify extremes or volatility squeezes.
- Entry Rules:
o Trading Condition Identified: Once the Envelope 2 / RSI (Period: 1) indicator come in close proximity (i.e. 5 units on RSI levels between the 2 envelopes) of the Envelope 1 / RSI (Period: 1) upper band (for Sell confirmation) or lower band (for Buy confirmation), a trade condition is identified, though not activated yet. Thus, If the 2 envelopes / RSI (Period: 1) come in close proximity (i.e. 5 units on RSI levels between the 2 envelopes) of the upper band, a Sell condition is identified. If the envelopes / RSI (Period: 1) come in close proximity (i.e. 5 units on RSI levels between the 2 envelopes) of the lower band, a Buy condition is identified.
- Buy Signal: After a Buy trading condition has been identified, wait until a M5 candle crosses and close above the MA line, then open a trade with the start of the next M5 candle. Open trade with Lot Size (LS) input.
- Sell Signal: After a Sell trading condition has been identified, wait until a M5 candle crosses and close below the MA line, then open a trade with the start of the next M5 candle. Open trade with Lot Size (LS) input.
- Stop Loss (SL) condition for Sell trades: For all Sell trades the stop loss condition is set at the highest price position reached between the time of the trade condition confirmation until the time that the price position crossed the MA line (i.e. when sell signal was activated). The EA should not create an actual stop loss on the chart, it should only terminate the trade when the Stop Loss (LS) condition is met.
- Stop Loss (SL) condition for Buy trades: For all Buy trades the stop loss condition is set at the lowest price position reached between the time of the trade condition confirmation until the time that the price position crossed the MA line (i.e. when buy signal was activated). The EA should not create an actual stop loss on the chart, it should only terminate the trade when the Stop Loss (LS) condition is met.
- Imaginary Trailing Stop condition (TS) for Sell trades: Once price reaches the point where the Envelope 2 / RSI (Period: 1) indicator cross the RSI lower input margin(RSILow), the trailing stop condition will be activated, the EA will track the trailing with the input points behind trade position, i.e. if RSI lower input (RSILow) margin was set at 32, TS condition will be activated once Envelope 2 / RSI (Period: 1) indicator crosses the 32 RSI margin. Trade will terminate when imaginary TS position is triggered. If the amount of points between trade entry point and trade position where Envelope 2 / RSI (Period: 1) level is crossing the RSI lower input margin (RSILow) is < than Points for imaginary Trailing Stop (TS) input, then terminate the trade.
- Imaginary Trailing Stop (TS) condition for Buy trades: Once price reaches the point where the Envelope 2 /RSI (Period: 1) indicator cross the RSI upper input margin (RSIHigh), the trailing stop condition will be activated, the EA will track the trailing with the input points behind trade position, i.e. if RSI upper input (RSIHigh) margin was set at 68, TS condition will be activated once Envelope 2 / RSI (Period: 1) indicator crosses the 68 RSI margin. Trade will terminate when imaginary TS position is triggered. If the amount of points between trade entry point and trade position where Envelope 2 / RSI (Period: 1) level is crossing the RSI upper input margin (RSIHigh) is < than Points for imaginary Trailing Stop (TS) input, then terminate the trade.
- Next Trade: Once a trade terminates, the next trade will only open once a new trading condition has been identified when the Envelope 2 / RSI (Period: 1) come in close proximity (i.e. 5 units on RSI levels between the 2 envelopes) of the Envelope 1 upper band (for Sell confirmation) or lower band (for Buy confirmation).
Please code the indicators directly into the EA. Visualization of indicators to match exactly as illustrated in the attached diagram named “Diagram” and in video link provided. The indicator windows with indicators should also be visible / load in the MT5 Strategy Tester to be able to track and verify trading identification conditions.
