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

[amibroker] Re: if else and include



PureBytes Links

Trading Reference Links

hello Tomasz,

Sorry to bore you, but as you wrote in message 82567 below,
I put braces for include conditions. But I get always an error.
Choice=1;
if(Choice==1)
{
#include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long afl.afl"
}
else
{
#include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long 
afl_Var.afl"
}

Q?, Do you think the reason could be the varset, varget variable , 
because they have the same name in each include function?

the end of code is
MyAppplyStop
(BuyCond,Entryprice,Exitprice,Stoploss,Stoptrail,Stopprofit,Exit);

Plot(VarGet("sellpr"),"",colorYellow,1);
Plot(VarGet("Trailpr"),"",colorGreen,1);
Plot(VarGet("StopLosspr"),"",colorRed,1);
Plot(VarGet("Targetpr"),"",colorBlue,1);

stephane



In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello,
> 
> Since #include is pre-processor command, files are included
> BEFORE execution, so both files are included anyway.
> Later on appropriate part (depending on condition) is executed.
> Also since included files may contain more than one line you should 
use
> { } braces:
> 
> if(Choice==1)
> {
> #include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long 
afl.afl" 
> }
> else
> {
> #include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long 
afl_Var.afl" 
> }
> 
> Also since #include is pre-processor command and not a statement so 
semicolon is not needed
> 
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Stephane Carrasset" <s.carrasset@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, June 02, 2005 3:02 PM
> Subject: [amibroker] if else and include
> 
> 
> > Hello, have you a tip to switch between differents #include ???
> > for ex below
> > 
> > Choice=Param("include",0,0,10,1);
> > #pragma nocache
> > if(Choice==1)
> > #include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long 
afl.afl" ;
> > else
> > #include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long 
> > afl_Var.afl" ;
> > 
> > Stephane
> > 
> > 
> > 
> > 
> > 
> > 
> > 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
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/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/