SuperTrend - page 16

 

A different version of super trend

Files:
 

NRPU super trend indicator

 

Non Repainting Super Trend Indicator with Time Bar Left AFL code convert

Hi, community. I recently came across this article detailing the attached indicator but unfortunately it comes in AFL format which is a format I cannot use. If there is a MT4 version of the indicator available, please feel free to share. If not, if there's someone who's willing to convert the attached file to MT4 that would be great as well. I will attach the parameters to the code as well as a link to the website in my post, thanks for your time.

Edit: I'm not trying to promote the website so if this isn't allowed please let me know thanks.

Link to website: Non Repainting Super Trend Indicator with Time Bar Left AFL code

Code: /* Done by Rajandran R */

/* Author of Marketcalls — Simply Intelligent Technical Analysis and Trading Strategies */

_SECTION_BEGIN("SuperTrend");

SetBarsRequired(100000,0);

GraphXSpace = 15;

SetChartOptions(0,chartShowArrows|chartShowDates);

SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));

GfxSetBkMode(0);

GfxSetOverlayMode(1);

SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));

Plot(C,"nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

SetTradeDelays(1,1,1,1);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Factor=Param("Factor",4,1,10,0.1);

Pd=Param("ATR Periods",10,1,100,1);

Up=(H+L)/2+(Factor*ATR(Pd));

Dn=(H+L)/2-(Factor*ATR(Pd));

iATR=ATR(Pd);

TrendUp=TrendDown=Null;

trend[0]=1;

changeOfTrend=0;

flag=flagh=0;

for (i = 1; i Up) {

trend=1;

if (trend == -1) changeOfTrend = 1;

}

else if (Close0) {

flag=1;

}

else {

flag=0;

}

if (trend>0 && trend<0) {

flagh=1;

}

else {

flagh=0;

}

if (trend>0 && DnUp)

{ Up=Up;

}

if (flag==1)

{ Up=(H+L)/2+(Factor*iATR);;

}

if (flagh==1)

{ Dn=(H+L)/2-(Factor*iATR);;

}

if (trend==1) {

TrendUp=Dn;

if (changeOfTrend == 1) {

TrendUp = TrendDown;

changeOfTrend = 0;

}

}

else if (trend==-1) {

TrendDown=Up;

if (changeOfTrend == 1) {

TrendDown = TrendUp;

changeOfTrend = 0;

}

}

}

Plot(TrendUp,"Trend",colorGreen);

Plot(TrendDown,"Down",colorRed);

Buy = trend==1;

Sell=trend==-1;

Buy=ExRem(Buy,Sell);

Sell=ExRem(Sell,Buy);

Short=Sell;

Cover=Buy;

BuyPrice=ValueWhen(Buy,C);

SellPrice=ValueWhen(Sell,C);

ShortPrice=ValueWhen(Short,C);

CoverPrice=ValueWhen(Cover,C);

Title = EncodeColor(colorWhite)+ "Super Trend AFL code from www.marketcalls.in" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +

" - " + Date() +" - "+"n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+

"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"n"+

EncodeColor(colorLime)+

WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+

WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"n"+EncodeColor(colorYellow)+

WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+

WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","");

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);

PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);

PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);

PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

TrendSL=IIf(trend==1,TrendUp,TrendDown);

for(i=BarCount-1;i>1;i--)

{

if(Buy == 1)

{

entry = C;

sig = "BUY";

sl = TrendSL;

tar1 = entry + (entry * .0050);

tar2 = entry + (entry * .0092);

tar3 = entry + (entry * .0179);

bars = i;

i = 0;

}

if(Sell == 1)

{

sig = "SELL";

entry = C;

sl = TrendSL;

tar1 = entry - (entry * .0050);

tar2 = entry - (entry * .0112);

tar3 = entry - (entry * .0212);

bars = i;

i = 0;

}

}

Offset = 20;

Clr = IIf(sig == "BUY", colorLime, colorRed);

ssl = IIf(bars == BarCount-1, TrendSL, Ref(TrendSL, -1));

sl = ssl;

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

//Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);

//Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);

/*

for (i=bars; i

 
Jaquanburton:
Hi, community. I recently came across this article detailing the attached indicator but unfortunately it comes in AFL format which is a format I cannot use. If there is a MT4 version of the indicator available, please feel free to share. If not, if there's someone who's willing to convert the attached file to MT4 that would be great as well. I will attach the parameters to the code as well as a link to the website in my post, thanks for your time.

Edit: I'm not trying to promote the website so if this isn't allowed please let me know thanks.

Link to website: Non Repainting Super Trend Indicator with Time Bar Left AFL code

Code: /* Done by Rajandran R */

/* Author of Marketcalls — Simply Intelligent Technical Analysis and Trading Strategies */

_SECTION_BEGIN("SuperTrend");

SetBarsRequired(100000,0);

GraphXSpace = 15;

SetChartOptions(0,chartShowArrows|chartShowDates);

SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));

GfxSetBkMode(0);

GfxSetOverlayMode(1);

SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));

Plot(C,"nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

SetTradeDelays(1,1,1,1);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Factor=Param("Factor",4,1,10,0.1);

Pd=Param("ATR Periods",10,1,100,1);

Up=(H+L)/2+(Factor*ATR(Pd));

Dn=(H+L)/2-(Factor*ATR(Pd));

iATR=ATR(Pd);

TrendUp=TrendDown=Null;

trend[0]=1;

changeOfTrend=0;

flag=flagh=0;

for (i = 1; i Up) {

trend=1;

if (trend == -1) changeOfTrend = 1;

}

else if (Close0) {

flag=1;

}

else {

flag=0;

}

if (trend>0 && trend<0) {

flagh=1;

}

else {

flagh=0;

}

if (trend>0 && DnUp)

{ Up=Up;

}

if (flag==1)

{ Up=(H+L)/2+(Factor*iATR);;

}

if (flagh==1)

{ Dn=(H+L)/2-(Factor*iATR);;

}

if (trend==1) {

TrendUp=Dn;

if (changeOfTrend == 1) {

TrendUp = TrendDown;

changeOfTrend = 0;

}

}

else if (trend==-1) {

TrendDown=Up;

if (changeOfTrend == 1) {

TrendDown = TrendUp;

changeOfTrend = 0;

}

}

}

Plot(TrendUp,"Trend",colorGreen);

Plot(TrendDown,"Down",colorRed);

Buy = trend==1;

Sell=trend==-1;

Buy=ExRem(Buy,Sell);

Sell=ExRem(Sell,Buy);

Short=Sell;

Cover=Buy;

BuyPrice=ValueWhen(Buy,C);

SellPrice=ValueWhen(Sell,C);

ShortPrice=ValueWhen(Short,C);

CoverPrice=ValueWhen(Cover,C);

Title = EncodeColor(colorWhite)+ "Super Trend AFL code from www.marketcalls.in" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +

" - " + Date() +" - "+"n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+

"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"n"+

EncodeColor(colorLime)+

WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+

WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"n"+EncodeColor(colorYellow)+

WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+

WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","");

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);

PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);

PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);

PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

TrendSL=IIf(trend==1,TrendUp,TrendDown);

for(i=BarCount-1;i>1;i--)

{

if(Buy == 1)

{

entry = C;

sig = "BUY";

sl = TrendSL;

tar1 = entry + (entry * .0050);

tar2 = entry + (entry * .0092);

tar3 = entry + (entry * .0179);

bars = i;

i = 0;

}

if(Sell == 1)

{

sig = "SELL";

entry = C;

sl = TrendSL;

tar1 = entry - (entry * .0050);

tar2 = entry - (entry * .0112);

tar3 = entry - (entry * .0212);

bars = i;

i = 0;

}

}

Offset = 20;

Clr = IIf(sig == "BUY", colorLime, colorRed);

ssl = IIf(bars == BarCount-1, TrendSL, Ref(TrendSL, -1));

sl = ssl;

Plot(LineArray(bars-Offset, tar1, BarCount, tar1,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, tar2, BarCount, tar2,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

Plot(LineArray(bars-Offset, tar3, BarCount, tar3,1), "", Clr, styleLine|styleDots, Null, Null, Offset);

//Plot(LineArray(bars-Offset, sl, BarCount, sl,1), "", colorDarkRed, styleLine|styleLine, Null, Null, Offset);

//Plot(LineArray(bars-Offset, entry, BarCount, entry,1), "", colorGreen, styleLine|styleLine, Null, Null, Offset);

/*

for (i=bars; i

Looks like regular atr based non repainting super trend from this thread. Did you check this supertrend nrp new_alert.mq4

 

xSuperTrend candles that works with new metatrader xsupertrend_candles.mq4

Files:
 

Can someone update the rest of indicators from this package to be new metatrader 4 compatible : https://www.mql5.com/en/forum/general

 
poster:
Can someone update the rest of indicators from this package to be new metatrader 4 compatible : https://www.mql5.com/en/forum/general

Here are these 2 now :

xsupertrend_nmc.mq4

xsupertrend_tape_mtf_nmc.mq4

 

This one too : xsupertrend_tape_nmc.mq4

Files:
 

Thank you

 
mladen:
Tsar, This would be a completely cleaned, non-repainting version of super trend (using CCI for trend the same way as the one you posted). It is multi time frame already (it was originaly posted at this post : https://www.mql5.com/en/forum/180025 , in this version you can chose CCI period ATR period and price to use). No alerts yet in it (check first this one and compare it to the one you use since there will be more alerts then it looks at the first glance when you look at the version you use because of the repainting that happens in some cases in that version)

Hello mladen;

Would you please make this nmc? Will it still non-repainting after correction?

Also, would you please make a histo version of it?

Thanks ..

Files:
Reason: