Because there is a delay in updating graphical objects. Print out the values in a "Comment()" and you will see it in more real-time.
Because there is a delay in updating graphical objects. Print out the values in a "Comment()" and you will see it in more real-time.
Thanks Fernando,
I did what you told me and apparently the Bid and Ask lines that MT5 shows are not real. It always shows a smaller spread than the real one.
I'm not having that problem and the delay only appears infrequently.
#define MAsk "Ask Line" #define MBid "Bid Line" int OnInit(void) { ObjectCreate( 0, MAsk, OBJ_HLINE, 0, 0, 0 ); ObjectCreate( 0, MBid, OBJ_HLINE, 0, 0, 0 ); ObjectSetInteger( 0, MAsk, OBJPROP_COLOR, clrRed ); ObjectSetInteger( 0, MBid, OBJPROP_COLOR, clrGreen ); return(INIT_SUCCEEDED); }; void OnDeinit( const int reason ) { ObjectDelete( 0, MAsk ); ObjectDelete( 0, MBid ); }; void OnTick(void) { MqlTick oTick; // Tick data object if( SymbolInfoTick( _Symbol, oTick ) ) { ObjectSetDouble(0, MAsk, OBJPROP_PRICE, oTick.ask ); ObjectSetDouble(0, MBid, OBJPROP_PRICE, oTick.bid ); Comment( "Ask: ", DoubleToString( oTick.ask, _Digits ), ", Bid: ", DoubleToString( oTick.bid, _Digits ) ); }; };
I used your code to test and I have the same problem. Will it be the broker? Although I tried in two brokers and I have the same problem. It's strange.
I have a similar (or same) problem.
With this code my closing and my Bid do not coincide.... which is better for do calculation?
MqlTick tick; SymbolInfoTick(_Symbol, tick); MqlRates price[]; if(!CopyRates(NULL, PERIOD_CURRENT, 0, 1, price)) { GetLastError(); PrintFormat("Error! Copy rates to array price[] failed, error code: %d", _LastError); return; } Print("Ask ",tick.ask); Print("Bid ",tick.bid); Print("Low ",price[0].low); Print("Close ",price[0].close);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Why the Bid price and Ask price indicated by MT5 do not match the Bid price and Ask price that I execute by code? At all times there is a gap.