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

[amibroker] Re: if else and include



PureBytes Links

Trading Reference Links

Ok Tomasz, I understand, but it is the copy and paste in yahoo that 
has truncated the code line.
Yahoo is guilty !!!
the code in my formula Editor is NOT broken
so the problem is still there...

even if i give a different name for differents function in each 
include

stephane




> Stephane,
> 
> Please read carefully what I wrote 
> "error is that the #include line was wrapped "
> 
> "line wrap" in English means that original SINGLE line is BROKEN 
into
> TWO lines as in your code:
> 
> #include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long  <<<< 
HERE LINE IS BROKEN
> afl_0.afl" ;
> 
> 
> #include must be IN SINGLE PHYSICAL LINE.
> 
> it should be written as:
> 
> #include "filename"
> 
> and NOT as:
> 
> #include "file
> name"
> 
> Do you see the difference? This is what I mean with line must not 
be wrapped.
> 
> This is completely different from placing #include inside
> { } braces.
> 
> It means
> 
> if( condition )
> {
> #include "file one.afl"
> }
> else
> { 
> #include "file two.afl"
> }
> 
> This is #include properly placed inside conditional statement.
> 
> Your code is different because it has broken lines:
> 
> if( condition )
> {
> #include "file 
> one.afl"
> }
> else
> { 
> #include "file 
> two.afl"
> }
> 
> Which is of course wrong (file name broken into two lines)
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Stephane Carrasset" <s.carrasset@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Saturday, June 04, 2005 2:31 PM
> Subject: [amibroker] Re: if else and include
> 
> 
> >I don't know exactly what I do wrong with if else and #include,
> > you told me to put braces between includes and later to do not 
> > wrapped them...?
> > Never mind
> > 
> > The solution for me is to put all #include at the top of the afl 
> > formula, and loops betwween differents functions,
> > the CONDITION is that the name of the differents function must be 
> > differents in each include function.
> > 
> > for ex
> > #pragma nocache
> > #include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long 
> > afl_0.afl" ;
> > #include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long 
> > afl_1.afl" ;
> > 
> > Choice=Param("Choice",0,0,10,1);
> > if(Choice==1)
> > MyAppplyStop_0
> > (BuyCond,Entryprice,Exitprice,Stoploss,Stoptrail,Stopprofit,Exit);
> > else
> > MyAppplyStop_1
> > (BuyCond,Entryprice,Exitprice,Stoploss,Stoptrail,Stopprofit,Exit);
> > 
> > Stephane
> > 
> > 
> > 
> > 
> > 
> > 
> >> MessageNo, #include statements don't need double backslashes.
> >> The only error is that the #include line was wrapped in 
Stephane's 
> > code.
> >> #include lines MUST NOT be wrapped.
> >> 
> >> Best regards,
> >> Tomasz Janeczko
> >> amibroker.com
> >>   ----- Original Message ----- 
> >>   From: Paul Ho 
> >>   To: amibroker@xxxxxxxxxxxxxxx 
> >>   Sent: Saturday, June 04, 2005 4:03 AM
> >>   Subject: RE: [amibroker] Re: if else and include
> >> 
> >> 
> >>   "#include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long 
> > afl.afl"
> >> 
> >>   wouldnt be  #include "D:\\Program 
> > Files\\AmiBroker\\Formulas\\Custom\\Rem_Long afl.afl"
> >> 
> >> 
> >> 
> >>   Paul Ho
> >> 
> >>     -----Original Message-----
> >>     From: amibroker@xxxxxxxxxxxxxxx 
> > [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Stephane Carrasset
> >>     Sent: Saturday, 4 June 2005 7:51 AM
> >>     To: amibroker@xxxxxxxxxxxxxxx
> >>     Subject: [amibroker] Re: if else and include
> >> 
> >> 
> >>     Tomasz,
> >> 
> >>     below is exactly the code, with braces as you wrote it.
> >>     but it returns an error.
> >> 
> >>     Stephane
> >> 
> >>     Choice=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"
> >>     }
> >> 
> >>     Setup=Cross( MFI(3),0);
> >>     BuyCond= Ref(Setup,-1);
> >>     Entryprice=O;
> >>     Exitprice=Low;// or Close
> >>     Stoploss=LLV(L,3)-0.75*ATR(10) ;
> >>     Stoptrail=LLV(L,3)-1.75*ATR(10);
> >>     Exit=0;
> >>     Pf=7;
> >>     Stopprofit=(1+(Pf/100))*Entryprice;
> >> 
> >>     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,
> >>     > 
> >>     > My idea DOES work, I ensure you, provided you put the 
braces
> >>     > correctly (as I shown).
> >>     > 
> >>     > Best regards,
> >>     > Tomasz Janeczko
> >>     > amibroker.com
> >>     > ----- Original Message ----- 
> >>     > From: "Stephane Carrasset" <s.carrasset@xxxx>
> >>     > To: <amibroker@xxxxxxxxxxxxxxx>
> >>     > Sent: Thursday, June 02, 2005 10:18 PM
> >>     > Subject: [amibroker] Re: if else and include
> >>     > 
> >>     > 
> >>     > > Hello,
> >>     > > 
> >>     > > it seems that your idea does not work...
> >>     > > But the tips given by Fred tonetti is good
> >>     > > all functions in one include and call differents 
functions, 
> > ex. 
> >>     below
> >>     > > 
> >>     > > stephane
> >>     > > 
> >>     > > 
> >>     > > #pragma nocache
> >>     > > #include "D:\Program 
> > Files\AmiBroker\Formulas\Custom\Rem_Long 
> >>     > > afl_Var.afl"
> >>     > > 
> >>     > > Choice=Param("Stop",0,0,10,1);
> >>     > > if(Choice==1)
> >>     > > {
> >>     > > MyAppplyStop
> >>     > > 
> > (BuyCond,Entryprice,Exitprice,Stoploss,Stoptrail,Stopprofit,Exit);
> >>     > > }
> >>     > > else
> >>     > > {
> >>     > > MyAppplyStop_Var
> >>     > > 
> > (BuyCond,Entryprice,Exitprice,Stoploss,Stoptrail,Stopprofit,Exit);
> >>     > > }
> >>     > >> 
> >>     > >> 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
> >>     > >> > 
> >>     > >> > 
> >>     > >> > 
> >>     > >> > 
> >>     > >> > 
> >>     > >> > 
> >>     > >> > 
> >>     > >> >
> >>     > > 
> >>     > > 
> >>     > > 
> >>     > > 
> >>     > > 
> >>     > > 
> >>     > > 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
> >> 
> >> 
> >> 
> >> 
> >> 
> >>     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
> >> 
> >>       a.. To visit your group on the web, go to:
> >>       http://groups.yahoo.com/group/amibroker/
> >>         
> >>       b.. To unsubscribe from this group, send an email to:
> >>       amibroker-unsubscribe@xxxxxxxxxxxxxxx
> >>         
> >>       c.. Your use of Yahoo! Groups is subject to the Yahoo! 
Terms 
> > of Service.
> > 
> > 
> > 
> > 
> > 
> > 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/