Attachments forums

Re: TradingView Indicators to MT4 Indicators

Coolcrow, Sat Mar 07, 2026 6:33 am

Hello pro coders and fellow traders. :) I've been using this Trend indicator from TradingView for about two months now, and I've found it to be quite useful. I would really appreciate it if someone could convert it to MT4. I'm not sure if one has already been made, but if one is available, please link it. Thanks.

TREND MAGIC
https://www.tradingview.com/v/kRIjThLZ/

In my 2-3 months of using it, I've found it's very good at confirming a pullback (i.e., when the line changes color, the pullback is valid and you should start looking for an entry).

Code: Select all

//@version=4
study("Trend Magic", shorttitle="TM", overlay=true, format=format.price, precision=2, resolution="")
period=input(20,"CCI period")
coeff=input(1,"ATR Multiplier")
AP=input(5,"ATR Period")
ATR=sma(tr,AP)
src=input(close)
upT=low-ATR*coeff
downT=high+ATR*coeff
MagicTrend=0.0
MagicTrend := cci(src,period)>=0 ? (upT<nz(MagicTrend[1]) ? nz(MagicTrend[1]) : upT) : (downT>nz(MagicTrend[1]) ? nz(MagicTrend[1]) : downT)
color1= cci(src,period)>=0 ? #0022FC : #FC0400
plot(MagicTrend, color=color1, linewidth=3)
alertcondition(cross(close, MagicTrend), title="Cross Alert", message="Price - MagicTrend Crossing!")
alertcondition(crossover(low, MagicTrend), title="CrossOver Alarm", message="BUY SIGNAL!")
alertcondition(crossunder(high, MagicTrend), title="CrossUnder Alarm", message="SELL SIGNAL!")
All files in topic