Did I make a trade on the current bar?
Hello folks,
Could you please give me a hint how to check if there is /was a transaction on the current bar?
I think I need to modify this:
for (int i = 0; i < Total; i ++) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
IsTrade = True;
but how? :-/
thanks a lotYou can do something like this to check if you have opened an order on a current bar :
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType() <= OP_SELL && OrderSymbol() == Symbol() && iBarShift(NULL,0,OrderOpenTime())==0) {
IsTrade = True;Thank you mladen it seems promising, the thing though that it only checks for opened trades. I need it to check for trades that are closed as well.
simply put: if there was a trade on this bar or is ... TRUE
Thanks again,
rookieAdd one more loop that will look like this :
for (int i = 0; i < OrdersHistoryTotal(); i ++)
{
OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
if(OrderType() <= OP_SELL && OrderSymbol() == Symbol() && iBarShift(NULL,0,OrderCloseTime())==0)
{
IsTrade = True;
}
}And the two combined will check opened as well the closed orders if there was an order opened (or closed) on the current bar
Hello folks,
Could you please give me a hint how to check if there is /was a transaction on the current bar?
I think I need to modify this:
for (int i = 0; i < Total; i ++) {
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
IsTrade = True;
but how? :-/
thanks a lot