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

[amibroker] Code Question: Is there any way to accomplish this task?



PureBytes Links

Trading Reference Links

The code below is run on a watchlist of the DJ-30.

When an exploration is run, AFL apparantly zeros out every variable 
when it finishes with one symbol and starts with another. When AA 
(Alcoa) is finished the variable count1 is reset to 0.
I need to find a way to make a variable hold a value to the end of 
the whole run. In the code below, after the run is complete the 
variables count1 and percent1 in the AddColumn statements reflect 
the values applicable to the last ticker only. I need a way to get a 
cummulation of variables for all of the symbols together.  
Has anyone got any ideas? Could ths be accomplished with the 
StaticVarSet function? I don't know a lot of code.

lastSymbol="XOM";
k=	95;	
S=StochK(14,3)>k-2.5 AND StochK(14,3)< k+2.5;
count1=Cum(IIf(s,1,0));
percent1=Cum(IIf(s,Ref(C,5)/C-1,0));

Filter=Name()==LastSymbol;
 
AddColumn( BarCount, "Barcount", 1.0 );
AddColumn( count1, "count1", 1.4 );
AddColumn( percent1, "percent1", 1.4 );
AddColumn( percent1/count1, "percent change", 1.4 );


On another note, when the two lines of code are changed the result 
shows how the average % change for each stock 4 days later when the 
14 day stochanstic is at a certain level. (in this case + or - 2.5 
from 95. 

k=	95;	
S=StochK(14,3)>k-2.5 AND StochK(14,3)< k+2.5;
count1=Cum(IIf(s,1,0));
percent1=Cum(IIf(s,Ref(C,5)/C-1,0));

Filter=1; 

AddColumn( BarCount, "Barcount", 1.0 );
AddColumn( count1, "count1", 1.4 );
AddColumn( percent1, "percent1", 1.4 );
AddColumn( percent1/count1, "percent change", 1.4 );



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
 
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:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto: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/