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

[amibroker] Eod exit



PureBytes Links

Trading Reference Links


I'm trying to devise a way to exit long 
positions at the closing price of the day. This would be as an alternate tothe 
normal sell conditions, should a position be in place at the end of day. I'm 
using 1minute charts and the total number of minutes per day is not 
fixed.
 
This is my first day coding in AFL. You 
can ignore my clumsy attempt at solving this and just tell me how to do it if 
you prefer. But just so you know I've made an effort, here's how I've been 
trying to accomplish this:
 
Say varS1 represents the normal sell 
conditions, and varEod represents end of day sell condition. I'm thinking the 
likely statement to accomplish what I want is     Sell 
= varS1 OR varEod
 
It's the eod condition that has me 
stumped. I tried to use DATENUM(), but I don't understand what goes in the 
parenthesis. If I could code that DATENUM of the next bar is > DATENUM of the 
current bar, I'd be home free.  AFL would automatically use the correct 
price of the last bar of the day, I think.
 
As an aside, this exercise brings up the 
question of how to refer to dates or times of the price bars in AFL. I 
haven't seen reference to these variables similar to the OHLC V OI reserved 
variables. 
 
Thanks for the help.
 
Esteban