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

Re: [amibroker] I don't understand



PureBytes Links

Trading Reference Links

Hello,

Self-referencing is not possible with IIF function.
You need loops for that:

test[ 0 ] = 0;
for( i = 1; i < BarCount; i++ )
{
   if( test[ i - 1 ] > C[ i ] )
        test[ i ] = C[ i ]  - 0.1;
   else
   if( test[ i - 1 ] < C[ i ] )
        test[ i ] = C[ i ] + 0.1;
   else
        test[ i ] = test[ i - 1 ];
}

Plot(test,"Test",colorYellow,1);

Plot(C,"Close",colorBlack,1);

Recommended reading: 
Tutorial: Understanding how AFL works.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "stefano dotti" <031056@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, May 21, 2003 10:53 PM
Subject: [amibroker] I don't understand


> Hi to All.
> I try to understand the operation of afl language but.....
> 
> The following code would not have to design a yellow line that continuously
> crosses the closing line?
> 
> 
>   test=0; // init variable ??
>   test=IIf( test>C , C-0.1 , IIf( test<C , C+0.1 ,test));
>   Plot(test,"Test",colorYellow,1);
> 
>   Plot(C,"Close",2,1);
> 
>   
> It return a separate line of +0.1 from the line of close.
> Where I mistake?
> 
> Thanks in advance
> 
> -- 
> Best regards,
>  stefano 
> 
> 
> 
> 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/ 
> 
> 
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/uetFAA/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/