Supertrend Oscillator

hitesh

Active Member
#4
Thankyou Hitesh.

But the Chandelier stop of Amibroker Library does not seem to work:)

Regards

Bimbo
Dear Bimbo,

The code is as follows:-


_SECTION_BEGIN("CHANDELIER EXIT Geoff Mulhall");
/* Chandelier Exit */
/* Geoff Mulhall Oct 2004 */
/* Requires chandelier plugin installed */

GraphXSpace = 5;

Plot(Close,"",colorBlack,styleCandle);
Plot(ChandelierCl(ATR(15),2.5),"",colorRed,styleLine);
Plot(ChandelierHL(ATR(15),2.5),"",colorBlue,styleLine);

Buy = Close > Ref( ChandelierCl(ATR(15),3), -1);
Sell = Close < Ref( ChandelierCl(ATR(15),3), -1);

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorBlue, colorRed ),0, IIf( Buy, Low, High ) );


rising = ChandelierHL(ATR(15),2.5) > ChandelierCl(ATR(15),2.5);

GraphXSpace = 0.5;


if(StrToNum(NumToStr(rising)))
bgColor = colorLavender;
else
bgColor = colorCustom14;
SetChartBkGradientFill( colorAqua, bgColor);



///////////// Title //////////////////
Change=C-Ref(C,-1);
ROCVal = ROC(C,1);
Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}" + " O: " + O + ", H:" + H + ", L:" +L
+"\n"+ ", C:"+ C +" ("+NumToStr(Change,1.2)+" )" +" ("+NumToStr(ROCVal,1.2)+" %%)") +EncodeColor(colorWhite) ;
/*
+ " Risk: " +NumToStr(Risk,1.2) + " Risk Long: " + NumToStr(Risk_P_L,1.2)+" %" + " Risk Short: " + NumToStr(Risk_P_S,1.2)+" %"
+EncodeColor(colorRed)
+"\n"+ "Up Fr : "+NumToStr(Ref(UpFractal,2),1.2) +EncodeColor(colorBlue)
+ " Dn Fr: " +NumToStr(Ref(DownFractal,2),1.2) +EncodeColor(colorCustom10)
+ " Up Fr: " +NumToStr(Max(HHV(H,3),Ref(UpFractal,2)) ) + " Dn Fr: " +NumToStr(Min(LLV(L,3),Ref(DownFractal,2))) + " Lot: "+NumToStr(LotSize,1.2);

*/

_SECTION_END();
 

hitesh

Active Member
#5
Thankyou Hitesh.

But the Chandelier stop of Amibroker Library does not seem to work:)

Regards

Bimbo
Procedure and explaination on how to make it work:-

CHANDELIER EXIT Geoff Mulhall 24 Oct 2004
-----------------------------------------

The plugin is downloadable from
http://finance.groups.yahoo.com/group/amibroker/files/
OR
http://www.amibroker.org/3rdparty/
Look for chandelier.zip

Vers 1.02 - Improvements to problem data handling. Thks to James Kung

The chandelier exit is described at Chuck Le Beau's System Traders Club. Refer :

http://traderclub.com/cgi-bin/discus/show.cgi?107/107

if you are NOT familiar with the Chandelier Exit please refer to that site before continuing.

The plugin provided here is a True Chandelier Exit ie it is always hung
from the Highest High OR Highest Close NOT as in the compromise Version below which readers may have seen else where ie

Chandelier = HHV(High - 3 * ATR(15),10); // Long Trade
Chandelier = LLV(Low + 3 * ATR(15),10); // Short Trade

As you will see from the PNG file attached the plugin provides a single function which can be used for both Short AND long trades. This is achieved by flipping whenever the Close pierces the exit.

To Plot a Chandelier exit hung from the Close code as follows -

Plot(ChandelierCl(ATR15),3),"ChandelierCl",colorBlue,styleLine);

To Plot a Chandelier exit hung from the High OR Low code as follows -

Plot(ChandelierHL(ATR(15),3),"ChandelierHL",colorRed,styleLine);

Note both functions accept two parameters
1. The ATR array - in this case a 15 period - in this example ATR(15) AND
2. The ATR multiplier - in this example 3

A trading system can be built using the functions provided as follows

Buy = Close > Ref( ChandelierCl(ATR(15),3), -1);
Sell = Close < Ref( ChandelierCl(ATR(15),3), -1);

Note the Ref function is required due to the way the exit switches between a long AND Short trade.

To install the the plugin
1. Uzip the contents of Chandelier.zip to a temp directory
2. Shut down Amibroker
3. Copy the file Chandelier.dll to C:\Program Files\Amibroker\Plugins
4. Restart Amibroker (You will get a warning message that a new plugin has been installed).
 
#6
Does aybody have amibroker afl for this SUPER TREND oscillator

http://codebase.mql4.com/4725

Regards
Hi Bimbo

I can help you somewhat. But i am using Super trend in Ninja trader with esignal data subscription. And it is working fantastic. See the attached Trades of Last 2 days for your Info.

But i don;t have code in AFL.

Sorry abt that

Regards

Vinkal
 

Attachments

Last edited:

citrus

Well-Known Member
#7
Code:
_SECTION_BEGIN;
period	= Param("Period", 13, 1, 240, 1);
mult	= Param("Multiplier", 1.7, 1, 240, 0.1);

f=ATR(period);

VS[0] = Close[0]; 
trend[0] = 0;
HighC[0]=0;
Lowc[0]=0;

for( i = period+1; i < BarCount; i++ ) 
{ 

  vs[i]			= vs[i-1];
  trend[i]	= trend[i-1];
  highC[i]	= HighC[i-1];
  lowc[i]		= lowc[i-1];

	if ((trend[i]>=0) && ( C[i] <VS[i] ))
	{
			trend[i] =-1;
			HighC[i] = C[i];
			lowc[i] = C[i];
	}

	if ((trend[i]<=0) && (C[i] >VS[i]))
	{
			trend[i]=1;
			HighC[i] = C[i];
			lowc[i] = C[i];
	}   

	if (trend[i]==-1) 
	{
		if (C[i]<lowc[i]) lowc[i] = C[i];
     VS[i]= lowc[i]+ (mult*f[i]);
	}


	if (trend[i]==1)  
	{
		if (C[i]>HighC[i]) HighC[i] = C[i];
     VS[i]= HighC[i]-(mult*f[i]);
	}

} 


Buy=Cross(Trend,0);
Sell=Cross(0, Trend);

Plot(Close,"Close",colorBlue,styleCandle);
Plot(VS, "Vol Stop",IIf(trend==1,10,11 ),styleThick);

mkol 	= IIf( Trend==1, 10,  11);
Plot(5, "ribbon", mkol, styleOwnScale|styleArea|styleNoLabel, 0, -5);	// Weekly trend

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-f, High+f)); 
_SECTION_END();
Try this also.
 

THE LORD

Active Member
#8
very intersting indecator mr-citrus but can you supply us with the another indecators that in attached image for mr- vrathee because we want another indecator supply this indecator to get best advantuge and thanx you are doing agreat job
 
#9
Code:
_SECTION_BEGIN;
period	= Param("Period", 13, 1, 240, 1);
mult	= Param("Multiplier", 1.7, 1, 240, 0.1);

f=ATR(period);

VS[0] = Close[0]; 
trend[0] = 0;
HighC[0]=0;
Lowc[0]=0;

for( i = period+1; i < BarCount; i++ ) 
{ 

  vs[i]			= vs[i-1];
  trend[i]	= trend[i-1];
  highC[i]	= HighC[i-1];
  lowc[i]		= lowc[i-1];

	if ((trend[i]>=0) && ( C[i] <VS[i] ))
	{
			trend[i] =-1;
			HighC[i] = C[i];
			lowc[i] = C[i];
	}

	if ((trend[i]<=0) && (C[i] >VS[i]))
	{
			trend[i]=1;
			HighC[i] = C[i];
			lowc[i] = C[i];
	}   

	if (trend[i]==-1) 
	{
		if (C[i]<lowc[i]) lowc[i] = C[i];
     VS[i]= lowc[i]+ (mult*f[i]);
	}


	if (trend[i]==1)  
	{
		if (C[i]>HighC[i]) HighC[i] = C[i];
     VS[i]= HighC[i]-(mult*f[i]);
	}

} 


Buy=Cross(Trend,0);
Sell=Cross(0, Trend);

Plot(Close,"Close",colorBlue,styleCandle);
Plot(VS, "Vol Stop",IIf(trend==1,10,11 ),styleThick);

mkol 	= IIf( Trend==1, 10,  11);
Plot(5, "ribbon", mkol, styleOwnScale|styleArea|styleNoLabel, 0, -5);	// Weekly trend

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-f, High+f)); 
_SECTION_END();
Try this also.
Hi

If you apply this formula it shows some syntax error in First line. Please Ractify.

Regards
 

THE LORD

Active Member
#10
mr -vrathee please try this

_SECTION_BEGIN("Trend Oscolleator");

period = Param("Period", 13, 1, 240, 1);
mult = Param("Multiplier", 1.7, 1, 240, 0.1);

f=ATR(period);

VS[0] = Close[0];
trend[0] = 0;
HighC[0]=0;
Lowc[0]=0;

for( i = period+1; i < BarCount; i++ )
{

vs = vs[i-1];
trend = trend[i-1];
highC = HighC[i-1];
lowc = lowc[i-1];

if ((trend>=0) && ( C <VS ))
{
trend =-1;
HighC = C;
lowc = C;
}

if ((trend<=0) && (C >VS))
{
trend=1;
HighC = C;
lowc = C;
}

if (trend==-1)
{
if (C<lowc) lowc = C;
VS= lowc+ (mult*f);
}


if (trend==1)
{
if (C>HighC) HighC = C;
VS= HighC-(mult*f);
}

}


Buy=Cross(Trend,0);
Sell=Cross(0, Trend);

Plot(Close,"Close",colorBlue,styleCandle);
Plot(VS, "Vol Stop",IIf(trend==1,10,11 ),styleThick);

mkol = IIf( Trend==1, 10, 11);
Plot(5, "ribbon", mkol, styleOwnScale|styleArea|styleNoLabel, 0, -5); // Weekly trend

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-f, High+f));
_SECTION_END();
 

Similar threads