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

[amibroker] Backwards loop


  • Date: Tue, 12 Jan 2010 12:25:20 -0000
  • From: "angio" <angio1967@xxxxxxxx>
  • Subject: [amibroker] Backwards loop

PureBytes Links

Trading Reference Links

hello guys, 
can someone help me to write this loop for an indicator, there are many days that I try but I can't do !!!

- the beginning of the loop is the bar before today 
- the loop length is the variable PER (for example 10)

*** Then the loop works from BAR -1 to BAR -10 ***

PER=10;

XXX= my expression;

DIFF=0; set variable to 0
CONT=0; set variable to 0 

in the loop: 

If XXX > DIFF 
then DIFF = XXX 
and CONT assumes the number of backwards bar in the loop

for example:

BAR -1    XXX > 0       cont = 1  
BAR -2    XXX > diff    cont = 2  
BAR -3    XXX > diff    cont = 3  
BAR -4    XXX > diff    cont = 4  
BAR -5    XXX > diff    cont = 5  
BAR -6    XXX > diff    cont = 6  
BAR -7    XXX < diff    cont = 6   break loop, CONT assumes 6
BAR -8    XXX < diff    cont = 6   
BAR -9    XXX > diff    cont = 6 
BAR -10   XXX > diff    cont = 6

The main problem is how to set the beginning of the loop and how to assign values to the arrays earlier in reverse from the usual.

I hope I was clear, thanks for the reply.
Angio













------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/