[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Help with coding Head And Shoulder



PureBytes Links

Trading Reference Links

I am trying to code the H&S pattern into Amibroker. I want to have 
it recognized on the CCI. I coded it, but cannot get it to recognize 
properly. Here is the code, if anyone can help, I would appreciate 
it.

thanks,
Dennis



z= CCI(14);

Plot(z,"",colorSkyblue,styleLine);

Plot(z,"",colorLime,styleHistogram);

Plot(0,"",colorRed,styleLine);

//---------------------------------------------------

// Head and Shoulders Pattern:  to use with CCI(14) with zero line 

// calculate left shoulder

LStop= z== HHV(z,(BarsSince(z<0))) AND z>=0 ; //left shoulder top

LSbot= z==LLV(z,BarsSince(Lstop))AND z>=0  ; //left shoulder bottom

LeftShoulder= LSbot; //left shoulder


// calculate head

HeadTop= z==HHV(z,BarsSince(LSbot)) AND z>=0; //head top

HeadBot=z== LLV(z,BarsSince(Headtop)) AND z>0; //head bottom
 
Head= headbot;  //head


// calculate right shoulder

RStop= z==HHV(z,BarsSince(Headbot)) AND z>0; //right shoulder top

rsbot= z==LLV(z,BarsSince(RStop)); // right shoulder bottom

RightShoulder= rsbot; //right shoulder bottom

//------------------------------------------------------------

// Plot numbers for refernce to aid in testing

PlotShapes(IIf
(Leftshoulder,shapeDigit1,shapeNone),colorTurquoise,0,0,-15); // 
left shoulder bottom

PlotShapes(IIf(Head,shapeDigit2,shapeNone),colorTurquoise,0,0,-
25); //head bottom

PlotShapes(IIf
(rightshoulder,shapeDigit3,shapeNone),colorTurquoise,0,0,-35); // 
right shoulder bottom