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

RE: [amibroker] AmiBroker 4.31.0 BETA Examples



PureBytes Links

Trading Reference Links










Hello Jayson,

 

<font size=2
color=blue face=Arial>myema<font
size=2 color=blue face=Arial>[<font size=2 color=blue
face=Arial> 0 ] =
close [0];<span
>

 

Amibroker uses zero based arrays meaning
that the first record in an array is at the 0 position.<span
>  Basically this just gives a value to the
first myema array.<span
>  The zero position is the first data
record of the close array.

 

<font size=2
color=blue face="Arial CE">for<font size=2
color=blue face="Arial CE"> (<font size=2 color=blue
face="Arial CE"> init-expression <span
>; <span
>cond-expression ; <span
>loop-expression ) statement <font
size=2 face="Courier New">

<font size=2
color=blue face="Arial CE">init-expression<font
size=2 color=blue face="Arial CE">= i=1;         
<span
>means we start the
loop with i=1? <font
size=2 color=red face="Arial CE">YES<span
>

<font size=2
color=blue face="Arial CE">condition<font size=2
color=blue face="Arial CE"> expression= i<barcount;        
<span
>means do the loop as
long as i< the current barcount
(like cum(1))?? <font size=2 color=red
face="Arial CE">YES<span
>

<font size=2
color=blue face="Arial CE">loop<font size=2
color=blue face="Arial CE"> expression= i<font
face="Times New Roman">++    
<span
>means <span
class=SpellE>i+i+i  ?????????? <span
> <font size=2
color=red face="Arial CE">basically<font size=2
color=red face="Arial CE"> this just means i = i
+ 1

<span
> 

Hope this helps,

Peter

 

<span
>-----Original Message-----
From: Jayson
[mailto:jcasavant@xxxxxxxxxxxx] 
Sent<span
>: <st1:date Month="4" Day="16"
Year="2003">Wednesday, April 16, 2003<font size=2
face=Tahoma> <st1:time
Hour="10" Minute="35">10:35 AM<span
>
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] AmiBroker
4.31.0 BETA Examples

<span
> 



<span
>"All you really need
to know about new features in AFL<span
> 



<span
>I described in:<font
color=blue face=Arial>





<span
> <font
color=blue face=Arial>





<span
><a
href=""><span
>http://groups.yahoo.com/group/amibroker/message/37591<font
size=2 color=blue face=Arial>  "<span
>





<span
> 





<span
> 





<span
>Well, almost all........ <font
color=blue face=Arial>





<span
> 







<span
>Tomasz or any one smarter
than me,





<span
> 





<span
>Examples certainly help.
But I am still a bit lost.... from the post....





<span
> 





<span
> 





<span
>This example illustrates
the for statement: <font
size=2 face="Courier New">
 <font
size=2 face="Courier New">





<font size=2 color=red
face="Courier New">myema[ 0 ] = Close[
0 ];





<font size=2 color=red
face=Arial>for( i =
1; i < BarCount; i++ )<font size=2 color=red
face=Arial>
{
myema[ i ] = 0.1 *
Close[ i ] + 0.9 * myema[ i - 1 ];<font
size=2 face="Courier New">





<span
> 





<font size=2 color=blue
face=Arial>myema[ 0
] = close [0];<span
>





<span
> 





<font size=2 color=blue
face=Arial>Do I
assume this translates to.....     myema today =close today
??  similar to myema=c;??<font size=2
face="Courier New">





<span
> 





<span
>for
(<span
> <span
>init-expression ; cond-expression
; loop-expression
) statement


<font size=2 color=blue
face="Arial CE">init-expression=
i=1;          <font
size=2 color=blue face="Arial CE">means we start the loop with i=1?<font
size=2 face="Courier New">

<font size=2 color=blue
face="Arial CE">condition expression=
i<barcount;         <font
size=2 color=blue face="Arial CE">means do the loop as long as i< the current barcount
(like cum(1))??<span
>

<font size=2 color=blue
face="Arial CE">loop expression= i++     <font
size=2 color=blue face="Arial CE">means i+i+i  ??????????<font size=2
face="Courier New">





<font size=2 color=blue
face=Arial>Could
someone please convert the expression to english? <font
size=2 face="Courier New">





<span
> 





<font size=2 color=blue
face="Arial CE">Tia,<span
>





<span
> 





<span
>Jayson 



-----Original Message-----
From: Tomasz Janeczko
[mailto:amibroker@xxxxxx]
Sent: Wednesday, April 16, 2003
5:53 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] AmiBroker
4.31.0 BETA Examples



<span
>Hello,





<span
> 





<span
>I fully agree. for/while/if-else + array access is
covered





<span
>on 3 or 4 pages of any C/C++ book





<span
> 





<span
>So this is actually less than 1% of entire C/C++ book.





<span
> 





<span
>So there is absolutely no need to buy/read C++ book





<span
> 





<span
>All you really need to know about new features in AFL





<span
>I described in:





<span
> 





<span
><a
href="">http://groups.yahoo.com/group/amibroker/message/37591





<span
> 





<span
> 





<span
> 





<span
>Best regards,
Tomasz Janeczko
amibroker.com







<span
>----- Original Message ----- 





<font size=2
face=Arial>From:<font
size=2 face=Arial> <a
href="" title="uenal.mutlu@xxxxxxxxxxx">uenal.mutlu@xxxxxxxxxxx






<span
>To:<font
size=2 face=Arial> <a
href="" title="amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx






<span
>Sent:<font
size=2 face=Arial> Wednesday,
April 16, 2003 10:39 AM





<span
>Subject:<font
size=2 face=Arial> Re:
[amibroker] AmiBroker 4.31.0 BETA Examples





<span
> 





<span
>Hi Steve,





<span
>C++ is definitely not required
to program in AFL;







<span
>it would be an overkill! C++
covers maybe 10 times 





<span
>more stuff than AFL.





<span
>The new stuff in AFL is easily
learnt within 2 hours.







<span
>Simply ask the people here. 





<span
>UM





<span
> 







<span
>----- Original Message ----- 





<font size=2
face=Arial>From:<font
size=2 face=Arial> <a
href="" title="jcasavant@xxxxxxxxxxxx">Jayson 





<span
>To:<font
size=2 face=Arial> <a
href="" title="amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx






<span
>Sent:<font
size=2 face=Arial> Wednesday,
April 16, 2003 6:50 AM





<span
>Subject:<font
size=2 face=Arial> RE:
[amibroker] AmiBroker 4.31.0 BETA Examples





<span
> 





<span
>Thank you Steve, I will
see if I can locate a copy.





<span
> 





<span
>Regards,





<span
> 



<span
>Jayson 

-----Original Message-----
From: Steve Dugas
[mailto:sjdugas@xxxxxxxxx]
Sent: Tuesday, April 15, 2003
11:22 PM
To: <a
href="">amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] AmiBroker
4.31.0 BETA Examples



<span
>Hi Jayson,





<span
> 





<span
>Sorry to offer the help and then not be around to
follow through on it. But, Monday seems to roll around almost every week these
days, and then its off to work again. Better for you though - TJ filled in
for me  : - )





<span
> 





<span
>I'm not sure what kind of book you would like, but
since TJ seems to follow C++ syntax, I can recommend a C++ book that I found to
be very good (pretty big though - over 1000 pages). It is very thorough and
easy to understand - definitely geared for beginners in my opinion. It is
"C++ Primer Plus" by Stephen Prata. I think you could probably just
read up on the items you are interested in if you aren't interested in learning
the whole language. Be careful because it seems that there are a couple of
other C++ books that call themselves "primers", but are
definitely NOT for beginners. Especially stay away from Stanley Lippman's book,
at least until you have some experience (take it from me....please!).





<span
> 





<span
>Steve





<span
> 







<span
>----- Original Message ----- 





<font size=2
face=Arial>From:<font
size=2 face=Arial> <a
href="" title="jcasavant@xxxxxxxxxxxx">Jayson 





<span
>To:<font
size=2 face=Arial> <a
href="" title="amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx






<span
>Sent:<font
size=2 face=Arial> Monday,
April 14, 2003 10:01 AM





<span
>Subject:<font
size=2 face=Arial> RE:
[amibroker] AmiBroker 4.31.0 BETA Examples





<span
> 





<span
>Thank you Tomasz. I have
obviously gone from being fairly high on the learning curve to Newbie in just
one week end :(





<span
> 





<span
>Could you recommend a
beginner level book that may help some of us get up to speed with this new
upgrade? I might as well be reading Japanese , but I don't want to start THAT
thread again :))





<span
> 



<span
>Jayson 

-----Original Message-----
From: Tomasz Janeczko
[mailto:amibroker@xxxxxx]
Sent: Monday, April 14, 2003 3:54
AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] AmiBroker
4.31.0 BETA Examples



<span
>Hello,





<span
> 





<span
>While IIF works on ARRAY,





<span
> 





<span
>if/else works on INDIVIDUAL number/boolean (element of
the array).





<span
> 





<span
>Therefore you should write either





<span
> 





<span
>a1 = IIF( C > Ref( C, -1 ), 1, 0 );





<span
> 





<span
>(or even: a1 = C > Ref( C, -1 );





<span
> 





<span
>or iterate:





<span
> 





<span
>for( i = 1; i < BarCount; i++ )





<span
>{





<span
>   if  ( Close[ i ] > Close[ i - 1 ]
)





<span
>       a1[ i ] = 1;





<span
>   else





<span
>       a1[ i ] = 0;





<span
>}





<span
> 





<span
> 





<span
>It is important to understand that IIF is a FUNCTION
that works on arrays,





<span
>while if/else is control flow STATEMENT.





<span
>Function just evaluates all arguments and returns
value(s)





<span
>Control flow statement changes program flow.





<span
> 





<span
>This is fundamental difference.





<span
> 





<span
>Best regards,
Tomasz Janeczko
amibroker.com







<span
>----- Original Message ----- 





<font size=2
face=Arial>From:<font
size=2 face=Arial> <a
href="" title="jcasavant@xxxxxxxxxxxx">Jayson 





<span
>To:<font
size=2 face=Arial> <a
href="" title="amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx






<span
>Sent:<font
size=2 face=Arial> Monday,
April 14, 2003 7:55 AM





<span
>Subject:<font
size=2 face=Arial> RE:
[amibroker] AmiBroker 4.31.0 BETA Examples





<span
> 





<span
>Steve,





<span
>Your example makes sense
yet does not seem to work for me. Else seems to be ignored . Using the IIF this
would simply be ......





<span
>a1=iif(c>ref(c,-1),1,0); 
I am certainly missing something here.... your input appreciated..





<span
>jayson





<span
> 





<span
><img border=0 width=752
height=638 id="_x0000_i1025" src="gif00218.gif"
align=baseline>





<span
> 





<span
> 



<span
>Jayson 

-----Original Message-----
From: Steve Dugas
[mailto:sjdugas@xxxxxxxxx]
Sent: Sunday, April 13, 2003 11:25
AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] AmiBroker
4.31.0 BETA Examples



<span
>Hi Ken,





<span
> 





<span
>I think the concept of loops and if-then-else is the
same in all languages. I imagine you  could read up on it at
many websites (e.g. - MSDN scripting site). Once you grasp the concept, it is
just a matter of using AFL syntax. You would probably use it mostly for
iterating your arrays if you wanted to do that. Here is a simple pseudo-code -
try coding it in AFL:





<span
> 





<span
>For (SecondBar to LastBar)





<span
>  If (Today's Close > Yesterday's Close)





<span
>    MyArray = 1





<span
>  Else





<span
>    MyArray = 0





<span
>Plot MyArray





<span
> 





<span
>Of course, please feel free to ask for help!





<span
> 





<span
>Steve





<span
> 





<span
>----- Original Message ----- 







<font size=2
face=Arial>From:<font
size=2 face=Arial> <a
href="" title="amibroker@xxxxxx">Tomasz Janeczko 





<span
>To:<font
size=2 face=Arial> <a
href="" title="amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx






<span
>Sent:<font
size=2 face=Arial> Sunday,
April 13, 2003 10:39 AM





<span
>Subject:<font
size=2 face=Arial> Re:
[amibroker] AmiBroker 4.31.0 BETA Examples





<span
> 





<span
>Ken,





<span
> 





<span
>Very nice story :-)





<span
> 





<span
>As per your request, attached is a Parabolic SAR
formula 





<span
>that I have rewritten from JScript version





<span
>(<a
href=""><span
>http://www.amibroker.com/library/detail.php?id=242<font
size=2>)





<span
> 





<span
> 





<span
>Best regards,
Tomasz Janeczko
amibroker.com





<span
>----- Original Message ----- 



<span
>From: "Ken Close" <<a
href="">closeks@xxxxxxxx<font
size=2>>





<span
>To: <<a
href="">amibroker@xxxxxxxxxxxxxxx<span
>>





<span
>Sent: Sunday, April 13, 2003 4:05 PM





<span
>Subject: RE: [amibroker] AmiBroker 4.31.0 BETA
Examples







<span
> 



<span
>> Tomasz:
> 
> As always, you have good sound advice.  However......
> 
> You say, "Here is a fast sports car, very versatile and
powerful.  It
> has 7 forward gears, but if you are a beginner, do not worry....always
> stay in maximum of 4th gear. Plenty of nice driving is possible in 4th
> gear.   Wait until you become more experienced before you try
gears 5,
> 6, and 7."
> 
> I say, "Thank you for providing such a nimble sports car, but I am in
a
> race, and I do not think I can finish even 10th in this race, until I
> get out past 4th gear.  If you or others would just provide some more
> examples of how to use 5th and 6th gear, then I could more confidently
> try them. Maybe even copy your use of them. Then, probably, I will have
> enough experience to try 7th gear on my own."
> 
> More examples is all I am asking for....my objective is not to stay in
> 4th gear.
> 
> Thanks,
> 
> Ken
> 
> -----Original Message-----
> From: Tomasz Janeczko [mailto:amibroker@xxxxxx] 
> Sent: Sunday, April 13, 2003 9:47 AM
> To: <span
>amibroker@xxxxxxxxxxxxxxx
> Subject: Re: [amibroker]
AmiBroker 4.31.0 BETA Examples
> 
> Ken,
> 
> > First, additional kudos to Tomasz for another step-jump in capability
> of
> > Amibroker.
> Thank you.
> 
> > Second, a caution, in marketing terms, of having capability that is
so
> > hard to apply for "non-programmers", beginners, and
non-technical
> types
> > that the extra capability is viewed not as an advantage or benefit,
> but
> > just the opposite.
> 
> The beginners don't really need to jump into deep water right from
> the start as AFL still supports "old-way" of work.
> 
> When you write
> 
> TypicalPrice = (H+L+C) /3;
> 
> it still operates on H, L, C arrays and produces array so no
> looping is needed.
> 
> New features are added as 'extra' stuff and do not
> change the way old statements work.
> 
> > I apologize - but may speak for many hidden lurkers - that I have
just
> > mastered the idea that "every AFL statement only executes
once", but
> now
> > I must scramble to reorient my brain for repeated iterations thru AFL
> > statements.
> 
> See above - you don't need really to write loops if you don't want them.
> All previously written code will execute the same way as before.
> 
> Unless you use a while and/or for loop nothing has really changed.
> 
> So, you don't really need to "re-orient your brain" :-)
> 
> You can view new features as a replacement of JScript/VBScript.
> You may use these new features only when you needed to use
> scripting in previous versions.
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com









<span
>

Send
BUG REPORTS to bugs@xxxxxxxxxxxxx<font size=2
face="Courier New">
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 Yahoo!
Terms of Service. 



<span
>

Send
BUG REPORTS to bugs@xxxxxxxxxxxxx<font size=2
face="Courier New">
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 Yahoo!
Terms of Service. 




<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 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.




Attachment: Description: ""