Hi, I am looking for a developer to convert a TV strategy into a Mt4 or Mt5 EA. The strategy is based on the EMA and the CVD volume indicator. I dont have the Mt4 or Mt5 version of these indicators. Copy the code below and place it in your TV to see the strategy. Other features:
Stop loss - Option to either use pips of my choosing or close on opposite signal appears.
Recovery - Martingale - Allow me to choose the lot size it will increase by. It will only kick in if the previous entry or entries close in a loss. It must stop or reset
Add to winning trade - For example, a buy trade is taken and its in profit, sometimes price pulls back with 2 or more red candles, after this, a green candle must engulf any of the red candles. Once this happens additional buy entries must be taken. Allow me to choose the lot size.
This strategy combines the Cumulative Volume Delta, price action, and an EMA filter to identify trading opportunities aligned with the prevailing trend. The entry limit logic helps avoid overtrading by restricting the number of entries after an EMA crossover, while the option to enable or disable the EMA filter provides flexibility in strategy application. This approach aims to capitalize on strong, confirmed market movements while minimizing false signals.
//@version=5
strategy("CVD with Price Action and EMA Filter", overlay=true)
// Inputs
anchorInput = input.timeframe("1D", "Anchor period")
useCustomTimeframeInput = input.bool(false, "Use custom timeframe")
lowerTimeframeInput = input.timeframe("1", "Timeframe")
// EMA Filter Inputs
useEMAFilter = input.bool(true, "Use EMA Filter")
emaLength = input.int(50, "EMA Length")
emaSource = input.source(close, "EMA Source")
// Function to calculate up and down volume
upAndDownVolume() =>
posVol = 0.0
negVol = 0.0
var isBuyVolume = true
switch
close > open => isBuyVolume := true
close < open => isBuyVolume := false
close > close[1] => isBuyVolume := true
close < close[1] => isBuyVolume := false
if isBuyVolume
posVol += volume
else
negVol -= volume
posVol + negVol
// Determine lower timeframe
var lowerTimeframe = switch
useCustomTimeframeInput => lowerTimeframeInput
timeframe.isseconds => "1S"
timeframe.isintraday => "1"
timeframe.isdaily => "5"
=> "60"
// Get volume delta for lower timeframe
diffVolArray = request.security_lower_tf(syminfo.tickerid, lowerTimeframe, upAndDownVolume())
// Calculate CVD
getHighLow(arr) =>
float cumVolume = na
float maxVolume = na
float minVolume = na
for item in arr
cumVolume := nz(cumVolume) + item
maxVolume := math.max(nz(maxVolume), cumVolume)
minVolume := math.min(nz(minVolume), cumVolume)
[maxVolume, minVolume, cumVolume]
[maxVolume, minVolume, lastVolume] = getHighLow(diffVolArray)
var cumulLastVolume = 0.0
anchorChange = timeframe.change(anchorInput) or (not na(lastVolume) and na(lastVolume[1]))
cumulOpenVolume = anchorChange ? 0.0 : cumulLastVolume[1]
cumulMaxVolume = cumulOpenVolume + maxVolume
cumulMinVolume = cumulOpenVolume + minVolume
cumulLastVolume := cumulOpenVolume + lastVolume
// Determine CVD color
cvdColor = cumulLastVolume >= cumulOpenVolume ? color.teal : color.red
// Plot CVD as candle
hline(0)
plotcandle(cumulOpenVolume, cumulMaxVolume, cumulMinVolume, cumulLastVolume, "CVD", color = cvdColor, bordercolor = cvdColor, wickcolor = cvdColor)
// EMA Calculation
ema = ta.ema(emaSource, emaLength)
// Entry limit logic
var int buyEntryCount = 0
var int sellEntryCount = 0
// Detect EMA cross
emaCrossedUp = ta.crossover(close, ema)
emaCrossedDown = ta.crossunder(close, ema)
if emaCrossedUp or emaCrossedDown
buyEntryCount := 0
sellEntryCount := 0
// Trading logic with EMA filter
priceGreen = close > open
priceRed = close < open
cvdGreen = cvdColor == color.teal
cvdRed = cvdColor == color.red
buySignal = priceGreen and cvdGreen
sellSignal = priceRed and cvdRed
if useEMAFilter
buySignal := buySignal and close > ema and buyEntryCount < 2
sellSignal := sellSignal and close < ema and sellEntryCount < 2
// Increment entry counts and place trades
if buySignal
buyEntryCount := buyEntryCount + 1
strategy.entry("Buy", strategy.long)
if sellSignal
sellEntryCount := sellEntryCount + 1
strategy.entry("Sell", strategy.short)
// Plot Buy and Sell signals
plotshape(series=buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="Buy")
plotshape(series=sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="Sell")
// Plot EMA line
plot(useEMAFilter ? ema : na, title="EMA", color=color.blue, linewidth=2)