Please read the documentation of MarketBookGet().
Note
The Depth of Market must be pre-opened by the MarketBookAdd() function.
I used the "MarketBookAdd" and "MarketBookGet" functions to get market depth information. Please advise how I can get the Bid volume for example and save it to compare the Bid volume in the next ticks. My programming literacy is low. Thank you for your help and if possible, write the code line so that I can use it. Thanks
my code is :
I used the "MarketBookAdd" and "MarketBookGet" functions to get market depth information. Please advise how I can get the Bid volume for example and save it to compare the Bid volume in the next ticks. My programming literacy is low. Thank you for your help and if possible, write the code line so that I can use it. Thanks
my code is :
"how I can get the Bid volume for example and save it to compare the Bid volume in the next ticks."
What do you mean? At one point in time there are many bid prices and volumes in the order book of the exchange.What do you want to compare with what?
Do you really understand what an order book is and how it works? And what do you mean by tick? A time unit? (like in tick chart) Or do you mean the smallest distance between two possible prices?
"how I can get the Bid volume for example and save it to compare the Bid volume in the next ticks."
What do you mean? At one point in time there are many bid prices and volumes in the order book of the exchange.What do you want to compare with what?
#property copyright "Copyright 2021, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- long ask_price=0; long ask_volume = 0; long bid_volume = 0; MqlBookInfo BookInfo[]; MarketBookAdd(_Symbol); MarketBookGet(_Symbol,BookInfo); for(int i=0;i<ArraySize(BookInfo)-1;i++) { if(BookInfo[i].type != BookInfo[i+1].type) { ask_price= BookInfo[i].price; ask_volume = BookInfo[i].volume; bid_volume = BookInfo[i+1].volume; } } }
ask_volume += BookInfo[i].volume;
bid_volume += BookInfo[i+1].volume;
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there,
for quite a while I was using market depth info in my EA on a demo account. Suddenly (maybe an update of MT5 platform) I can't anymore, unless it's window is manually opened in the MT5. The code to get the market depth goes like
Do you have any idea why is this so? How could I solve it? I don't want to open that MD window always, just for my EA to work. Much thanks.