Hi,
Can anyone help with a function question. As part of my buy and sell logics I want my EA to lookup the direction of the last order/position that was taken. The reason for this is that I never want my EA to open two or more consecutive orders in the same direction. So as part of my logic before my EA executes an order I want it to look at the direction of the last order it executed and make sure that order was going the opposite direction. So, as an example, if the entry for a buy order came up I would want the EA to check that the last order had been a sell.
My guess is that the code involves using the OrderSelect() and OrderType() functions and I have looked up how to use those functions. I know that to make it look at past orders I tell it to look up the history with MODE_HISTORY. My problem is I don't know how to tell the EA to look exactly at the last order executed and at no other order. Can any one help with that? If so, is there also a way to make sure the EA only looks at orders for a particular symbol that way I can run the EA on multiple charts?
Thanks to anyone that can help.
Can anyone help with a function question. As part of my buy and sell logics I want my EA to lookup the direction of the last order/position that was taken. The reason for this is that I never want my EA to open two or more consecutive orders in the same direction. So as part of my logic before my EA executes an order I want it to look at the direction of the last order it executed and make sure that order was going the opposite direction. So, as an example, if the entry for a buy order came up I would want the EA to check that the last order had been a sell.
My guess is that the code involves using the OrderSelect() and OrderType() functions and I have looked up how to use those functions. I know that to make it look at past orders I tell it to look up the history with MODE_HISTORY. My problem is I don't know how to tell the EA to look exactly at the last order executed and at no other order. Can any one help with that? If so, is there also a way to make sure the EA only looks at orders for a particular symbol that way I can run the EA on multiple charts?
Thanks to anyone that can help.
Rhoman