thuandx89:
if(ORDER_PRICE_OPEN == Level)
if(ORDER_PRICE_OPEN == Level)
string sym=OrderGetString(ORDER_SYMBOL); double points = SymbolInfoDouble(sym, SYMBOL_POINT); if(MathAbs(OrderGetDouble(ORDER_PRICE_OPEN) - Level)<points)
thuandx89:
NormalizeDouble(Level,_Digits-1);
NormalizeDouble(Level,_Digits-1);
How can you be sure that the order digits are same as current chart digits?
thuandx89:
NormalizeDouble(Level,_Digits-1);
NormalizeDouble(Level,_Digits-1);
NormalizeDouble does not work with pass by reference. It returns the result:
Level = NormalizeDouble(Level, ...);
thuandx89:
if(ORDER_PRICE_OPEN == Level)
if(ORDER_PRICE_OPEN == Level)
This is not how you access order open price. You do it like this:
OrderGetDouble(ORDER_PRICE_OPEN);
thuandx89:
if(ORDER_PRICE_OPEN == Level)
if(ORDER_PRICE_OPEN == Level)
You cannot compare two doubles. It does not work this way. Check IEEE 754 document.
I already fix. Can you check for me?
int CountLevel(double price) { int count = 0; for(int i= OrdersTotal() - 1; i >= 0 ; i--) { double price = OrderGetDouble(ORDER_PRICE_OPEN); if(OrderSelect(OrderGetTicket(i))) { if(price == OrderGetDouble(ORDER_PRICE_OPEN)) count++; } } return count; }
int CountLevel(double price) { int count = 0; for(int i= OrdersTotal() - 1; i >= 0 ; i--) { ulong ticket = OrderGetTicket(i); double _price = OrderGetDouble(ORDER_PRICE_OPEN); string sym=OrderGetString(ORDER_SYMBOL); double points=SymbolInfoDouble(sym, SYMBOL_POINT); string diff=MathAbs(price-_price); if(diff<points) count++; } return count; }
I did not test and compile.
Note that OrderGetTicket selects the order. No need to invoke OrderSelect again. Also doubles should not be compared that way. Check IEEE 754.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello, i have problem with my ea.
I have more order limit at level price. But EA creat many order with duplication price.
I want count order price at level. And I will filter order duplication.
How to fix?