Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

derek2209

Elliott Wave Oscillator Breaking Band

Recommended Posts

Hi,

 

Would anyone be kind enough to convert the code below into Amibroker code

Hoping that you can oblige

Thank you in advance

 

Derek

............................................

 

// EW Oscillator Breaking Bands
// Author: Unknown
// http://finance.groups.yahoo.com/group/amibroker/message/105938
// version: 1.0

// Author: aaa
// version: 1.1
// Date: 20091226
// added: a few tweaks

Inputs: 

K(		1	),
K2(		0.0555	),
Len(		5	);

Vars: 

Price1 ( 	0 ),
UpperBand(	0),
LowerBand(	0),
AvgP(		0);

Price1 =( Average((H+L)/2,5) - Average((H+L)/2,35)) ;

If Price1 > 0 then 
begin
upperband = price1;	
If barnumber >= 2 then
UpperBand = (upperband[1] + k2*( K * Price1 - upperband[1]) );
end;

If Price1 < 0 then 
begin
LowerBand = Price1;
If barnumber>=2 then
LowerBand =(lowerband[1] + K2*( K*Price1 - lowerband[1]));
end;

AvgP = XAverage(Price1,Len);

Plot1(		Price1,	"Osc535"	);
Plot2(		AvgP,		"AvgP"		);
Plot3(		UpperBand,	"upper"	);
Plot4(		LowerBand,	"lower"	);
Plot5( 	0  , 		"ZeroLine" 	);

if AvgP > 0 then
setplotcolor ( 2, rgb( 183 , 179 , 142 )	);
if AvgP < 0 then
setplotcolor ( 2, rgb( 110 , 136 , 177 )	);

if Price1 > 0 then
setplotcolor ( 1, yellow );
if Price1 < 0 then
setplotcolor ( 1, blue );		

�




Share this post


Link to post
Share on other sites

Here is my conversion from MT4 to Amibroker.

Download Advanced Get Oscillator For Amibroker (AFL)

 

Similar to "elliott-wave-oscillator-breaking-band" here except K1, K2;

 

Modified as follow:

 

_SECTION_BEGIN("elliott-wave-oscillator-breaking-band");
K=1;
K2=0.0555;
Len=5;

MP = (H+L)/2;
Price1 =ma(MP,5) - ma(MP,35) ;
AvgP = ema(Price1,Len);	


clr = IIf(Price1 > 0, colorYellow, IIf(Price1 < 0, colorBlue, colorGrey50));
Plot(Price1,	"Osc535", 	clr, styleNoLabel|styleHistogram);


clr = IIf(AvgP > 0, colorrgb(183,179,142), IIf(AvgP < 0, colorrgb(110,136,177), colorGrey50));	
Plot(AvgP,		"AvgP",		clr, styleNoLabel);

//-- Kelvinhand --
for(i=0; i<40; i++)
UpperBand[i] =LowerBand[i]= Price1[i];



for(i=40; i<BarCount; i++)
{

  if (Price1[i]>0)
  {
     UpperBand[i] = UpperBand[i-1]+ K2*(K*Price1[i] - UpperBand[i-1]);
     LowerBand[i] = LowerBand[i-1];
  }
  else
  {

     UpperBand[i] = UpperBand[i-1];
     LowerBand[i] = LowerBand[i-1]+ K2*(K*Price1[i] - LowerBand[i-1]);
  }


}


Plot(UpperBand,	"upper", colorOrange, styleNolabel);
Plot(LowerBand,	"lower", colorOrange, styleNolabel);
PlotGrid(0, colorWhite );

_SECTION_END();

Edited by KelvinHand

Share this post


Link to post
Share on other sites
Hi Kelvin,

 

Many thanks for your code and the additional information you supplied

Best regards,

 

Derek

 

Hi Derek,

 

Found Reference to http://www.traderslaboratory.com/forums/trading-indicators/7319-ew-oscillator-breaking-bands.html and corrected as follows

 

_SECTION_BEGIN("EW Oscillator Breaking Bands");

/***
Reference to Picture in:
http://www.traderslaboratory.com/forums/trading-indicators/7319-ew-oscillator-breaking-bands.html

--Converted by Kelvinhand --

***/

K=1;
K2=0.0555;
Len=5;


//-- 
MP = (H+L)/2;
Price1 =ma(MP,5) - ma(MP,35) ;
AvgP = ema(Price1,Len);	


clr = IIf(AvgP > 0, colorrgb(183,179,142), IIf(AvgP < 0, colorrgb(110,136,177), colorGrey50));	
Plot(AvgP,		"AvgP",		clr, styleNoLabel|styleHistogram|styleThick);


clr = IIf(Price1 > 0, colorYellow, IIf(Price1 < 0, colorBlue, colorGrey50));
Plot(Price1,	"Osc535", 	clr, styleNoLabel|styleHistogram|styleThick);



for(i=0; i<40; i++)
UpperBand[i] =LowerBand[i]= Price1[i];



for(i=40; i<BarCount; i++)
{

  if (Price1[i]>0)
  {
     UpperBand[i] = UpperBand[i-1]+ K2*(K*Price1[i] - UpperBand[i-1]);
     LowerBand[i] = LowerBand[i-1];
  }
  else
  {

     UpperBand[i] = UpperBand[i-1];
     LowerBand[i] = LowerBand[i-1]+ K2*(K*Price1[i] - LowerBand[i-1]);
  }


}


Plot(UpperBand,	"upper", colorWhite, styleNoLabel);
Plot(LowerBand,	"lower", colorWhite, styleNolabel);
PlotGrid(0, colorWhite );

_SECTION_END();

 

Attached Picture of the indicator in Amibroker:

vgjqlmg.jpg

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.