for(int i=0; i<CurrentOpenBuyTrade() ;i++)
I don't know what your function returns, but you should be using OrdersTotal().
I don't know what your function returns, but you should be using OrdersTotal().
Hi sir, its returning the number of current open Buy "CurrentOpenBuyTrade()" and current open Sell "CurrentOpenSellTrade()"
Hi sir, its returning the number of current open Buy "CurrentOpenBuyTrade()" and current open Sell "CurrentOpenSellTrade()"
yes I do have. While observing it now, it turns out that it only happens when both code on buy and sell is turned on. If i only use Sell it work properly.
yes I do have. While observing it now, it turns out that it only happens when both code on buy and sell is turned on. If i only use Sell it work properly.
So probably one function is interfering with another due to nesting or a variable conflict?
yes maybe sir hmmmm this is giving me a headache lol, the problem occurs because this function "LastEntrySell()" retrun zero everytime i the buy is on,
hi guys I have this function to return the value of last entry price on Buy and Sell they are almost the same but its weird the function for buy is returning me the correct value but on the function for sell is returning me zero. This are the code
for buy :
For Sell that returns zero:
thank you in advance :)
The problem is with this CurrentOpenSellTrade(), check it!!
that was im thinking sir here is my codes
on buy:
int CurrentOpenBuyTrade() { int ordercountbuy=0; for(int i=OrdersTotal()-1;i>= 0 ;i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==true) { if(OrderSymbol()==Symbol() && OrderType() == OP_BUY) { ordercountbuy++; } } } return (ordercountbuy); }
on Sell
int CurrentOpenSellTrade() { int ordercountsell=0; for(int i=OrdersTotal()-1;i>= 0 ;i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==true) { if(OrderSymbol()==Symbol() && OrderType() == OP_SELL) { ordercountsell++; } } } return (ordercountsell); }
hi guys I have this function to return the value of last entry price on Buy and Sell they are almost the same but its weird the function for buy is returning me the correct value but on the function for sell is returning me zero. This are the code
for buy :
For Sell that returns zero:
thank you in advance :)
place this one instead...its working...OrdersTotal is better choice
for(int i=0; i<OrdersTotal();i++) { OrderSelect(i, SELECT_BY_POS); if(OrderType() == OP_SELL ) LastEntrySell = OrderOpenPrice();}
Keith Watford:
for(int i=0; i<CurrentOpenBuyTrade() ;i++)
I don't know what your function returns, but you should be using OrdersTotal().
Hi sir, its returning the number of current open Buy "CurrentOpenBuyTrade()" and current open Sell "CurrentOpenSellTrade()"
Why would you want to use that?
I repeat
you should be using OrdersTotal().![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
for buy :
For Sell that returns zero:
thank you in advance :)