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

RE: [amibroker] 3D charts from the AA and Indicators



PureBytes Links

Trading Reference Links

Martin,
Nice question for AFL solution.


Plot(C,"",1,64); 
SetBarsRequired(1000,0);
percentChange = 1;
X=BarIndex();
isPeak = PeakBars(H, percentChange) == 0;
Peaktime=ValueWhen(isPeak, x);
peakValue = ValueWhen(isPeak, H);
LastPeaktime=LastValue(ValueWhen(isPeak, x));
LastPeakValue = LastValue(ValueWhen(isPeak, H));
ishigherpeak=ispeak AND Peakvalue>LastPeakValue;
PlotShapes(shapeDownTriangle*ishigherPeak,colorYellow);//the higher 
peaks
PlotShapes(shapeDownArrow*isPeak,colorRed);//the peaks
HigherPeaktime=LastValue(ValueWhen(ishigherPeak, x));
HigherPeakValue = LastValue(ValueWhen(ishigherPeak, H));
PlotShapes(shapeCircle*(higherPeaktime==x),colorPink);//the last 
higher peak
trendline=LineArray(x[HigherPeaktime],H[HigherPeaktime],x
[Lastpeaktime],H[Lastpeaktime],1);
Plot(trendline,"t",colorBrightGreen,8);

The line will be right extended, else change 1 to 0 in the 
trendline= ...

Dimitris
--- In amibroker@xxxxxxxxxxxxxxx, "Martin Henricson" <martin@xxxx> 
wrote:
> 
> Hi,
> 
> I am trying to find out the value of a previous peak. For 
simplicity I have 
> started out with the zig-zag based PeakBars() function. I construct 
an array 
> with booleans indicating if a bar is a peak or not and another 
array 
> indicating the corresponding peak value:
> 
> percentChange = 1;
> isPeak = PeakBars(H, percentChange) == 0;
> peakValue = ValueWhen(isPeak == 1, H);
> 
> So far everything is fine. My problem is now that I would like to 
know the 
> value of and number of bars since a previous peak. This previous 
peak should 
> be the first one backwards in time with a higher High than the 
current peak. 
> I would use this information to plot trend lines.
> 
> I have made attempts at solving this with looping, but it seems 
like quite 
> time consuming to scan backwards and forth through the arrays to 
construct 
> the needed arrays. So my question is: is there a way to do this 
with some 
> handy array based functions?
> 
> Any hints would be highly appreciated!
> 
> /Martin



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/