Questions from Beginners MQL4 MT4 MetaTrader 4 - page 28

 
Vladimir Karputov:

Postponed:

Gevorg Hakobyan, 2016.12.08 15:26

Hello. How can I get a list of all existing currency pairs in Meta Trader 4? And how can I keep abreast of any changes in the list?
https://docs.mql4.com/ru/marketinformation/symbolstotal
SymbolsTotal - Получение рыночной информации - Справочник MQL4
SymbolsTotal - Получение рыночной информации - Справочник MQL4
  • docs.mql4.com
SymbolsTotal - Получение рыночной информации - Справочник MQL4
 
Sergey Gritsay:

SymbolsTotal

Returns the number of available (selected in MarketWatch or all) symbols.

intSymbolsTotal(
bool selected// true - only symbols in MarketWatch
);

Parameters

selected

[in] Request mode. Can take values true or false.

Returned value

If selected is true, the number of characters selected in MarketWatch is returned. If false, it returns the total number of all symbols.

Thank you, Sergei. But I don't need a quantity, but a list of all existing ones, to process and calculate the strength of the currency in the market.
 
Thank you Renat. But I don't need a quantity, but a list of all existing ones, to process and calculate the strength of the currency in the market.

 
On demo and real accounts of the same broker this list has a different number of currency pairs. I write an indicator that calculates the data for the selected currency out of all the currency pairs in which it is present. Since the indicator should work on all accounts, you should take into account the availability of these pairs in advance.
 
Gevorg Hakobyan:
Thank you Renat. But I don't need a quantity, but a list of all the existing ones, to process and calculate the strength of the currency in the market.

There are many functions there, see what you need from that section

https://docs.mql4.com/ru/marketinformation/symbolname

SymbolName - Получение рыночной информации - Справочник MQL4
SymbolName - Получение рыночной информации - Справочник MQL4
  • docs.mql4.com
SymbolName - Получение рыночной информации - Справочник MQL4
 
Gevorg Hakobyan:
Thank you Renat. But what I need is not a quantity, but a list of all existing ones, to process and calculate the strength of the currency in the market.

First we get the list of all symbols:

//+------------------------------------------------------------------+
//|                                                   AllSymbols.mq5 |
//|                              Copyright © 2016, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   int count=SymbolsTotal(false); // false - all symbols in MarketWatch
   for(int i=0;i<count;i++)
      Print(i,": ",SymbolName(i,false));
  }
//+------------------------------------------------------------------+

Here we use the enumeration of all symbols available in MarketWatch.

But just a list will not give us anything. In order to get the properties of a symbol, we must first select it(SymbolSelect).

Files:
 
Vladimir Karputov:

First we get a list of all the symbols:

This uses a search against all the symbols available in MarketWatch.

But just a list will not give you anything. In order to get the properties of a symbol, you must first select it(SymbolSelect).

Here is a misprint:int count=SymbolsTotal(false);// false - all symbols in MarketWatch- //Iffalse, then the total number of all symbols is returned.
The list will give what the person asked for, i.e. information about all symbols. And then select and process each one in turn.
 
Thank you all. I think I've found a solution. I will try to compare my list with MarketWatch list first. If there are new pairs, I will add them to my list, and if there are no pairs, I will simply remove unnecessary ones. Only now there is a new problem - the results will be ambiguous and will depend on MarketWatch.
 

Good day everyone! Can you please advise how to set an order deletion in an EA?

The situation is as follows:

We place 2pending orders in different directions, as soon as one of them triggers, the other is removed and is no longer exhibited.

I would be very grateful for any help.

I will be very thankful for it.

 
yaaarik777:

Good day everyone! Can you please advise how to set an order deletion in an EA?

The situation is as follows:

We place 2pending orders in different directions, as soon as one of them triggers, the other is removed and is no longer exhibited.

I would be very grateful for any help.

Thank you.

If the amount of pending orders is less than 2, delete the one that remained.

If we do not want to return the pending order, it is more difficult, we have to analyze the time and conditions for placing the order.

Reason: