View Single Post
  #5 (permalink)  
Old 12-16-2008, 02:04 AM
rwb181 rwb181 is offline
Junior Member
 
Join Date: Dec 2008
Posts: 12
rwb181 is on a distinguished road
Smile

Thanks for the replies everyone. I wanted a statement that would work for any time frame.

I came up with this and it seems to work.

// get the open and close for last two bars
OpenLastBar = iOpen(NULL,0,1);
OpenPreviousBar = iOpen(NULL,0,2);
CloseLastBar = iClose(NULL,0,1);
ClosePreviousBar = iClose(NULL,0,2);

// check if conditions are met
if(OpenLastBar<CloseLastBar && OpenPreviousBar>=ClosePreviousBar) siCurrentDirection = 1; //up
if(OpenLastBar>CloseLastBar && OpenPreviousBar<=ClosePreviousBar) siCurrentDirection = 2; //down

This is just the beginning of what I want to accomplish but, it is a start.

Thanks for the help, all
Reply With Quote