Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information
I have been searching around for an EA with no luck and have been unable to create one that does exactly what I want it to do.
What I am looking for is an EA that will place a buy or sell order based on the opening and closing of the last two bars in the current chart.
Specifically, if the close of bar[1] is greater than the open of bar[1] and the close of bar[2] was less than the open of bar[2] (a price reversal), a buy order is placed on the open of bar[0]. A sell would be the opposite.
The EA doesn't need to be fancy or anything like that. Actually, what I could probably work with is just the formula that is needed to satisfy these conditions.
Any help that is offered will be greatly appreciated. In the mean time, I will continue to try to create the proper formula.
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.