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

Re: [amibroker] Help with If-Else statement.



PureBytes Links

Trading Reference Links

You have not told us what currenttime is?
It may be best to sue timenum for this.
if you mean last bar time
currenttime = timenum();
or for actual system time
currenttime = now(4);

you need curly brackets for each if statement, and then make certain
all open brackets have closing brackets
You may also need to include a for statemetn to take it through the bars.


here is sample
//currenttime = Now(4);
currenttime = TimeNum();
timefactor[0]=0;
for(i=1;i<BarCount;i++)
{
if( CurrentTime[i] >= 100000 AND CurrentTime[i] < 103000 ) 
{
 TimeFactor[i] = 1.92 ;
}
else
{
 if ( CurrentTime[i] >= 103000 AND CurrentTime[i] < 110000 )
 {
  TimeFactor[i] = 1.84 ;
 }
}
}
Filter=1;
AddColumn(TimeFactor,"tfact",1.2);



On 5/27/05, Scooter <mariani@xxxxxxxxxx> wrote:
> I am trying to create an exploration for estimating a symbols volume based
> on the current volume. I cant figure out how to properly nest my if-else
> statements in AFL.
> It keeps erroring out at the second "else".
> Help!
> Thanks, Scott
>  
> 
> 
> if( CurrentTime > 10.00 AND CurrentTime < 10.30 ) 
> 
> TimeFactor = 1.92 ;
> 
> else
> 
> {
> 
> if ( CurrentTime > 10.3 AND CurrentTime < 11.0 )
> 
> TimeFactor = 1.84 ;
> 
> }
> 
> else
> 
> {
> 
> if ( CurrentTime > 11.0 AND CurrentTime < 11.3 )
> 
> TimeFactor = 1.77 ;
> 
> }
> 
> else
> 
> {
> 
> if ( CurrentTime > 11.3 AND CurrentTime < 12.0 )
> 
> TimeFactor = 1.69 ;
> 
> }
> 
> else
> 
> {
> 
> if ( CurrentTime > 12.0 AND CurrentTime < 12.3 )
> 
> TimeFactor = 1.62 ;
> 
> }
> 
> else
> 
> {
> 
> if ( CurrentTime > 12.3 AND CurrentTime < 13.0 )
> 
> TimeFactor = 1.53 ;
> 
> }
> 
> else
> 
> {
> 
> if ( CurrentTime > 13.0 AND CurrentTime < 13.3 )
> 
> TimeFactor = 1.46 ;
> 
> }
> 
> else
> 
> {
> 
> if ( CurrentTime > 13.3 AND CurrentTime < 14.0 )
> 
> TimeFactor = 1.39 ;
> 
> } 
> 
> else
> 
> {
> 
> if ( CurrentTime > 14.0 AND CurrentTime < 14.3 )
> 
> TimeFactor = 1.31 ;
> 
> }
> 
> else
> 
> {
> 
> if ( CurrentTime > 14.3 AND CurrentTime < 15.0 )
> 
> TimeFactor = 1.23 ;
> 
> }
> 
> else
> 
> {
> 
> if ( CurrentTime > 15.0 AND CurrentTime < 15.3 )
> 
> TimeFactor = 1.15 ;
> 
> }
> 
> else
> 
> {
> 
> if ( CurrentTime > 15.3 AND CurrentTime < 16.0 )
> 
> TimeFactor = 1.08 ;
> 
> }
> 
> else
> 
> TimeFactor = 1 ;
> 
> 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 the Yahoo! Terms of Service. 


-- 
Cheers
Graham
http://e-wire.net.au/~eb_kavan/


------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/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/