PureBytes Links
Trading Reference Links
|
Dimitris,
I copied the code exactly what I currently use in IB
for your reference here it is:
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);
It is just that I cannot use this code to backtest.
I know how to calculate the value of th1 for the next day which would
be a stop for my short position for the next day.
Thanks for your help
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
wrote:
> You have had the same question some days ago.
> Your condP *DOES NOT DEFINE A PEAK*
> Try the simple
> condP=Ref(H,-1)>=Ref(H,-2) AND Ref(H,-1)>H AND Ref(H,-1)>Ref(C,-3);
> Plot(C,"",CONDP*24+1,64);
> The condP candles are painted orange and they come *ONE DAY AFTER*
> some local peaks.
> Do you speak for these peaks?
> If positive, these peaks occur when the cond1 occurs.
> Try the
> condP=Ref(H,-1)>=Ref(H,-2) AND Ref(H,-1)>H AND Ref(H,-1)>Ref(C,-3);
> cond1=Ref(condP,1);
> Plot(C,"",COND1*24+1,64);
> If you have in mind these [green] peaks let me know to see the rest
> of your requirement.
> Note also that cond1 looks into the future by +1 day [you can not
> know a peak before the next, lower day...]
> Dimitris Tsokakis
>
> --- In amibroker@xxxxxxxxxxxxxxx, "epintoem" <epintoem@xxxx> wrote:
> > I have the AFL code that automatically draws trend lines but I
cant
> > use it in Backtester. Anyone with a work around?
> >
> >
> >
> > condP=Ref(H,-1)>=Ref(H,-2) AND Ref(H,-1)>H AND Ref(H,-1)>Ref(C,-
3);
> >
> > The above condition defines a peak.
> >
> > In order to draw a trend line I need 4 values
> >
> > first Peak= value when condP is met
> >
> > second peak= value when condp is met and High greater than first
> peak.
> >
> > bar1= number of bars between peaks
> >
> > bar2= number of bars since first peak.
> >
> > Using last value restricts the finding to the last occurrence
which
> > then does not allow to back test?
> >
> > TIA
------------------------ 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/
|