Need your Help convert this TV Script indicator;s to MT4 please...
There is very Interesting of the New Concept & inspired by presentTrading :
There are the Concept of Multiple SuperTrends (as the Blocks) with Dynamic Step's. And Use an Elliott Wave-like Pattern analysis...
Elliott's Quadratic Momentum - Strategy [presentTrading]
Code: Select all
//@version=5
//@presenttrading
//the Elliott's Quadratic Momentum (EQM) strategy stands out as a sophisticated tool for traders. This strategy, unlike traditional methods,
// combines Elliott Wave theory with advanced SuperTrend indicators.
// Its unique approach lies in utilizing quadratic momentum calculations, offering a more nuanced and dynamic analysis of market trends.
strategy("Elliott's Quadratic Momentum - Strategy [presentTrading]",shorttitle = "EQM Strategy [presentTrading]", overlay=true, precision=3, default_qty_type=strategy.cash,
commission_value= 0.1, commission_type=strategy.commission.percent, slippage= 1,
currency=currency.USD, default_qty_type = strategy.percent_of_equity, default_qty_value = 10, initial_capital= 10000)
// Inputs for selecting trading direction
tradingDirection = input.string("Both", "Select Trading Direction", options=["Long", "Short", "Both"])
// SuperTrend Function
supertrend(src, atrLength, multiplier) =>
atr = ta.atr(atrLength)
up = hl2 - (multiplier * atr)
dn = hl2 + (multiplier * atr)
trend = 1
trend := nz(trend[1], 1)
up := src > nz(up[1], 0) and src[1] > nz(up[1], 0) ? math.max(up, nz(up[1], 0)) : up
dn := src < nz(dn[1], 0) and src[1] < nz(dn[1], 0) ? math.min(dn, nz(dn[1], 0)) : dn
trend := src > nz(dn[1], 0) ? 1 : src < nz(up[1], 0)? -1 : nz(trend[1], 1)
[up, dn, trend]
// Inputs for SuperTrend settings
atrLength1 = input(7, title="ATR Length for SuperTrend 1")
multiplier1 = input(4.0, title="Multiplier for SuperTrend 1")
atrLength2 = input(14, title="ATR Length for SuperTrend 2")
multiplier2 = input(3.618, title="Multiplier for SuperTrend 2")
atrLength3 = input(21, title="ATR Length for SuperTrend 3")
multiplier3 = input(3.5, title="Multiplier for SuperTrend 3")
atrLength4 = input(28, title="ATR Length for SuperTrend 3")
multiplier4 = input(3.382, title="Multiplier for SuperTrend 3")
// Calculate SuperTrend
[up1, dn1, trend1] = supertrend(close, atrLength1, multiplier1)
[up2, dn2, trend2] = supertrend(close, atrLength2, multiplier2)
[up3, dn3, trend3] = supertrend(close, atrLength3, multiplier3)
[up4, dn4, trend4] = supertrend(close, atrLength4, multiplier4)
// Entry Conditions based on SuperTrend and Elliott Wave-like patterns
longCondition = trend1 == 1 and trend2 == 1 and trend3 == 1 and trend4 == 1
shortCondition = trend1 == -1 and trend2 == -1 and trend3 == -1 and trend4 == - 1
// Exit conditions - Define your own exit strategy
// Example: Exit when any SuperTrend flips
LongExit = trend1 != trend1[1] or trend2 != trend2[1] or trend3 != trend3[1] or trend4 != trend4[1]
ShortExit = trend1 != trend1[1] or trend2 != trend2[1] or trend3 != trend3[1] or trend4 != trend4[1]
if tradingDirection == "Long" or tradingDirection == "Both"
if longCondition
strategy.entry("Long Entry", strategy.long)
if LongExit
strategy.close("Long Entry")
if tradingDirection == "Short" or tradingDirection == "Both"
if shortCondition
strategy.entry("Short Entry", strategy.short)
if ShortExit
strategy.close("Short Entry")
// Define entry alert conditions
alertcondition(longCondition, title="Long Entry Alert", message="Long Entry Condition Met")
alertcondition(shortCondition, title="Short Entry Alert", message="Short Entry Condition Met")
// Define exit alert conditions
alertcondition(LongExit, title="Long Exit Alert", message="Long Exit Condition Met")
alertcondition(ShortExit, title="Short Exit Alert", message="Short Exit Condition Met")
// Plotting
// Function to apply gradient effect
gradientColor(baseColor, length, currentBar) =>
var color res = color.new(baseColor, 100)
if currentBar <= length
res := color.new(baseColor, int(100 * currentBar / length))
res
// Apply gradient effect
color1 = gradientColor(color.blue, atrLength1, bar_index % atrLength1)
color4 = gradientColor(color.blue, atrLength4, bar_index % atrLength3)
// Plot SuperTrend with gradient for upward trend
plot1Up = plot(trend1 == 1 ? up1 : na, color=color1, linewidth=1, title="SuperTrend 1 Up")
plot4Up = plot(trend4 == 1 ? up4 : na, color=color4, linewidth=1, title="SuperTrend 3 Up")
// Plot SuperTrend with gradient for downward trend
plot1Down = plot(trend1 == -1 ? dn1 : na, color=color1, linewidth=1, title="SuperTrend 1 Down")
plot4Down = plot(trend4 == -1 ? dn4 : na, color=color4, linewidth=1, title="SuperTrend 3 Down")
// Filling the area between the first and third SuperTrend lines for upward trend
fill(plot1Up, plot4Up, color=color.new(color.green, 80), title="SuperTrend Upward Band")
// Filling the area between the first and third SuperTrend lines for downward trend
fill(plot1Down, plot4Down, color=color.new(color.red, 80), title="SuperTrend Downward Band")The Result is 'Very Good' and made it the Profit in Trading.
Explaint in :
https://en.tradingview.com/script/warXb ... entTrading