Broker one-click buy/sell prices different from market ticks

 

Hi, 

If I examine the prices on one-click buy/sell buttons, I see different numbers than the current tick price feed.

This is because I opened a particular account with fixed spread in order to make automation easier.

For a particular automated strategy, I need to use the one-click buy/sell prices provided by my broker, not the tick data. 

How can I access those values from inside an expert advisor?

I tried Ask and Bid variables, but they show the current market ask/bid prices, not the broker's one-click buy/sell prices. 

 
nurettin: show the current market ask/bid prices, not the broker's one-click buy/sell prices. 
This are no differences. You only get brokers prices..
 

Yes, this is possible. Previously discussed here and here.


The broker that I am currently testing has wide spread in:

  • New Order Window
  • Quick Trade Panel
  • Market Watch Panel
  • SymbolInforTick()
  • SymbolInfoDouble()
  • Actual trades executed in Demo account (haven't tried Live with them)

And they have narrow spread in:

  • The Charts
  • Market Depth Panel
  • Symbols/Ticks History
  • CopyTicks() and CopyTicksRange()


Here is a code snippet to quickly eyeball if the difference between the wide spread and narrow spread is a constant (it isn't in my case):

void OnTick()
{
  long digits = SymbolInfoInteger(_Symbol, SYMBOL_DIGITS);

  MqlTick last_tick = {};
  SymbolInfoTick(_Symbol, last_tick);

  MqlTick ticks[];
  datetime current_time = TimeCurrent();
  ulong now = current_time * 1000;
  ulong earlier = now - 100000;

  int result = CopyTicksRange(_Symbol, ticks, COPY_TICKS_ALL, earlier, now);
  int ticks_count = ArraySize(ticks);

  Print("Bid is:");
  Print(last_tick.bid + " in order window");
  Print(ticks[ticks_count - 1].bid + " on the chart");
  double diff = ticks[ticks_count - 1].bid - last_tick.bid;
  Print("Difference: " + DoubleToString(NormalizeDouble(diff, digits), digits));

  Print("Ask is:");
  Print(last_tick.ask + " in order window");
  Print(ticks[ticks_count - 1].ask + " on the chart");
  diff = last_tick.ask - ticks[ticks_count - 1].ask;
  Print("Difference: " + DoubleToString(NormalizeDouble(diff, digits), digits));
}





Chart shows different price than MQL
Chart shows different price than MQL
  • 2013.04.03
  • Ex Ovo Omnia
  • www.mql5.com
When I work with Bid and Ask, I realized one (only one I know about) broker has different values for the chart and the MQL variables...