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

Re: [amibroker] short cut keys



PureBytes Links

Trading Reference Links


Ken,
 
1. 
Of course it will not work.
You HAVE TO enclose path in DOUBLE QUOTES !
 
#include "C:\Program 
Files\Amibroker\Common.AFL"
 
Excerpt from the Read 
Me:
 
implemented a *very* basic pre-processor with single command #include that 
allows to include external AFL files into your formula. Syntax:<FONT 
size=5>#include "path\to my file\name path.afl"Note 1: 
include statement need SINGLE backslashes in the path (this is quite the 
opposite to normal AFL stingparsing)
And it has to be written
#include 
 
exactly like this - lowercase. 
 
Non upper case, no #InCluDe .
<FONT 
size=2> 
 
2. As it name says
#include is for including other file into formula being 
currently parsed.
 
Let's say the file1.afl looks like this:
 
//////////// BEGIN 
////////////////////////////////

C1 = Ref( C, -1 );
C2 = Ref( C, -2 );
C3 = Ref( C, -3 );
C4 = Ref( C, -4 );C5 = Ref( C, -5 );
C6 = Ref( C, -6 );
///////// END ///////////////////////////////
 
 
Now main formula looks like this:
 
#include "path to\file1.afl"
 
Plot( ( C1 + C2 + C3 + C4 )/4, "Avg", colorRed );
 
<FONT face="Arial CE" 
size=2>==================================
When AmiBroker parses main formula it sees include statement 
and
in the place where include is used it "pastes" the contents of 
file1.afl and
processes the result (the formula after pre-processing stage : 

this is how AFL engine sees it ):
 

//////////// BEGIN 
////////////////////////////////

C1 = Ref( C, -1 );
C2 = Ref( C, -2 );
C3 = Ref( C, -3 );
C4 = Ref( C, -4 );C5 = Ref( C, -5 );
C6 = Ref( C, -6 );
///////// END 
///////////////////////////////

 
Plot( ( C1 + C2 + C3 + C4 )/4, "Avg", colorRed 
);
 
Best regards,Tomasz 
Janeczkoamibroker.com
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
Ken Close 
To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Saturday, September 28, 20021:24 
PM
Subject: RE: [amibroker] short cut 
keys

<SPAN 
class=490401411-28092002>-CS:
<SPAN 
class=490401411-28092002> 
<FONT 
size=2>>> 
Some of us wanted a call (subroutine) to other afl formulas 
to REDUCE code 
bloat.<<
 
I thought this was how 
#include was supposed to work.  Tell me how the following is not 
correct
 
File: called 
Common.AFL
 
Ready = C > 
EMA(C,21);
Not_Ready = C < 
EMA(C,21);
Go = 
Flip(Ready,Not_Ready);
 
 
New AFL code called 
DoIt.AFL
 
#INCLUDE C:\Program 
Files\Amibroker\Common.AFL
Vol=V>EMA(V,50); // or any 
other common buy condition
Buy = Go AND 
Vol;
Sell = NOT 
Go;
 
 
First 
question:
Does #INCLUDE work like I 
have written it above?  Does it "bring along" the various arrays within 
it to the new, "calling" AFL file?
 
Second question (if 1 is 
yes)
Is this not like a subroutine 
call?
 
Help me understand.  The 
above is what I took from the help paragraph that came with the 
distribution.
 
Thanks,
 
Ken 
 
 
<SPAN 
class=490401411-28092002> 
<SPAN 
class=490401411-28092002> 
<FONT face=Tahoma 
size=2>-----Original Message-----From: CS 
[mailto:csaxe@xxxx]Sent: Saturday, September 28, 2002 12:30 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] 
short cut keys
Dingo,
You can see all the code now. Just cut and paste. 

Forget that #include exists. If you don't know what formula 
coding #include refers to, you shouldn't use it.
 
Some of us wanted a call (subroutine) to other afl formulas 
to REDUCE code 
bloat.
It was getting ridiculous to duplicate the same 
often-used code for its use in every system and its variant.
 
-CS
 
 
----- Original Message ----- 
<BLOCKQUOTE 
>
<DIV 
>From: 
dingo 
To: <A title=amibroker@xxxxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Friday, September 27, 20027:10 
PM
Subject: RE: [amibroker] short cut 
keys

<SPAN 
class=509070402-28092002>Then there's no need for the 
#include?
<SPAN 
class=509070402-28092002> 
<SPAN 
class=509070402-28092002>The best way would be to have a variation toplease 
both crowds..
<SPAN 
class=509070402-28092002> 
So 
you've got an AFL system with several pages of code?  Sounds 
interesting..
<SPAN 
class=509070402-28092002> 
<SPAN 
class=509070402-28092002>dingo
<SPAN 
class=509070402-28092002> 
<SPAN 
class=509070402-28092002><FONT face=Arial color=#0000ff 
size=2><FONT 
size=2><SPAN 
class=509070402-28092002> 
<FONT 
color=#0000ff><SPAN 
class=509070402-28092002> -----Original 
Message-----From: Bob Jagow [mailto:bjagow@xxxx] 
Sent: Friday, September 27, 2002 9:12 PMTo: <A 
href="">amibroker@xxxxxxxxxxxxxxxSubject: 
RE: [amibroker] short cut keys

Different 
strokes, I guess, Dingo.
<FONT color=#0000ff 
size=2> 
I'd have a 
major problem if the #include directive in C [or uses or import or ... in 
other languages] inserted several pages of source 
code!
  If I 
wanted to insert source code, cut and paste would 
suffice.
<FONT color=#0000ff 
size=2> 
<FONT color=#0000ff 
size=2>Bob

<FONT face=Tahoma 
size=2>-----Original Message-----From: dingo 
[mailto:dingo@xxxx]Sent: Friday, September 27, 2002 
4:50 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
[amibroker] short cut keys
<FONT face=Arial color=#0000ff 
size=2>But why wouldn't you want to see what was included? I too believe 
it should call the entirety of the text it points 
to..
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>Just curious, I guess.  Its not like its wasting 
paper..
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>In the future I'd like to see the capablilty of substitution as 
well. Something like:
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>#include "path\to my 
file\name path.afl" 28, 7
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>Where the included text might contain:
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>blah blah blah
<FONT face=Arial color=#0000ff 
size=2>A1=EMA(C,%1)-EMA(C,%2);    //MACDblahblah 
blah
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=7>dingo


<FONT 
face=Tahoma size=2>-----Original Message-----From:Jayson 
[mailto:jcasavant@xxxx] Sent: Friday, September 27, 
2002 7:27 PMTo: 
amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] short cut 
keys
<SPAN 
class=459432423-27092002>Personally I prefer a single line thatcalls 
entire formula as it makes for a cleaner more organized formula. I 
like it the way it is...
 
Jayson 

<FONT face=Tahoma 
size=2>-----Original Message-----From: Ted Chmilar 
[mailto:tchmilar@xxxx]Sent: Friday, September 27, 2002 
7:07 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: 
[amibroker] short cut keys
Dingo,
 
I don't use this feature for thesame 
reason. Difficult to desk check code for conflicting 
statements.
 
Ted

----- Original Message ----- 
<BLOCKQUOTE 
>
<DIV 
>From: 
dingo 

To: <A 
title=amibroker@xxxxxxxxxxxxxxx 
href="">amibroker@xxxxxxxx 

Sent: Friday, September 27, 
2002 2:26 PM
Subject: RE: [amibroker]short 
cut keys

<FONT face=Arial color=#0000ff 
size=2>Tomasz,
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>When I tried to use it it doesn't actually show the included 
lines in the formula so that when the report is shown on the 
#include line is there. Do you have plans to actually show the 
included lines?
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>Something like:
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>#include "path\to my file\name 
path.afl"
## Line 
1
## Line 
2
<FONT face=Arial 
size=2>.
<FONT face=Arial 
size=2>.
## Last 
Line
<FONT face=Arial 
size=2> 
<FONT face=Arial 
size=2>dingo


<DIV class=OutlookMessageHeader lang=en-us dir=ltr 
align=left>-----Original 
Message-----From: Tomasz Janeczko 
[mailto:amibroker@xxxx] Sent: Friday, September 27, 
2002 12:46 PMTo: 
amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] short 
cut keys
Ken,
 
When using #include please note that if you 
specify the full path
it should have single backslashes (this is 
different from regular AFL code that
needs double backslashes).
 
So your sample #include statement should look 
like this:
 
#include "C:\Program 
Files\AmiBroker\AFL\MyFile.afl"
 
 
Best regards,Tomasz 
Janeczkoamibroker.comPost 
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. 
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.