Spécifications
DM me for the full script. I created a tradingview strategy using the code of a volume indicator. Now i would like for the strategy to be convert into Mt4 and implement additional risk features.
The strategy uses Heiken Ashi candles along with the CVD volume indicator. So if you already have the code of the heiken ashi candle for mt4 or 5 that will be a plus.
Additional features i want added:
1) Entry based on balance percentages. Allow me to choose the percentage from 1 to 100.
2) Brake even after a number of pips have been received. Allow me to turn this features off and on if needed and choose the pips.
3) Pyramiding - adding extra entries based on the initial entry for trades that are going in the right direction. Its similar to what trading view has.
4) Stop loss, Take profit.
5) Close entry based on the open of the next signal.
Strategy Overview:
This strategy uses Cumulative Volume Delta (CVD) to take buy or sell trades, with dynamic stop losses based on the most recent highs and lows. The strategy enters long (buy) positions when the CVD turns green and short (sell) positions when the CVD turns red. The stop loss is dynamically adjusted based on the most recent high or low within a specified lookback period, and positions are closed when the opposite signal occurs.
How the Strategy Works:
-
Calculate Buy or Sell Volume:
- The strategy checks whether the current bar is bullish or bearish based on its open/close and the previous bar’s close.
- Depending on the result, volume is classified as buy volume (positive) or sell volume (negative).
-
Cumulative Volume Delta Calculation:
- The net volume (difference between buy and sell volume) is summed up over time to generate the cumulative volume delta.
- If the CVD increases, it indicates buying pressure, and if it decreases, it indicates selling pressure.
-
Entry and Exit Logic:
- A buy position is taken when the CVD turns green, with a stop loss set at the lowest low of the last 10 bars.
- A sell position is taken when the CVD turns red, with a stop loss set at the highest high of the last 10 bars.
- Open positions are closed when the opposite signal is triggered (buy or sell).
MT4 Translation Considerations:
- Cumulative Volume Delta: Since CVD isn’t a built-in indicator in MT4, the developer will need to calculate the CVD using volume data. The CVD logic involves summing the differences between buy and sell volume over time.
- Stop Loss: The developer will implement dynamic stop losses based on the highest high or lowest low over the lookback period (this is similar to the iHigh() and iLow() functions in MT4).
- Entry/Exit Conditions: Buy and sell entries are based on the color change of the CVD (green for buy, red for sell), and positions are closed when the opposite signal occurs.
Summary:
- Buy entry: When CVD turns green, and stop loss is the lowest low of the past X bars.
- Sell entry: When CVD turns red, and stop loss is the highest high of the past X bars.
- Exit: Close positions when the opposite CVD signal occurs.