PureBytes Links
Trading Reference Links
|
Coba you did not use what i had written. Go back and see how I handled
the function.
On 10/14/05, Terry <MagicTH@xxxxxxxxxxx> wrote:
> Right. You are trying to pass in a variable that is declared inside the
> function, thus the !!not defined error.
>
> The variable you pass to your function needs to be the study ID or Chart
> ID (I don't know exactly on this point as I haven't used these before).
> Since your function asks for a variable you must supply one, hence the
> !!syntax error
>
> --
> Terry
>
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
> Behalf Of coba702002
> Sent: Thursday, October 13, 2005 10:58
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Makes no sense??? A bug? or ???
>
> I appreciate you answer and time. the reason i am using a function
> was for the multi trend line letters. I have tried to call the
> function like you suggested but get an error saying the TLBUP is
> used without being defined or if i use your code i get a syntax
> error... expecting "(" after trendCheckup; I think i have been
> chasing my tail so long i can't figure anything out
>
> function trendCheckup(StudyID)
> {
> Linup = Study(StudyID,GetChartID());
> TLBUP = Cross(CCI(14),Linup);
> PlotShapes( IIf
> ((TLBUP),shapeUpArrow,shapeNone),colorDarkGreen,0,Graph0,Offset=20);
> return TLBUP;
>
> }
> function trendCheckdown(StudyID)
> {
> LineDn = Study(StudyID,GetChartID());
> TLBDN = Cross(LineDn,CCI(14));
> PlotShapes( IIf
> ((TLBDN ),shapeDownArrow,shapeNone),colorDarkRed,0,Graph0,Offset=20);
> return TLBDN;
> }
>
> alphai = "";
> for( i = 0; i<27; i++ )
> {
> if (i==1) {alphai="A";}if (i==2) {alphai="B";}if (i==3) {alphai="C";}
> if (i==4) {alphai="D";}if (i==5) {alphai="E";}if (i==6) {alphai="F";}
> if (i==7) {alphai="G";}if (i==8) {alphai="H";}if (i==9) {alphai="I";}
> if (i==10) {alphai="J";}if (i==11) {alphai="K";}if (i==12)
> {alphai="L";}
> if (i==13) {alphai="M";}if (i==14) {alphai="N";}if (i==15)
> {alphai="O";}if (i==16) {alphai="P";}if (i==17) {alphai="Q";}if
> (i==18) {alphai="R";}
> if (i==19) {alphai="S";}if (i==20) {alphai="T";}if (i==21)
> {alphai="U";}if (i==22) {alphai="V";}if (i==23) {alphai="W";}if
> (i==24) {alphai="X";}
> if (i==25) {alphai="Y";}if (i==26) {alphai="Z";}
>
> trendCheckup("U"+alphai);
> trendCheckdown("D"+alphai);
>
> }
>
> ass = trendCheckup(TLBUP); !!not defined
> or
> ass = trendCheckup; !!syntax
>
>
> Buy = IIf(ass>0,1,0);
> filter = buy;
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
> >
> > Functions do not execute until they are called. You are never
> calling
> > the function. If you want it inline as you are expecting, just
> remove
> > the function wrapper. Otherwise you must:
> > a) return something from the function,
> > b) call the function to get results.
> > ___________________________________________
> > Try this with no function:
> >
> > ass=0; //Not necessary
> >
> > Linup = Study(StudyID,GetChartID());
> > TLBUP = Cross(CCI(14),Linup);
> > PlotShapes( IIf
> >
> ((TLBUP),shapeUpArrow,shapeNone),colorDarkGreen,0,Graph0,Offset=20);
> > ass = TLBUP;
> >
> > Buy= IIf(ass>0,1,0);
> > __________________________________________
> > Or this as function:
> >
> > ass=0; //Not necessary
> > function trendCheckup(StudyID)
> > {
> > Linup = Study(StudyID,GetChartID());
> > TLBUP = Cross(CCI(14),Linup);
> > PlotShapes( IIf
> >
> ((TLBUP),shapeUpArrow,shapeNone),colorDarkGreen,0,Graph0,Offset=20);
> > return TLBUP;
> > }
> >
> > ass = trendCheckup; //Calls function, stores result in your
> variable
> > Buy= IIf(ass>0,1,0);
> >
> >
> > PS: Since the code inside the function is only executed once, a
> function
> > call is not necessary. I would just use the first example.
> > --
> > Terry
> >
> > -----Original Message-----
> > From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
> On
> > Behalf Of coba702002
> > Sent: Thursday, October 13, 2005 08:08
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] Re: Makes no sense??? A bug? or ???
> >
> > Thanks for your reply Graham, however im still lost... here is
> what
> > i have done>>> the first piece of code per your suggestions
> produces
> > no explore results. I do get a (1) in the title results at the
> > proper point in the title, so why wouldn't i get a buy=1 and
> > therefore a flag to show the results of an explore instead of zero
> > returned explore results. Im must be missing something very basic
> > but i don't see it? (see second piece of code below)
> >
> > Plot(CCI(14),"",colorBlack,styleLine|styleNoLabel);
> >
> > ass=0;
> > function trendCheckup(StudyID)
> > {
> > Linup = Study(StudyID,GetChartID());
> > TLBUP = Cross(CCI(14),Linup);
> > PlotShapes( IIf
> >
> ((TLBUP),shapeUpArrow,shapeNone),colorDarkGreen,0,Graph0,Offset=20);
> > ass=TLBUP;
> > }
> >
> > Buy= IIf(ass>0,1,0);
> >
> > Filter=Buy;
> >
> > trendCheckup("XY");
> > Title = Name()+" "+ ass ;
> >
> > AddColumn(CCI(14),"CCI",3.2);
> > AddColumn(ass,"Buy",1);
> >
> >
> > >>>>>>HOWEVER This code Does produce expore results... isn't it
> the
> > same in essence???
> >
> > Line = Study("ug",1142);
> > e=Cross(wcci,Line);
> > f=Cross(Line,wcci);
> > //PlotShapes(IIf
> > ((e),shapeHollowUpArrow,shapeNone),colorGreen,0,Graph0,Offset=10);
> > //PlotShapes(IIf
> > ((f),shapeHollowDownArrow,shapeNone),colorRed,0,Graph0,Offset=10);
> >
> > Buy= IIf(e>0,1,0);
> > bby=Buy;
> > AddColumn(bby,"bby",1);
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> > >
> > > I dd a check and it works for me
> > > You do realise that you will never be able to view the variable
> > TLBUP
> > > as it is only the resultant of the function calculation. It is
> not
> > a
> > > variable for actual use outside the function. I changed the base
> > plot
> > > to price to make life easier for me
> > >
> > > Plot(C,"",colorWhite,styleBar);
> > >
> > > function trendCheckup(StudyID)
> > > {
> > > Linup = Study(StudyID,GetChartID());
> > > TLBUP = Cross(C,Linup);
> > > PlotShapes( TLBUP*shapeUpArrow,colorBrightGreen,0,L,-20);
> > > return TLBUP;
> > > }
> > >
> > > ass = trendCheckup("XY");
> > > Title = Name()+" "+ ass ;
> > >
> > >
> > > you should assign the function results to a variable.
> > > To call it up by itself is really a procedure which gives no
> actual
> > > returns, but does something, you would then need to use the
> global
> > > variable definition eg
> > >
> > > Plot(C,"",colorWhite,styleBar);
> > >
> > > procedure trendCheckup(StudyID)
> > > {
> > > global ass;
> > > Linup = Study(StudyID,GetChartID());
> > > TLBUP = Cross(C,Linup);
> > > PlotShapes( TLBUP*shapeUpArrow,colorBrightGreen,0,L,-20);
> > > ass = TLBUP;
> > > }
> > >
> > > trendCheckup("XY");
> > > Title = Name()+" "+ ass ;
> > >
> > > hope this helps
> > > --
> > > Cheers
> > > Graham
> > > AB-Write >< Professional AFL Writing Service
> > > Yes, I write AFL code to your requirements
> > > http://e-wire.net.au/~eb_kavan/ab_write.htm
> > >
> > >
> > >
> > > On 10/13/05, coba702002 <coba702002@xxxx> wrote:
> > > > This function Plots the arrow fine, so in theory the TLBUP
> should
> > > > equal 1 based on a cross of the study line. However when i try
> > and
> > > > pass that value out I do not get a 1... its empty.
> > > >
> > > > function trendCheckup(StudyID)
> > > > {
> > > > global ASS;
> > > > global TLBUp;
> > > > Linup = Study(StudyID,GetChartID());
> > > > TLBUP = Cross(CCI(14),Linup);
> > > > PlotShapes( IIf
> > > >
> >
> ((TLBUP),shapeUpArrow,shapeNone),colorDarkGreen,0,Graph0,Offset=20);
> > > > ASS = IIf(Cross(CCI(14),Linup),1,0);
> > > > return TLBUP;
> > > >
> > > > }
> > > >
> > > > if i assign 'ass' a number it gets passed out fine...
> ie 'ass'=5
> > > >
> > > > function trendCheckup(StudyID)
> > > > {
> > > > global ASS;
> > > > global TLBUp;
> > > > Linup = Study(StudyID,GetChartID());
> > > > TLBUP = Cross(CCI(14),Linup);
> > > > PlotShapes( IIf
> > > >
> >
> ((TLBUP),shapeUpArrow,shapeNone),colorDarkGreen,0,Graph0,Offset=20);
> > > > //ASS = IIf(Cross(CCI(14),Linup),1,0);
> > > > ass=5
> > > > return ass;
> > > >
> > > > }
> > > >
> > > > However if i assign 'ass' the cross code im back to getting
> nadda
> > > > again
> > > >
> > > > function trendCheckup(StudyID)
> > > > {
> > > > global ASS;
> > > > global TLBUp;
> > > > Linup = Study(StudyID,GetChartID());
> > > > TLBUP = Cross(CCI(14),Linup);
> > > > PlotShapes( IIf
> > > >
> >
> ((TLBUP),shapeUpArrow,shapeNone),colorDarkGreen,0,Graph0,Offset=20);
> > > > ASS = IIf(Cross(CCI(14),Linup),1,0);
> > > > return ASS;
> > > >
> > > > }
> > > >
> > > > What gives?
> > > >
> > > > using ami 4.73
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> >
> >
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
>
>
>
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.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/
|