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

RE: [amibroker] #define directive ?



PureBytes Links

Trading Reference Links









I may be missing your objective, but can’t you already
do that in AFL

Then you just need to call it up. I have called it EmaExp
which just needs to be referenced where you want

 

Example



<font size=2 color=black
face="Courier New"> 

<font size=2 color=black
face="Courier New">security = <span
lang=EN-AU >C<font
color=black face="Courier New">;

<font size=2 color=black
face="Courier New">security45ema = <span
lang=EN-AU >EMA<font
color=black face="Courier New">(<span
lang=EN-AU >C<font
color=black face="Courier New">,<span
lang=EN-AU >45<font
color=black face="Courier New">);

<font size=2 color=black
face="Courier New">EmaExp = <span
lang=EN-AU >WriteIf<font
color=black face="Courier New"> ( <span
lang=EN-AU >LastValue<font
color=black face="Courier New">(security) > <span
lang=EN-AU >LastValue<font
color=black face="Courier New">(security45ema), <font color=darkred
face="Courier New">"Price is above it 45 ema"<font
color=black face="Courier New">,<span
lang=EN-AU >"Price is not
above 45 ema"<span
lang=EN-AU >);

<font size=2 color=red
face="Courier New"> 

<font size=2 color=red
face="Courier New">Filter<span
lang=EN-AU >=<font
color=fuchsia face="Courier New">1<span
lang=EN-AU >;

<span
lang=EN-AU >AddTextColumn<font
color=black face="Courier New">(EMAexp,<span
lang=EN-AU >"exp"<font
color=black face="Courier New">);

<span
lang=EN-AU > 

<span
lang=EN-AU > 

<font size=3 color=teal
face="Times New Roman">Cheers,
Graham

<font size=2
color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/ASXShareTrading

<font size=2
color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/FMSAustralia



<span
>-----Original Message-----
From: Salil V Gangal
[mailto:salil_gangal@xxxxxxxxx] 
Sent: Monday, 19 May 2003 11:51 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] #define
directive ?

<font size=2
face="Times New Roman"> 



<font size=2
color="#ff4040" face="Times New Roman">Graham,





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">The #define directive
allows one to write in short-hand rather than writing  long
code.  The compiler substiututes the short-hand into its full form before
executing it.





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">As an example, say if one
is writing the following again and again and again in the program ==>





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">WriteIf (
LastValue(security) > LastValue(security45ema), "Price is above it
45 ema","Price is not above 45 ema");





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">Then one can just define
the short-hand 





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">#define
WRITE45_EMA   WriteIf ( LastValue(security) >
LastValue(security45ema), "Price is above it 45 ema","Price
is not above 45 ema");





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">And the within the program
then one needs to write just WRITE45_EMA
which will mean writing whole of 'WriteIf (
LastValue(security) > LastValue(security45ema), "Price is above it
45 ema","Price is not above 45 ema");' ! 





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">This comes in very handy
when one has very large code.  It cuts down typing a lot.  Languages
like C, C++ support #define.  Since AFL already supports #include, which
is similar to C, C++, I am wondering if there is plan to add #define for
AFL also ...





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">Regards, 



<font size=2
color="#4040ff" face="Times New Roman">- Salil V Gangal 

Graham
<gkavanagh@xxxxxxxxxxxxx> wrote:







<span
>What is #define represent ?

<font size=2
face="Times New Roman"> 



<font
size=3 color=teal face="Times New Roman">Cheers,
Graham

<font
size=2 color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/ASXShareTrading

<font
size=2 color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/FMSAustralia



<span
>-----Original Message-----
From: Salil V Gangal
[mailto:salil_gangal@xxxxxxxxx] 
Sent: Monday, 19 May 2003 9:40 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] #define
directive ?

<font size=2
face="Times New Roman"> 



<font size=2
color="#ff4040" face="Times New Roman">Tomasz,





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">There is #include in AFL,
but AFAIK there is no #define in AFL.





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">Are there any plans to
add #define as well ?  With ever increasing length of AFL scripts, I'm
sure that #define will cut-down lot of typing while writing AFL scripts.





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman"> 







<font size=2
color="#ff4040" face="Times New Roman">Friends,







<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">Are there any
work-arounds for #define in AFL ?





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">Regards,





<font size=2
face="Times New Roman">- <font
color="#4040ff" face="Times New Roman">Salil V Gangal 





<font
size=2 face="Times New Roman">







Do
you Yahoo!?
The New
Yahoo! Search - Faster. Easier. Bingo. 

<font size=2
face="Courier New">Send BUG REPORTS to
bugs@xxxxxxxxxxxxx<span
>
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx 
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Your use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.


<font size=2
face="Times New Roman"> 

<font size=2
face="Times New Roman">

Send BUG REPORTS to
bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx 
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Your use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.




<font
size=2 face="Times New Roman">





<font size=2
face="Times New Roman">Do you Yahoo!?
The New
Yahoo! Search - Faster. Easier. Bingo. 



Send
BUG REPORTS to bugs@xxxxxxxxxxxxx<span
>
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx 
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Your use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.











Yahoo! Groups Sponsor












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 the Yahoo! Terms of Service.