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
|