bars built from ask prices, not last traded prices, in TRADE mod

Posted By: jmlocatelli

bars built from ask prices, not last traded prices, in TRADE mod - 03/19/18 15:46

I was comparing, in TRADE mode, the OHLC prices in Zorro with the same prices em MetaTrader and they are normally different. It seems the OHLC prices in Zorro came from ask prices and not from last traded prices. Is it the Zorro behavior?

att
jm
Posted By: Zheka

Re: bars built from ask prices, not last traded prices, in TRADE mod - 03/19/18 16:23

Yes, Zorro uses Ask prices everywhere (while MT4 - mostly bid).
Posted By: jmlocatelli

Re: bars built from ask prices, not last traded prices, in TRADE mod - 03/19/18 17:09

Tks for the help.
In Metatrader, the bars plotted in real time are formed from the real last traded prices. It can show the ask and bid price levels on the graphic window, but theses prices does not affect the bar. They are always the same during backtest, optimization or real trading.

Zorro in TRAIN or TEST mode, uses the OHLC prices from History or from Broker that corresponds to traded prices not to ask and bid prices. In TRADE mode it uses ask prices to form the bars and to trigger tick functions. Very different worlds for me.
I tried to trade and backtest the same strategy in the same period and the results are VERY different. Using TICKS and Period 1min.
Am I missing samething?

att
jm
Posted By: Zheka

Re: bars built from ask prices, not last traded prices, in TRADE mod - 03/20/18 09:12

Quote:
In Metatrader, the bars plotted in real time are formed from the real last traded prices
In FX, this is most certainly not the case. Can you provide a link to a proof re MT?

Quote:
uses the OHLC prices from History or from Broker that corresponds to traded prices not to ask and bid prices
I suggest reviewing the *.mql file of Zorro's MT4 EA to see what kind of historical data Zorro actually requests from MT's servers.

I use bid-ask mid-point to feed into systems (just subtract 1/2 of Spread from the close) which makes it much more robust to occasional bid-ask spikes.
Posted By: jmlocatelli

Re: bars built from ask prices, not last traded prices, in TRADE mod - 03/21/18 14:32

HI, tks for the reply and tips.
I do not trade FX. I currently trade futures.

In MT5, you can open the Depth of Market window and compare with the bars being plotted in the price graphic. MT5 plots the last deal price. I don't know if different brokers have different behaviors. I don't guess so.

As per your suggestion, I reviewed the Zorro's MT5 EA and the zmq4 include file. It really uses Ask and Bid prices:
#define Bid (::SymbolInfoDouble(_Symbol, ::SYMBOL_BID))
#define Ask (::SymbolInfoDouble(_Symbol, ::SYMBOL_ASK))
It seems Zorro EA never asks for SYMBOL_LAST.

Zorro EA requests OHLC prices as history data (CMD_HISTORY). That is not ask and bid prices. I have to double check with Download Zorro included strategy.

I confess I'm loosing enthusiasm with Zorro S.

att,
jm
Posted By: Zheka

Re: bars built from ask prices, not last traded prices, in TRADE mod - 03/21/18 15:50

You can, in theory, change the mql file, request SYMBOL_LAST and transfer it to Zorro.
See for more details under "Zorro and the Brokers/MT4/5/Additional Data and Commands".

Out of curiosity: How often is the "trade" price different from either bid or ask? Does it happen at all?
Posted By: jmlocatelli

Re: bars built from ask prices, not last traded prices, in TRADE mod - 03/21/18 16:03

I'll play with the mql file to see what happen. Have to find time.
I'll post the result.

It happens lots of time, specially during price congestion.
I'm trying to trade scalp so small differences matter for indicators calculation.
It really makes almost no difference en case of more long term trading, like swing or EOD trading.

I'm trying to minimize the impact with range bar.
Posted By: jcl

Re: bars built from ask prices, not last traded prices, in TRADE mod - 03/21/18 16:06

If you want to implement SYMBOL_LAST in mq5, make it switchable with the SET_PRICETYPE command. Otherwise you'll probably get garbage when you want to trade assets that have no last price.
Posted By: jmlocatelli

Re: bars built from ask prices, not last traded prices, in TRADE mod - 03/21/18 16:12

Hi jcl,
Tks for the tip.
According to doccumentatio, SET_PRICETYPE is not in the list of supported commands by MT4/MT5 plugin.
So, should also SET_PRICETYPE be implemented?
Posted By: jcl

Re: bars built from ask prices, not last traded prices, in TRADE mod - 03/22/18 08:18

Yes. For example, like this:

Code:
#define SET_PRICETYPE	151
uint g_PriceType = 0;
...

in the main switch/case: 

case SET_PRICETYPE:
	g_PriceType = (int)arr[1]; 
	arr[0] = 1; break;
...

and then:

#define Bid (::SymbolInfoDouble(_Symbol,g_PriceType == 2? ::SYMBOL_LAST : ::SYMBOL_BID))
etc.


© 2024 lite-C Forums