PureBytes Links
Trading Reference Links
|
Here is my definition of a peak
High greater than high previous day and following day. Most recent
high greater than close two days earlier.
condP=Ref(H,-1)>Ref(H,-2) AND Ref(H,-1)>H AND Ref(H,-1)>Ref(C,-3);
The conditions for the peak prior to this one are the same except
that the high should be greater than the peak it is connecting to.
It was Dimitris who provided me the code for IB.
Hope this helps
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
wrote:
> Stephane,
> Unfortunately this dip is plotting the extension of the trendline.
> Try
> slope=
> (Trough(L,7,2) - Trough(L,7,1)) /
> (TroughBars(L,7,1) - TroughBars(L,7,2));
> dip=
> Trough(L,7,1) + slope * TroughBars(L,7,1);
> Plot(dip,"",4,1);Plot(C,"",(TroughBars(L,7)==0)*4+1,64);
> to see it.
> Dimitris Tsokakis
> PS
> My problem is with epi conditions. Peaks and troughs are
interchanged
> one by one. Epi conditions do not
> --- In amibroker@xxxxxxxxxxxxxxx, "Stephane Carrasset"
> <nenapacwanfr@xxxx> wrote:
> > All codes with lastvalue CAN'T be backtested.
> > an Afl soulution could be
> > a better solution is possible with loops.
> >
> > stephane
> >
> > /*
> > x=cum(1);
> > startbar = LastValue( x-start );
> > endbar = LastValue(x- end );
> > Slope = (endval-startval)/(endbar-startbar);
> > line = Slope * (x-startbar) + startval;
> > endbar-startbar=x-end -(x-start)=start-end
> > */
> > slope=
> > (Trough(L,7,2) - Trough(L,7,1)) /
> > (TroughBars(L,7,1) - TroughBars(L,7,2));
> > dip=
> > Trough(L,7,1) + slope * TroughBars(L,7,1);
> > Plot(dip,"",4,1);
> >
> > /********Pic***********/
> > slope=
> > (Peak(H,7,2) - Peak(H,7,1)) /
> > (PeakBars(H,7,1) - PeakBars(H,7,2));
> > pic=
> > Peak(H,7,1) + slope * PeakBars(H,7,1);
> > Plot(pic,"",5,1);
> > Plot(Close,"",1,64);
> >
> > Buy=Cross(C,pic);
> > Plot(Buy*C,"",colorBlue,2);
> >
> >
> > > Any solution?
> > >
> > >
> > >
> > >
> > > X=Cum(1);
> > > D=1;// CHANGE 1 WITH 2, 3 etc
> > > for( d = 1; d <= 2; d++ )
> > > {
> > > bc=d+40;
> > > bc1=d+41;
> > > condP=Ref(H,-1)>=Ref(H,-2) AND Ref(H,-1)>H AND Ref(H,-1)>Ref(C,-
> 3);
> > > P=Ref(CONDP,1)*(X!=LastValue(X));
> > > endt= LastValue(ValueWhen( P, x, D ));
> > > endS = LastValue(ValueWhen( P, H, D ) );
> > > startt=LastValue(ValueWhen( P AND H>ends AND X<ENDT, x, 1 ));
> > > startS = LastValue( ValueWhen( P AND H>ends AND X<ENDT, H, 1 ));
> > > dtS =endt-startt;
> > > aS = (endS-startS)/dtS;bS = endS;
> > > tH = aS * ( x -endt ) + bS;
> > > tH1=IIf(X>STARTT-30,tH,-1E10);
> > > Plot(tH1,"",bc,1);
> > > condT=Ref(L,-2) >= Ref(L,-1) AND L>Ref(L,-1) AND Ref(L,-1)<Ref
> > (Close,-
> > > 3);
> > > T=Ref(CondT,1)*(X!=LastValue(X));
> > > Plot(C,"",4*P+3*T+1,64);
> > > endtT= LastValue(ValueWhen( T, x, D ));
> > > endST = LastValue(ValueWhen( T, L, D ) );
> > > starttT=LastValue(ValueWhen( T AND L<endsT AND X<ENDTT, x, 1 ));
> > > startST = LastValue( ValueWhen( T AND L<endsT AND X<ENDTT, L,
> 1 ));
> > > dtST =endtT-starttT;
> > > aST = (endST-startST)/dtST;bST = endST;
> > > tHT = aST * ( x -endtT ) + bST;
> > > tH1T=IIf(X>STARTTT-30,tHT,-1E10);
> > > Plot(tH1T,"",bc1,1);
> > >
> > > }
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|