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

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



PureBytes Links

Trading Reference Links

Graham,
After Terry's response I noticed the way "else if" was used in the CandleFunctionsInclude.afl from the files section and decided to use it.

I will use this exploration after I get a hit when I run my autonomous scan. Is there any way to get this to work with the "scan"? I would then see my Estimated Volume results autonomously without having to run an additional "Explore".

It seems to work as I intended. Any way to improve the execution?
Thanks, Scott
 

---------8<----------------------------------------------------------------------------------------------------------

Filter = Buy ;

time = Now(4) * .0001 ;

if( time > 10.0 AND time < 16.00 ) { CurrentTime = time ; }
else { CurrentTime = 1 ; }

if ( CurrentTime > 10.0 AND CurrentTime < 10.3 ) { TimeFactor = 13.0 ; }
else if ( CurrentTime > 10.3 AND CurrentTime < 11.0 ) { TimeFactor = 6.50 ; }
else if ( CurrentTime > 11.0 AND CurrentTime < 11.3 ) { TimeFactor = 4.33 ; }
else if ( CurrentTime > 11.3 AND CurrentTime < 12.0 ) { TimeFactor = 3.25 ; }
else if ( CurrentTime > 12.0 AND CurrentTime < 12.3 ) { TimeFactor = 2.60 ; }
else if ( CurrentTime > 12.3 AND CurrentTime < 13.0 ) { TimeFactor = 2.17 ; }
else if ( CurrentTime > 13.0 AND CurrentTime < 13.3 ) { TimeFactor = 1.86 ; }
else if ( CurrentTime > 13.3 AND CurrentTime < 14.0 ) { TimeFactor = 1.63 ; }
else if ( CurrentTime > 14.0 AND CurrentTime < 14.3 ) { TimeFactor = 1.44 ; }
else if ( CurrentTime > 14.3 AND CurrentTime < 15.0 ) { TimeFactor = 1.40 ; }
else if ( CurrentTime > 15.0 AND CurrentTime < 15.3 ) { TimeFactor = 1.18 ; }
else if ( CurrentTime > 15.3 AND CurrentTime < 16.0 ) { TimeFactor = 1.08 ; }
else TimeFactor = 1 ;

text_color = IIf( TimeFactor * ( V / MA(V,7) ) > 0.99 , colorGreen, colorRed );
bkgrnd_color =
IIf( TimeFactor * ( V / MA(V,7) ) > 1.99 , colorBlue, colorDefault );
AddColumn
( C , "Close" ) ;
AddColumn( V , "Volume" ) ;
AddColumn( TimeFactor * ( V / MA(V,7)) , "Est Vol vs MA" , 1.2 , text_color , bkgrnd_color ) ;

--------------8<-------------------------------------------------------------------------------------------

 



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