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

[amibroker] Re: AmiBroker 4.31.0 BETA Examples



PureBytes Links

Trading Reference Links

I do not have access to AB now, but I guess this is a way to do it.




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


{


   if (H[i] > H[i - 1])


   {


      y[i] = H[i];


   }


   else


   {


      y[i] = L[i];


   }


}




here y[0] is undefined




I guess we are so used to the AB efficient way of array processing 
that we forget how to process individual elements now.




Thomas




--- In amibroker@xxxxxxxxxxxxxxx, "dingo" <dingo@xxxx> wrote:


> My bad - I didn't go back and look a Jason's original message 
closely


> enough.


>  


> d


> 


> -----Original Message-----


> From: dingo [mailto:dingo@x...] 


> Sent: Wednesday, April 16, 2003 1:42 PM


> To: amibroker@xxxxxxxxxxxxxxx


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


> 


> 


> Didn't you mean it to be:


>  


> if (H > Ref(H,-1))


>       {X = H;}


> else


>       {X = L;}


> 


> I didn't try it just noticed the above.


>  


> d


> 


> -----Original Message-----


> From: bluesinvestor [mailto:investor@x...] 


> Sent: Wednesday, April 16, 2003 1:39 PM


> To: amibroker@xxxxxxxxxxxxxxx


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


> 


> 


> Hmm ... at first glance I would have thought it would be this:


> 


> x = IIf(H > Ref(H,-1), H, L);   


> 


> if (H > Ref(H,-1))


>       {y = H;}


> else


>       {y = L;}


> 


> Filter=C>0;


> AddColumn(H,"H");


> AddColumn(L,"L");


> AddColumn(x,"X");


> AddColumn(y,"Y");


> 


> But after running an exploration the results are not the same ... 
not


> sure what is wrong?


> 


> Peter


> 


> -----Original Message-----


> From: Jayson [mailto:jcasavant@x...] 


> Sent: Wednesday, April 16, 2003 1:26 PM


> To: amibroker@xxxxxxxxxxxxxxx


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


> 


> Anyone, 


>  


> Ok, a very simple example.....


>  


> x=IIf (H >Ref(H,-1),H,L);   this would result in a line touching 
either


> the h or low of each bar based on the condition.


> if (H >Ref(H,-1))


> y = H;


> else


> y =L;


> Plot(y,"HL",colorYellow,1);


> Plot(C,"",4,styleCandle);


>  


> rather than evaluating the condition on a bar by bar basis this 
looks to


> lastvalue(h) to determine Y for the whole chart. How would I use the


> if/else syntax to copy IFF?


>  


> Jayson 


> -----Original Message-----


> From: bluesinvestor [mailto:investor@x...]


> Sent: Wednesday, April 16, 2003 11:00 AM


> To: amibroker@xxxxxxxxxxxxxxx


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


> Actually let me clarify something:


> condition expression= i<barcount;         means do the loop as long 
as


> i< the current barcount (like cum(1))?? YES


> this would actually be something like do the loop as long as 
i<barcount


> where barcount = lastvalue(cum(1))


> 


> Regards,


> Peter


> 


> -----Original Message-----


> From: bluesinvestor [mailto:investor@x...] 


> Sent: Wednesday, April 16, 2003 10:51 AM


> To: amibroker@xxxxxxxxxxxxxxx


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


> 


> Hello Jayson,


> 


> myema[ 0 ] = close [0];


> 


> Amibroker uses zero based arrays meaning that the first record in an


> array is at the 0 position.  Basically this just gives a value to 
the


> first myema array.  The zero position is the first data record of 
the


> close array.


> 


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


> init-expression= i=1;          means we start the loop with i=1? YES


> condition expression= i<barcount;         means do the loop as long 
as


> i< the current barcount (like cum(1))?? YES


> loop expression= i++     means i+i+i  ??????????  basically this 
just


> means i = i + 1


> 


> Hope this helps,


> Peter


> 


> -----Original Message-----


> From: Jayson [mailto:jcasavant@x...] 


> Sent: Wednesday, April 16, 2003 10:35 AM


> To: amibroker@xxxxxxxxxxxxxxx


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


> 


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


> I described in:


>  


> http://groups.yahoo.com/group/amibroker/message/37591


> <http://groups.yahoo.com/group/amibroker/message/37591 >   "


>  


>  


> Well, almost all........ 


>  


> Tomasz or any one smarter than me,


>  


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


>  


>  


> This example illustrates the for statement: 


>  


> myema[ 0 ] = Close[ 0 ];


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


> {


> myema[ i ] = 0.1 * Close[ i ] + 0.9 * myema[ i - 1 ];


>  


> myema[ 0 ] = close [0];


>  


> Do I assume this translates to.....     myema today =close today ?? 


> similar to myema=c;??


>  


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


> init-expression= i=1;          means we start the loop with i=1?


> condition expression= i<barcount;         means do the loop as long 
as


> i< the current barcount (like cum(1))??


> loop expression= i++     means i+i+i  ??????????


> Could someone please convert the expression to english? 


>  


> Tia,


>  


> Jayson 


> -----Original Message-----


> From: Tomasz Janeczko [mailto:amibroker@x...]


> Sent: Wednesday, April 16, 2003 5:53 AM


> To: amibroker@xxxxxxxxxxxxxxx


> Subject: Re: [amibroker] AmiBroker 4.31.0 BETA Examples


> Hello,


>  


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


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


>  


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


>  


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


>  


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


> I described in:


>  


> http://groups.yahoo.com/group/amibroker/message/37591


>  


>  


>  


> Best regards,


> Tomasz Janeczko


> amibroker.com


> ----- Original Message ----- 


> From: uenal.mutlu@xxxx 


> To: amibroker@xxxxxxxxxxxxxxx 


> Sent: Wednesday, April 16, 2003 10:39 AM


> Subject: Re: [amibroker] AmiBroker 4.31.0 BETA Examples


> 


> Hi Steve,


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


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


> more stuff than AFL.


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


> Simply ask the people here. 


> UM


>  


> ----- Original Message ----- 


> From: Jayson 


> To: amibroker@xxxxxxxxxxxxxxx 


> Sent: Wednesday, April 16, 2003 6:50 AM


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


> 


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


>  


> Regards,


>  


> Jayson 


> -----Original Message-----


> From: Steve Dugas [mailto:sjdugas@x...]


> Sent: Tuesday, April 15, 2003 11:22 PM


> To: amibroker@xxxxxxxxxxxxxxx


> Subject: Re: [amibroker] AmiBroker 4.31.0 BETA Examples


> Hi Jayson,


>  


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


> )


>  


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


>  


> Steve


>  


> ----- Original Message ----- 


> From: Jayson 


> To: amibroker@xxxxxxxxxxxxxxx 


> Sent: Monday, April 14, 2003 10:01 AM


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


> 


> Thank you Tomasz. I have obviously gone from being fairly high on 
the


> learning curve to Newbie in just one week end :(


>  


> 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 :))


>  


> Jayson 


> -----Original Message-----


> From: Tomasz Janeczko [mailto:amibroker@x...]


> Sent: Monday, April 14, 2003 3:54 AM


> To: amibroker@xxxxxxxxxxxxxxx


> Subject: Re: [amibroker] AmiBroker 4.31.0 BETA Examples


> Hello,


>  


> While IIF works on ARRAY,


>  


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


>  


> Therefore you should write either


>  


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


>  


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


>  


> or iterate:


>  


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


> {


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


>        a1[ i ] = 1;


>    else


>        a1[ i ] = 0;


> }


>  


>  


> It is important to understand that IIF is a FUNCTION that works on


> arrays,


> while if/else is control flow STATEMENT.


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


> Control flow statement changes program flow.


>  


> This is fundamental difference.


>  


> Best regards,


> Tomasz Janeczko


> amibroker.com


> ----- Original Message ----- 


> From: Jayson 


> To: amibroker@xxxxxxxxxxxxxxx 


> Sent: Monday, April 14, 2003 7:55 AM


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


> 


> Steve,


> Your example makes sense yet does not seem to work for me. Else 
seems to


> be ignored . Using the IIF this would simply be ......


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


> input appreciated..


> jayson


>  


> 


>  


>  


> Jayson 


> -----Original Message-----


> From: Steve Dugas [mailto:sjdugas@x...]


> Sent: Sunday, April 13, 2003 11:25 AM


> To: amibroker@xxxxxxxxxxxxxxx


> Subject: Re: [amibroker] AmiBroker 4.31.0 BETA Examples


> Hi Ken,


>  


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


>  


> For (SecondBar to LastBar)


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


>     MyArray = 1


>   Else


>     MyArray = 0


> Plot MyArray


>  


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


>  


> Steve


>  


> ----- Original Message ----- 


> From: Tomasz Janeczko 


> To: amibroker@xxxxxxxxxxxxxxx 


> Sent: Sunday, April 13, 2003 10:39 AM


> Subject: Re: [amibroker] AmiBroker 4.31.0 BETA Examples


> 


> Ken,


>  


> Very nice story :-)


>  


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


> that I have rewritten from JScript version


> (http://www.amibroker.com/library/detail.php?id=242)


>  


>  


> Best regards,


> Tomasz Janeczko


> amibroker.com


> ----- Original Message ----- 


> From: "Ken Close" <closeks@xxxx>


> To: <amibroker@xxxxxxxxxxxxxxx>


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


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


> 


> > 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@x...] 


> > Sent: Sunday, April 13, 2003 9:47 AM


> > To: 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


> 


> 


> Send BUG REPORTS to bugs@xxxx


> Send SUGGESTIONS to suggest@xxxx


> -----------------------------------------


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


> 


> 


> Send BUG REPORTS to bugs@xxxx


> Send SUGGESTIONS to suggest@xxxx


> -----------------------------------------


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


> 


> 


> Send BUG REPORTS to bugs@xxxx


> Send SUGGESTIONS to suggest@xxxx


> -----------------------------------------


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


> 


> 


> 


> Send BUG REPORTS to bugs@xxxx


> Send SUGGESTIONS to suggest@xxxx


> -----------------------------------------


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


> 


> 


> 


> Send BUG REPORTS to bugs@xxxx


> Send SUGGESTIONS to suggest@xxxx


> -----------------------------------------


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


> 


> 


> Yahoo! Groups Sponsor


> 


> 


> 


> Send BUG REPORTS to bugs@xxxx


> Send SUGGESTIONS to suggest@xxxx


> -----------------------------------------


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


> 


> 


> 


> Send BUG REPORTS to bugs@xxxx


> Send SUGGESTIONS to suggest@xxxx


> -----------------------------------------


> 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


> <http://docs.yahoo.com/info/terms/> . 


> 


> 


> 


> Yahoo! Groups Sponsor	


>  


> <http://us.ard.yahoo.com/M=249982.3083889.4452939.
1728375/D=egroupweb/S=


> 1705632198:HM/A=1524963/R=0/*http://hits.411web.
com/cgi-bin/autoredir?ca


> mp=556&lineid=3083889&prop=egroupweb&pos=HM> 	


>  


> <http://us.adserver.yahoo.com/l?M=249982.3083889.4452939.
1728375/D=egrou


> pmail/S=:HM/A=1524963/rand=791747473> 	


> 


> Send BUG REPORTS to bugs@xxxx


> Send SUGGESTIONS to suggest@xxxx


> -----------------------------------------


> 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


> <http://docs.yahoo.com/info/terms/> .



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/yMx78A/fNtFAA/i5gGAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/