Discussion of article "Library for easy and quick development of MetaTrader programs (part XIV): Symbol object"

 

New article Library for easy and quick development of MetaTrader programs (part XIV): Symbol object has been published:

In this article, we will create the class of a symbol object that is to be the basic object for creating the symbol collection. The class will allow us to obtain data on the necessary symbols for their further analysis and comparison.

Launch the EA on a symbol chart in MetaTrader 5.
All symbol object properties are sent to the journal:

Account 18222304: Artyom Trishkin (MetaQuotes Software Corp. 10000.00 RUR, 1:100, Demo account MetaTrader 5)
============= Beginning of the parameter list:: "EURUSD" (Euro vs US Dollar) ==================
Status: Forex symbol
Custom symbol: No
The price type used for generating bars: Bars are based on Bid prices
The symbol under this name exists: Yes
The symbol is selected in Market Watch: Yes
The symbol is displayed in Market Watch: Yes
The number of deals in the current session: 0
The total number of Buy orders at the moment: 0
The total number of Sell orders at the moment: 0
Last deal volume: 0
Maximum volume within a day: 0
Minimum volume within a day: 0
Latest quote time: 2019.06.17 15:37:13.016
Number of decimal places: 5
Number of decimal places for a lot: 2
Spread in points: 10
Floating spread: Yes
Maximum number of orders displayed in the Depth of Market: 10
Contract price calculation method: Forex mode
Order execution type: No trade restrictions
Symbol trading start date: (Not set)
Symbol trading end date: (Not set)
Minimum distance in points from the current close price for setting Stop orders: 0
Freeze distance for trading operations: 0
Deal execution mode: Instant execution
Swap calculation model: Swaps are charged in points
Triple-day swap: Wednesday
Calculating hedging margin using the larger leg: No
Flags of allowed order expiration modes: 
 - Unlimited (Yes)
 - Valid till the end of the day (Yes)
 - Time is specified in the order (Yes)
 - Date is specified in the order (Yes)
Flags of allowed order filling modes: 
 - Return (Yes)
 - Fill or Kill (Yes)
 - Immediate or Cancel (No)
The flags of allowed order types: 
 - Market order (Yes)
 - Limit order (Yes)
 - Stop order (Yes)
 - Stop limit order (Yes)
 - StopLoss (Yes)
 - TakeProfit (Yes)
 - CloseBy order (Yes)
StopLoss and TakeProfit orders lifetime: Pending orders and Stop Loss/Take Profit levels are valid for an unlimited period until their explicit cancellation
Option type: European option may only be exercised on a specified date
Option right: A call option gives you the right to buy an asset at a specified price
Background color of the symbol in Market Watch: (Not set)

Author: Artyom Trishkin

 
Hello Artyom -- is there an easy way to extract or compute the average spread for a given symbol using your library, or it is something you recommend I code externally myself?
 
Dima Diall :
Hello Artyom -- is there an easy way to extract or compute the average spread  for a given symbol using your library, or it is something you recommend I code externally myself?

The average spread of a bar is recorded by the terminal in the parameters of each bar. It can be found by requesting bar data from MqlRates. The library contains this data for each bar.

Add up all the spreads of all bars in the sample under study and divide by their number.

I will not do automatic determination of the average spread for a symbol. Because it will slow down the library, and this is not a frequent need. You can easily implement this yourself if you wish.

 
Artyom Trishkin:

The average spread of a bar is recorded by the terminal in the parameters of each bar. It can be found by requesting bar data from MqlRates. The library contains this data for each bar.

Add up all the spreads of all bars in the sample under study and divide by their number.

That's perfect, thank you!

Do you know how reliable is the spread data for each bar when in testing mode? Is this consistent across different brokers, or quality of spread data can vary?

 
Dima Diall :

That's perfect, thank you!

Do you know how reliable is the spread data for each bar when in testing mode ? Is this consistent across different brokers, or quality of spread data can vary?

No, unfortunately I do not know.