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

[amibroker] Self adjusting "percentage" in advanced trendlines AFL



PureBytes Links

Trading Reference Links

Hi,
I have a seemingly simple problem that unfortunately has bugged me for quite sometime.

I am trying to make a simple modification of the advanced trendline AFL (http://www.amibroker.com/library/detail.php?id=926&hilite=LineArray) so that it can adjust the "percentage" by itself.

So, instead of the original :
Percentage = Param("Percentage", 0.08, 0.01, 100. ,0.01);

I try to change it to:
Percentage = IIf(ADX(14)>20, 0.4, 0.7);

Unfortunately this doesn't work.  I get error when it tries to calculate x0, x1, y0, y1 (please see below).  Would any kind soul be able to tell me where the mistake is ?




Percentage = IIf(ADX(14)>20, 0.03, 0.08);
Lines = Param("Lines?", 1, 1, BarCount-2);
...[snip]
Plot(Main, "", IIf(C>O,colorGreen, colorRed), styleBar);
if(DrawAllLines)
for(i = 2; i<=Lines+1; i++)
{
if(DrawS!="Off")
{
x0 = GetXSupport(Support1, Percentage, i);
x1 = GetXSupport(Support2, Percentage, i-1);
y0 = GetYSupport(Support1, Percentage, i);
y1 = GetYSupport(Support2, Percentage, i-1);
x = LineArray(x0, y0, x1, y1, 1);
if(!Method)
Con = (IsTD_Demand(x0) AND IsTD_Demand(x1));
if(AllOrUpS) ConS = y0 < y1;
if(Con AND ConS)
Plot(x, "TD1", colorLightBlue, styleLine|styleThick);
xa = Study("xa", GetChartID());
}
...[snip]




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/