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

[amibroker] Re: programming 101



PureBytes Links

Trading Reference Links

Sid,
Here is a simple counter

Cond=StochD()>70;
Counter=Cum(Cond);Plot(Counter,"Counter",1,1);

and another, reset counter.

Cond=StochD()>70;
ResetCounter=Cond*BarsSince(NOT(Cond));Plot(ResetCounter,"Reset 
Counter",4,1);

Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, Sidney Kaiser <s9kaiser@xxxx> wrote:
> Still struggling with trying to convert that Tradestation 
script....  ;(
> 
> A few basic elements seem to crop up over and over again.  The 
problem is I 
> am a trader not a programmer, and I spend huge amounts of time 
spinning my 
> wheels trying to generate or adapt code to do fairly simple tasks.  
Here 
> are a couple samples.
> 
> 
> (1)  IF condition then a=b		// trying to use IIF , would 
that be: a = 
> IIF(condition, b, a);  ie: the true condition has a new value 
but ?? on the 
> value to be used for the false condition.
> 
> 
> (2)  IF condition then a=c  	// Where the value for "a" needs to 
persist 
> until it is changed by the program.  Does that involve the use of 
> ValueWhen(condition, c);   and I would think that the condition 
needs to 
> change to a cross  function to pick up the first value where 
condition is 
> true.  Multi part question I guess, but the details are important 
to poor 
> programmers like myself.
> 
> 
> (3)  How do I set up a counter in AFL to keep track of the number 
of 
> occurrences of some condition.
> 	IF condition then increment counter		// Again the 
value of the counter 
> needs to persist until it is used perhaps many bars later and then 
is 
> probably reset.
> 
> TIA
> Sid
> 
> 
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.481 / Virus Database: 277 - Release Date: 5/13/2003


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/aM1XQD/od7FAA/uetFAA/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/