problem with the "Structures variables " and the meta trader

 

 i'm  learning mql5 and I'm trying to learn the structure  but there's a problem when I'm trying  to run The Script


void OnStart()
{
   MqlTick price;  // Declare a variable of type MqlTick to hold tick information
   SymbolInfoTick(_Symbol, price);  // Fetch the current tick information for the selected symbol
   
   // Print various tick information
   Print("Time: ", price.time);             // Print the time of the tick
   Print("Bid: ", price.bid);               // Print the current bid price
   Print("Ask: ", price.ask);               // Print the current ask price
   Print("Last: ", price.last);             // Print the price of the last deal
   Print("Volume: ", price.volume);         // Print the volume of the tick
   Print("Time (ms): ", price.time_msc);    // Print the time of the tick in milliseconds
   Print("Flags: ", price.flags);           // Print the flags associated with the tick
   Print("Real Volume: ", price.volume_real); // Print the real volume (considering market volume, including exchange and off-exchange)
}

why is the last = 0.0 and the volume = 0 and the real volume = 0.0 

1/  This that's the first thing that I don't understand

2/   And the second thing why it's it's only running on " EURUSD "   When  i run it ,  Even when I'm focusing on another chart

 

I believe for the currency pairs there is never any last deal or real tick data in MT5, due to the decentralized nature of forex, this stuff would be largely irrelevant anyway without dipping into systems worldwide. Instead the volume on currency pairs would just be the number of new price quotes received which will vary depending on what exchange networks it's hooked into. On the other hand, for centralized exchanges, all that data is funneled through one point, such as at a stock or futures exchange.

edit: As far as applying to EUR/USD, the script should take _Symbol from the chart it has been activated on. Could you share the exact procedure through which it is activated in which it should not be EUR/USD?

 
Max0r847 #:

I believe for the currency pairs there is never any last deal or real tick data in MT5, due to the decentralized nature of forex, this stuff would be largely irrelevant anyway without dipping into systems worldwide. Instead the volume on currency pairs would just be the number of new price quotes received which will vary depending on what exchange networks it's hooked into. On the other hand, for centralized exchanges, all that data is funneled through one point, such as at a stock or futures exchange.

edit: As far as applying to EUR/USD, the script should take _Symbol from the chart it has been activated on. Could you share the exact procedure through which it is activated in which it should not be EUR/USD?

Thank you for response , 
2/ I'm not talking about dragging the expert from the navigator to the chart  Because when I do that the expert will work on the  chart that  I drop it on it .

 the exact procedure  is when I compile the expert  and click Start From the MetaEditor ,  it only work on  EUR/USD why for example It's not taking the information from  other currency pairs  When I focus on them and  Click   Start 

I want to know what's the reason for that and how you can change that ?

 
bassem ED # the exact procedure  is when I compile the expert  and click Start From the MetaEditor

You are not running it on a chart, you are running it in the tester/debugger. Open your debugger settings and change them.

Perhaps you should read the manual. Strategy Testing - Algorithmic Trading, Trading Robots - MetaTrader 5 Help
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

 
bassem ED:

 i'm  learning mql5 and I'm trying to learn the structure  but there's a problem when I'm trying  to run The Script


why is the last = 0.0 and the volume = 0 and the real volume = 0.0 

1/  This that's the first thing that I don't understand

2/   And the second thing why it's it's only running on " EURUSD "   When  i run it ,  Even when I'm focusing on another chart

Apparently you get the Volume if you pay like 15 € extra for Futures market access with order book data. But you can query the tick volume data with iTickVolume().