Python copy_ticks_range, flags and how to create own book market

 

Hello, its my first post!

I'm using function copy_ticks_range from python API to get all ticks history of a symbol. (am i correct?)


The result is a csv with

time,bid,ask,last,volume,time_msc,flags,volume_real

According in information of CopyTicks the result is a collection of struct MqlTick, right?

The flags are:

TICK_FLAG_BID    = 0b0000010 # 2
TICK_FLAG_ASK    = 0b0000100 # 4
TICK_FLAG_LAST   = 0b0001000 # 8
TICK_FLAG_VOLUME = 0b0010000 # 16
TICK_FLAG_BUY    = 0b0100000 # 32
TICK_FLAG_SELL   = 0b1000000 # 64
TICK_FLAG_????   = 0b10000000 # what is this flag?
TICK_FLAG_????   = 0b100000000 # what is this flag?


noting the returned values the flags are is bigger of TICK_FLAG_SELL (64), what are the other flags?

time,bid,ask,last,volume,time_msc,flags,volume_real
1614330251,112235.0,112245.0,112240.0,4,1614330251782,376,4.0
1614330251,112235.0,112245.0,112235.0,2,1614330251784,344,2.0
1614330251,112235.0,112245.0,112235.0,9,1614330251794,344,9.0
1614330251,112235.0,112245.0,112240.0,2,1614330251808,376,2.0
1614330251,112235.0,112245.0,112240.0,2,1614330251809,376,2.0
1614330251,112235.0,112245.0,112245.0,3,1614330251809,312,3.0
1614330251,112235.0,112245.0,112245.0,1,1614330251809,312,1.0


My other question: how can i simulate a book of offers (market depth) from these ticks?

Similar to this image in attachment

When a buy tick subtracts from a sell tick and vice versa?!?!.

Documentação sobre MQL5: Integração / MetaTrader para Python / copy_ticks_range
Documentação sobre MQL5: Integração / MetaTrader para Python / copy_ticks_range
  • www.mql5.com
copy_ticks_range - MetaTrader para Python - Integração - Referência MQL5 - Referência sobre algorítimo/automatização de negociação na linguagem para MetaTrader 5
Files: