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

[amibroker] S$C Gann/Fibs Formula error - Please help



PureBytes Links

Trading Reference Links

I have posted the code for the Gann and Fibonacci Projection formula 
from Stocks & Commodities most recent issue.  There are no problems 
with the code as long as I rem out the "Plotbluedot" lines", 
the "Plotbluedot" causes the error that I have posted after the 
code.  Any help will be appreciated.

David K.


//* S&C Gann and Fibonacci Projections – Sept 2004 *//

Change=Param("Change",1,0.10,20,0.10);

Gannincrement=Param("Gann",0.0625,1.25,2.0,0.25);

procedure Plotshapeat(x,y,shape,shift)
{
PlotShapes(IIf(BarIndex()==x,shape,0),colorRed,0,y,shift);
}
procedure Plotbluedot(x,y)
{
PlotShapes(IIf(BarIndex()==x,shapeSmallCircle,0),colorBlue,0,y,0);
	
for(i=-2;i<=2;i++)
{
if(i !=O)
{
ygann=(sqrt(y)+i*gannincrement)^2;
PlotShapes(IIf(BarIndex()
==x,shapeSmallCircle,0),colorOrange,0,ygann,0);
	}
}
}


bi=BarIndex();

sbi=SelectedValue(bi);

GraphXSpace=2;

Plot(Zig(C,Change),"ZigZag",colorBrightGreen,1);

Plot(C,"Price", IIf(bi>sbi,colorLightGrey,colorBlack),styleBar);

upshift=15;

if(SelectedValue(PeakBars(C,Change)<TroughBars(C,Change)))
{

pt1=PeakBars(C,Change,1)==0;
pt2=TroughBars(C,Change,1)==0;
}

else
{

pt1=TroughBars(C,Change,1)==0;
pt2=PeakBars(C,Change,1)==0;

upshift= -upshift;
}


bpt1=SelectedValue(ValueWhen(pt1,bi));
bpt2=SelectedValue(ValueWhen(pt2,bi));
bpt3=SelectedValue(ValueWhen(pt1,bi,2));
bpt4=SelectedValue(ValueWhen(pt2,bi,2));
bpt5=SelectedValue(ValueWhen(pt1,bi,3));
bpt6=SelectedValue(ValueWhen(pt2,bi,3));

Plotshapeat(bpt1,C,shapeDigit1,upshift);
Plotshapeat(bpt2,C,shapeDigit2,-upshift);
Plotshapeat(bpt3,C,shapeDigit3,upshift);
Plotshapeat(bpt4,C,shapeDigit4,-upshift);
Plotshapeat(bpt5,C,shapeDigit5,upshift);
Plotshapeat(bpt6,C,shapeDigit6,-upshift);

Level=SelectedValue(ValueWhen(pt1,C));
Plotbluedot(round(bpt1+1.618*(bpt1-bpt2)),Level);
//Plotbluedot(round(bpt1+0.382*(bpt1-bpt2)),Level);

//Plotbluedot(round(bpt1+0.50*(bpt2-bpt3)),Level);
//Plotbluedot(round(bpt1+1.732*(bpt2-bpt3)),Level);

//Plotbluedot(round(bpt1+0.618*(bpt4-bpt5)),Level);
//Plotbluedot(round(bpt1+2*(bpt4-bpt5)),Level);

//Plotbluedot(round(bpt2+0.6707*(bpt4-bpt2)),Level);
//Plotbluedot(round(bpt2+2.618*(bpt4-bpt2)),Level);

//Plotbluedot(round(bpt2+1*(bpt6-bpt2)),Level);
//Plotbluedot(round(bpt2+3*(bpt6-bpt2)),Level);


The following error message occurs when executing "Plotbluedot"

Line 70, Column 49:
Plotshapeat(bpt6,C,shapeDigit6,-upshift);



Level=SelectedValue(ValueWhen(pt1,C));

Plotbluedot(round(bpt1+1.618*(bpt1-bpt2)),Level);


------------------------------------------------^

Error 3.
Condition in IF, WHILE, FOR statements
has to be Numeric or Boolean type.
You can not use array here,
please use [] (array subscript operator)
to access array elements




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