I need this indicator to be converted from Pinescript to MT4 source code is required. all object should have buffer as well no need for EHMA, and THMA, only need HMA no need for multi time frame. CALL or PUT Are signals After CALL or PUT, trade should be taken on the next candle. After the signal , if we get win on the very next signal that means ITM After the signal, if we lose the very next candle and get a win on the next candle after first martingale then its ITM1 After the signal, if we get 2 loss back to back and win on the thrid candle after the signal then its ITM3 If set martingale steps= 2 on the input then system works if we dont get a win on 2 step martingale then its OTM. ITM1 means on second martingale we get a win. ITM2 means on 3rd martingale we get a win, OTM means we got all trade loss ITM = Direct win after the signal ITM1 = One loss then win after signal ITM2 = two loss then win after signal OTM = all three trades were a loss after signal //@version=5 indicator('TC SHAKTI', overlay=true) //INPUT src = input(close, title='Source') modeSwitch = input.string('Hma', title='Hull Variation', options=['Hma', 'Thma', 'Ehma']) length = input(21, title='Length(180-200 for floating S/R , 55 for swing entry)') lengthMult = input(1.0, title='Length multiplier (Used to view higher timeframes with straight band)') useHtf = input(false, title='Show Hull MA from X timeframe? (good for scalping)') htf = input.timeframe('240', title='Higher timeframe') switchColor = input(true, 'Color Hull according to trend?') candleCol = input(false, title='Color candles based on Hull\'s Trend?') visualSwitch = input(true, title='Show as a Band?') thicknesSwitch = input(1, title='Line Thickness') transpSwitch = input.int(40, title='Band Transparency', step=5) //FUNCTIONS //HMA HMA(_src, _length) => ta.wma(2 * ta.wma(_src, _length / 2) - ta.wma(_src, _length), math.round(math.sqrt(_length))) //EHMA EHMA(_src, _length) => ta.ema(2 * ta.ema(_src, _length / 2) - ta.ema(_src, _length), math.round(math.sqrt(_length))) //THMA THMA(_src, _length) => ta.wma(ta.wma(_src, _length / 3) * 3 - ta.wma(_src, _length / 2) - ta.wma(_src, _length), _length) //SWITCH Mode(modeSwitch, src, len) => modeSwitch == 'Hma' ? HMA(src, len) : modeSwitch == 'Ehma' ? EHMA(src, len) : modeSwitch == 'Thma' ? THMA(src, len / 2) : na //OUT _hull = Mode(modeSwitch, src, int(length * lengthMult)) HULL = useHtf ? request.security(syminfo.ticker, htf, _hull) : _hull MHULL = HULL[0] SHULL = HULL[2] //COLOR hullColor = switchColor ? HULL > HULL[2] ? color.rgb(0, 136, 255, 56) : color.rgb(0, 255, 195, 56) : #ff9800 //PLOT ///< Frame Fi1 = plot(MHULL, title='MHULL', color=hullColor, linewidth=thicknesSwitch, transp=50) Fi2 = plot(visualSwitch ? SHULL : na, title='SHULL', color=hullColor, linewidth=thicknesSwitch, transp=50) alertcondition(ta.crossover(MHULL, SHULL), title='Hull trending up.', message='Hull trending up.') alertcondition(ta.crossover(SHULL, MHULL), title='Hull trending down.', message='Hull trending down.') ///< Ending Filler fill(Fi1, Fi2, title='Band Filler', color=hullColor, transp=transpSwitch) ///BARCOLOR barcolor(color=candleCol ? switchColor ? hullColor : na : na) long = MHULL > SHULL and close>close[1] short= SHULL > MHULL and close close[1]) or (pos[1]==-1 and close< close[1]) otm = (pos[1]==1 and close<=close[1]) or (pos[1]==-1 and close>=close[1]) long_exit = pos[1]== 1 and (itm or (otm and martingale==ta.barssince(longCond ))) short_exit= pos[1]==-1 and (itm or (otm and martingale==ta.barssince(shortCond))) if (long_exit and not shortCond) or (short_exit and not longCond) pos:=0 colCall= #0f39e1e6 colPut = color.rgb(0, 255, 195, 56) colItm = color.rgb(189, 8, 44) colOtm = color.rgb(11, 81, 8, 26) // Chart Plot & Alerts plotshape(longCond , textcolor=color.white, color=color.rgb(41, 145, 235, 12), style=shape.labelup , title="Call" , text="CALL" , location=location.belowbar, offset=0, size=size.small) plotshape(shortCond, textcolor=color.white, color=color.rgb(0, 255, 195, 50) , style=shape.labeldown, title="Put", text="PUT", location=location.abovebar, offset=0, size=size.small) plotshape(long_exit and otm, textcolor=color.white, color=colItm, style=shape.labeldown, title="Call OTM", text="OTM", location=location.abovebar, offset=0, size=size.tiny) plotshape(short_exit and otm, textcolor=color.white, color=colItm, style=shape.labelup , title="Put OTM" , text="OTM", location=location.belowbar, offset=0, size=size.tiny) plotshape(long_exit and itm and ta.barssince(longCond )==1, textcolor=color.white, color=colOtm, style=shape.labeldown, title="Call ITM", text="ITM", location=location.abovebar, offset=0, size=size.tiny) plotshape(short_exit and itm and ta.barssince(shortCond)==1, textcolor=color.white, color=colOtm, style=shape.labelup , title="Put ITM" , text="ITM", location=location.belowbar, offset=0, size=size.tiny) plotshape(long_exit and itm and ta.barssince(longCond)==2, textcolor=color.white, color=colOtm, style=shape.labeldown, title="Call ITM1", text="ITM1", location=location.abovebar, offset=0, size=size.tiny) plotshape(long_exit and itm and ta.barssince(longCond)==3, textcolor=color.white, color=colOtm, style=shape.labeldown, title="Call ITM2", text="ITM2", location=location.abovebar, offset=0, size=size.tiny) plotshape(long_exit and itm and ta.barssince(longCond)==4, textcolor=color.white, color=colOtm, style=shape.labeldown, title="Call ITM3", text="ITM3", location=location.abovebar, offset=0, size=size.tiny) plotshape(short_exit and itm and ta.barssince(shortCond)==2, textcolor=color.white, color=colOtm, style=shape.labelup, title="Put ITM1" , text="ITM1", location=location.belowbar, offset=0, size=size.tiny) plotshape(short_exit and itm and ta.barssince(shortCond)==3, textcolor=color.white, color=colOtm, style=shape.labelup, title="Put ITM2" , text="ITM2", location=location.belowbar, offset=0, size=size.tiny) plotshape(short_exit and itm and ta.barssince(shortCond)==4, textcolor=color.white, color=colOtm, style=shape.labelup, title="Put ITM3" , text="ITM3", location=location.belowbar, offset=0, size=size.tiny) alertcondition(longCond , title="BUY Alert" ) alertcondition(shortCond, title="SELL Alert") alertcondition(longCond or shortCond, title="BUY or SELL Alert" ) i_startTime = input.time(defval = timestamp("01 Sep 2002 13:30 +0000"), title = "Backtesting Start Time") timeCond = (time > i_startTime) win = itm and timeCond loss= otm and timeCond var wins = array.new_float() var losses = array.new_float() if win array.push(wins, 1) if loss array.push(losses, 1) total_wins = array.sum(wins ) total_loss = array.sum(losses) perc = total_wins / (total_wins+total_loss)