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

[amibroker] Re: Help with coding Head And Shoulder



PureBytes Links

Trading Reference Links

Yes I did..."All Symbols" was definately tried.

Dennis


--- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxx> wrote:
>
> I assume you also checked "all symbols"?
> 
> Previously I noted that PeakBars uses the zig-zag function which 
looks
> into the future, thus it is less likely to actually find something 
on
> the current bar (since the function will not complete until it has
> enough future bars to do so, wherein it will indicate a signal in 
the
> past.
> --
> Terry
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
On
> Behalf Of Dennis And Lisa
> Sent: Monday, September 04, 2006 10:11
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Help with coding Head And Shoulder
> 
> This is strange, I run an exploration, and still get nothing. My 
> settings are :
> 
> General Tab:
> Positions: Long and Short
> Periodicity= 5 minutes
> Futures Mode is checked
> Round Size Lot: 1
> Tick Size: 1
> 
> I also tried n last days n=1 and got nothing
> I also tried all quotations and got nothing
> 
> Potfolio Tab:
> MAx Open Positions: 1
> 
> My database is only populated eith ER2, YM, QM intraday data.
> 
> -Dennis
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" <ajf1111@> 
> wrote:
> >
> > Dennis,
> > 
> > using the code I just sent you....check out the image 
file....this 
> is a small sample of the exploration..
> > 
> > It does return hits.
> > 
> > 
> > Anthony
> >   ----- Original Message ----- 
> >   From: Dennis And Lisa 
> >   To: amibroker@xxxxxxxxxxxxxxx 
> >   Sent: Sunday, September 03, 2006 11:45 PM
> >   Subject: [amibroker] Re: Help with coding Head And Shoulder
> > 
> > 
> >   Hi Anthony, thanks for your input. I tried doing this some 
time 
> ago, 
> >   and I get nothing in the exploration.
> > 
> >   Dennis
> > 
> >   --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" 
<ajf1111@> 
> >   wrote:
> >   >
> >   > Hello,
> >   > 
> >   > I inserted the CCI(14) in the code, load into the AA window, 
> >   select all symbols , n=1, explore..double click on a 
ticker..is 
> this 
> >   what you are trying to accompolish..
> >   > 
> >   > 
> >   > 
> >   > x = Cum(1);
> >   > 
> >   > per = 5;
> >   > 
> >   > back=50;
> >   > 
> >   > inter=100;
> >   > 
> >   > s11=CCI(14);//h;
> >   > 
> >   > s12=CCI(14);//L;
> >   > 
> >   > /* H & S */
> >   > 
> >   > pR = PeakBars( s11, per, 1 ) == 0;
> >   > 
> >   > endt1= LastValue(ValueWhen( pR, x, 1 ));
> >   > 
> >   > medt1=LastValue(ValueWhen( pR, x, 2 ));
> >   > 
> >   > startt1=LastValue(ValueWhen( pR, x, 3 ));
> >   > 
> >   > dt1=endt1-startt1;
> >   > 
> >   > C1=x==endt1 OR x==medt1 OR x==startt1;
> >   > 
> >   > endR = LastValue(ValueWhen( pR, s11, 1 ) );
> >   > 
> >   > medR=LastValue(ValueWhen( pR, s11, 2 ) );
> >   > 
> >   > startR = LastValue( ValueWhen( pR, s11, 3 ));
> >   > 
> >   > Filter1=medR>endR AND medR>startR AND abs(startR-endR)<0.02*
> >   (startR+endR) AND dt1<inter AND endt1>LastValue(x)-back;
> >   > 
> >   > MaxGraph=10;Graph1=CCI(14);Graph1Style=1;GraphXSpace=5;
> >   > 
> >   > /*H&S Neck Line*/
> >   > 
> >   > Aper=medt1-startt1;bper=endt1-medt1;
> >   > 
> >   > La= LastValue(ValueWhen(x==medt1,LLV(CCI(14),Aper)));
> >   > 
> >   > Lb=LastValue(ValueWhen(x==-1+endt1,LLV(CCI(14),bper)));
> >   > 
> >   > Fa=CCI(14)==La AND x>startt1 AND x<medt1;
> >   > 
> >   > Fb=CCI(14)==Lb AND x>medt1 AND x<endt1;
> >   > 
> >   > endt= LastValue(ValueWhen( Fb, x ));
> >   > 
> >   > startt=LastValue(ValueWhen( Fa, x ));
> >   > 
> >   > dtS =endt-startt;endS = Lb;startS = La;
> >   > 
> >   > aS = (endS-startS)/dtS;bS = endS;
> >   > 
> >   > trendlineS = aS * ( x -endt ) + bS; 
> >   > 
> >   > Graph3 = IIf(Filter1 AND x>startt-5,trendlineS,-
> >   1e10);Graph3BarColor=7;
> >   > 
> >   > /*Inverted H & S*/
> >   > 
> >   > tpR = TroughBars( s12, per, 1 ) == 0;
> >   > 
> >   > tendt1=LastValue(ValueWhen(tpr,x,1));
> >   > 
> >   > tmedt1=LastValue(ValueWhen(tpr,x,2));
> >   > 
> >   > tstartt1=LastValue(ValueWhen(tpr,x,3));
> >   > 
> >   > tdt1=tendt1-tstartt1;
> >   > 
> >   > C2=x==tendt1 OR x==tmedt1 OR x==tstartt1;
> >   > 
> >   > tendR = LastValue(ValueWhen( tpR, s12, 1 ) );
> >   > 
> >   > tmedR=LastValue(ValueWhen( tpR, s12, 2 ) );
> >   > 
> >   > tstartR = LastValue( ValueWhen( tpR, s12, 3 ));
> >   > 
> >   > Filter2=tmedR<tendR AND tmedR<tstartR AND abs(tstartR-tendR)
> <0.02*
> >   (tstartR+tendR) AND tdt1<inter AND tendt1>LastValue(x)-back;
> >   > 
> >   > Graph1BarColor=IIf(C1 AND Filter1,7,IIf(C2 AND 
Filter2,10,1));
> >   > 
> >   > /*Inverted H&S Neck Line*/
> >   > 
> >   > tAper=tmedt1-tstartt1;tbper=tendt1-tmedt1;
> >   > 
> >   > Ha= LastValue(ValueWhen(x==tmedt1,HHV(CCI(14),tAper)));
> >   > 
> >   > Hb=LastValue(ValueWhen(x==-1+tendt1,HHV(CCI(14),tbper)));
> >   > 
> >   > tFa=CCI(14)==Ha AND x>tstartt1 AND x<tmedt1;
> >   > 
> >   > tFb=CCI(14)==Hb AND x>tmedt1 AND x<tendt1;
> >   > 
> >   > Rendt= LastValue(ValueWhen(tFb, x ));
> >   > 
> >   > Rstartt=LastValue(ValueWhen( tFa, x ));
> >   > 
> >   > Rdt =Rendt-Rstartt;endR = Hb;startR = Ha;
> >   > 
> >   > aR = (endR-startR)/Rdt;bR = endR;
> >   > 
> >   > trendlineR = aR * ( x -Rendt ) + bR; 
> >   > 
> >   > Graph4 = IIf(Filter2 AND x>Rstartt-5,trendlineR,-
> >   1e10);Graph4BarColor=10;
> >   > 
> >   > Filter=Filter1 OR Filter2;
> >   > 
> >   > NumColumns=2;/*Graph2=x==-1+tendt1;*/
> >   > 
> >   > Column0=Filter1;
> >   > 
> >   > Column1=Filter2;
> >   > 
> >   > Column0Format=Column1Format=1.0;
> >   > 
> >   > Column0Name="H&S";
> >   > 
> >   > Column1Name="inv H&S";
> >   > 
> >   > ----- Original Message ----- 
> >   > From: Dennis And Lisa 
> >   > To: amibroker@xxxxxxxxxxxxxxx 
> >   > Sent: Sunday, September 03, 2006 1:06 PM
> >   > Subject: [amibroker] Re: Help with coding Head And Shoulder
> >   > 
> >   > 
> >   > Thanks, but I tries replacing the H and L variables with CCI
> (14) 
> >   and 
> >   > still got nothing.
> >   > 
> >   > Dennis
> >   > 
> >   > --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" 
> <ajf1111@> 
> >   > wrote:
> >   > >
> >   > > Here is a Head and shoulders coded sometime ago by Dimitri.
> >   > > 
> >   > > x = Cum(1);
> >   > > 
> >   > > per = 5;
> >   > > 
> >   > > back=50;
> >   > > 
> >   > > inter=100;
> >   > > 
> >   > > s11=H;s12=L;
> >   > > 
> >   > > /* H & S */
> >   > > 
> >   > > pR = PeakBars( s11, per, 1 ) == 0;
> >   > > 
> >   > > endt1= LastValue(ValueWhen( pR, x, 1 ));
> >   > > 
> >   > > medt1=LastValue(ValueWhen( pR, x, 2 ));
> >   > > 
> >   > > startt1=LastValue(ValueWhen( pR, x, 3 ));
> >   > > 
> >   > > dt1=endt1-startt1;
> >   > > 
> >   > > C1=x==endt1 OR x==medt1 OR x==startt1;
> >   > > 
> >   > > endR = LastValue(ValueWhen( pR, s11, 1 ) );
> >   > > 
> >   > > medR=LastValue(ValueWhen( pR, s11, 2 ) );
> >   > > 
> >   > > startR = LastValue( ValueWhen( pR, s11, 3 ));
> >   > > 
> >   > > Filter1=medR>endR AND medR>startR AND abs(startR-endR)
<0.02*
> >   > (startR+endR) AND dt1<inter AND endt1>LastValue(x)-back;
> >   > > 
> >   > > MaxGraph=10;Graph1=C;Graph1Style=64;GraphXSpace=5;
> >   > > 
> >   > > /*H&S Neck Line*/
> >   > > 
> >   > > Aper=medt1-startt1;bper=endt1-medt1;
> >   > > 
> >   > > La= LastValue(ValueWhen(x==medt1,LLV(L,Aper)));
> >   > > 
> >   > > Lb=LastValue(ValueWhen(x==-1+endt1,LLV(L,bper)));
> >   > > 
> >   > > Fa=L==La AND x>startt1 AND x<medt1;
> >   > > 
> >   > > Fb=L==Lb AND x>medt1 AND x<endt1;
> >   > > 
> >   > > endt= LastValue(ValueWhen( Fb, x ));
> >   > > 
> >   > > startt=LastValue(ValueWhen( Fa, x ));
> >   > > 
> >   > > dtS =endt-startt;endS = Lb;startS = La;
> >   > > 
> >   > > aS = (endS-startS)/dtS;bS = endS;
> >   > > 
> >   > > trendlineS = aS * ( x -endt ) + bS; 
> >   > > 
> >   > > Graph3 = IIf(Filter1 AND x>startt-5,trendlineS,-
> >   > 1e10);Graph3BarColor=7;
> >   > > 
> >   > > /*Inverted H & S*/
> >   > > 
> >   > > tpR = TroughBars( s12, per, 1 ) == 0;
> >   > > 
> >   > > tendt1=LastValue(ValueWhen(tpr,x,1));
> >   > > 
> >   > > tmedt1=LastValue(ValueWhen(tpr,x,2));
> >   > > 
> >   > > tstartt1=LastValue(ValueWhen(tpr,x,3));
> >   > > 
> >   > > tdt1=tendt1-tstartt1;
> >   > > 
> >   > > C2=x==tendt1 OR x==tmedt1 OR x==tstartt1;
> >   > > 
> >   > > tendR = LastValue(ValueWhen( tpR, s12, 1 ) );
> >   > > 
> >   > > tmedR=LastValue(ValueWhen( tpR, s12, 2 ) );
> >   > > 
> >   > > tstartR = LastValue( ValueWhen( tpR, s12, 3 ));
> >   > > 
> >   > > Filter2=tmedR<tendR AND tmedR<tstartR AND abs(tstartR-
tendR)
> >   <0.02*
> >   > (tstartR+tendR) AND tdt1<inter AND tendt1>LastValue(x)-back;
> >   > > 
> >   > > Graph1BarColor=IIf(C1 AND Filter1,7,IIf(C2 AND 
> Filter2,10,1));
> >   > > 
> >   > > /*Inverted H&S Neck Line*/
> >   > > 
> >   > > tAper=tmedt1-tstartt1;tbper=tendt1-tmedt1;
> >   > > 
> >   > > Ha= LastValue(ValueWhen(x==tmedt1,HHV(H,tAper)));
> >   > > 
> >   > > Hb=LastValue(ValueWhen(x==-1+tendt1,HHV(H,tbper)));
> >   > > 
> >   > > tFa=H==Ha AND x>tstartt1 AND x<tmedt1;
> >   > > 
> >   > > tFb=H==Hb AND x>tmedt1 AND x<tendt1;
> >   > > 
> >   > > Rendt= LastValue(ValueWhen(tFb, x ));
> >   > > 
> >   > > Rstartt=LastValue(ValueWhen( tFa, x ));
> >   > > 
> >   > > Rdt =Rendt-Rstartt;endR = Hb;startR = Ha;
> >   > > 
> >   > > aR = (endR-startR)/Rdt;bR = endR;
> >   > > 
> >   > > trendlineR = aR * ( x -Rendt ) + bR; 
> >   > > 
> >   > > Graph4 = IIf(Filter2 AND x>Rstartt-5,trendlineR,-
> >   > 1e10);Graph4BarColor=10;
> >   > > 
> >   > > Filter=Filter1 OR Filter2;
> >   > > 
> >   > > NumColumns=2;/*Graph2=x==-1+tendt1;*/
> >   > > 
> >   > > Column0=Filter1;
> >   > > 
> >   > > Column1=Filter2;
> >   > > 
> >   > > Column0Format=Column1Format=1.0;
> >   > > 
> >   > > Column0Name="H&S";
> >   > > 
> >   > > Column1Name="inv H&S";
> >   > > 
> >   > > ----- Original Message ----- 
> >   > > From: Dennis And Lisa 
> >   > > To: amibroker@xxxxxxxxxxxxxxx 
> >   > > Sent: Sunday, September 03, 2006 8:56 AM
> >   > > Subject: [amibroker] Help with coding Head And Shoulder
> >   > > 
> >   > > 
> >   > > 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
> >   > > 
> >   > > 
> >   > > 
> >   > > 
> >   > > 
> >   > > 
> >   > > ----------------------------------------------------------
> >   > ---------
> >   > > 
> >   > > avast! Antivirus: Inbound message clean. 
> >   > > 
> >   > > Virus Database (VPS): 0635-4, 09/01/2006
> >   > > Tested on: 9/3/2006 9:15:08 AM
> >   > > avast! - copyright (c) 1988-2006 ALWIL Software.
> >   > >
> >   > 
> >   > 
> >   > 
> >   > 
> >   > 
> >   > 
> >   > ----------------------------------------------------------
> >   ---------
> >   > 
> >   > avast! Antivirus: Inbound message clean. 
> >   > 
> >   > Virus Database (VPS): 0635-4, 09/01/2006
> >   > Tested on: 9/3/2006 1:12:50 PM
> >   > avast! - copyright (c) 1988-2006 ALWIL Software.
> >   >
> > 
> > 
> > 
> >    
> > 
> > 
> > -----------------------------------------------------------------
--
> ---------
> > 
> >     avast! Antivirus: Inbound message clean. 
> > 
> >     Virus Database (VPS): 0635-4, 09/01/2006
> >     Tested on: 9/4/2006 12:10:07 AM
> >     avast! - copyright (c) 1988-2006 ALWIL Software.
> >
> 
> 
> 
> 
> 
> 
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
>  
> Yahoo! Groups Links
>