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

Re: Code help with beginning of day strategy



PureBytes Links

Trading Reference Links

>Help!  Been trying to figure this one out for some time.  What I'm trying to do in simple terms is to start the strategy at the beginning of each day. Example:  On a 5 minute chart, buy at the close of the 15th bar from the opening of the day.  Can someone please get me started on how to do this.  
>Thanks
>Randy 


Use a test to see if you've started a new day, and then just count bars:

{reset counter on new day}
if Date <> Date[1] then counter = 0;

{count bars of so far today}
counter = counter + 1;

{do the trade}
if counter = 15 then Buy this bar at close;


___________________________

Mike Gossland
info@xxxxxxxxxxxx
www.gossland.com
Tel: (250) 756-3970
Fax: (250) 756-3978