Questions from Beginners MQL5 MT5 MetaTrader 5 - page 409

 
mefos:
We need a simple advisor
And as a rule, such freelance requests always contain the word "simple".
 
Artyom Trishkin:
You need to compare the number of tracked positions on the past tick with the number on the current tick. If the current one is less - save (remember) the current value of tracked positions as "past" and process the fact of closing.
Thank you. I understand how to track by myself. Just thought there might be an event handler.
 
Leanid Aladzyeu:

I don't get it. What value do you want to get?

And what you wrote I read like this

{

Opening of an order;

If the order opens, then

TotalOrder = TotalOrder+1;

}

) by default totalOrder = 0, but after each opening of an order the value will increase, after 10 openings (the value will be exactly 10) the counter of all ever opened positions (no check by type, by Magik and by symbol = it will add absolutely all open orders)

And the next condition looks like this

if TotalOrder is not equal toOrdersTotal {}

That's roughly what I wrote)
 

Hello, is it possible to select instruments from a list of instruments in an external variable in an indicator or Expert Advisor?

I have to type them in manually.

input string instr_1 = "ED-9.15";

input string instr_2 = "Si-9.15";

input string instr_3 = "BR-8.15";

Sincerely Alexey.

 
twiling1983:

Hello, is it possible to select instruments from a list of instruments in an external variable in an indicator or Expert Advisor?

I have to type them in manually.

input string instr_1 = "ED-9.15";

input string instr_2 = "Si-9.15";

input string instr_3 = "BR-8.15";

Sincerely Alexey.

Hello. Directly - not sure, but you can, for example, like this:

enum ENUM_USED_SYMBOL
        {
         EURUSD = 0,
         GBPUSD,
         USDCHF,
         USDJPY
        };

const string symbols[ 4 ] = { "EURUSD", "GBPUSD", "USDCHF", "USDJPY" };
input ENUM_USED_SYMBOL = EURUSD;
string usedSymbol = "";		// Используемый символ
switch( inpSymbol )		// Всю эту конструкцию лучше обернуть в функцию, т.к. повторяться будет несколько раз
        {
         case EURUSD: usedSymbol = symbols[ 0 ]; break;
         case GBPUSD: usedSymbol = symbols[ 1 ]; break;
         case USDCHF: usedSymbol = symbols[ 2 ]; break;
         case USDJPY: usedSymbol = symbols[ 3 ]; break;
         default: Print( "Неизвестный символ!" );
        }
 
Tapochun:

Hello. I'm not sure directly, but you could, for example, do this:

Thanks but then it's easier for me to recompile the file every 3 months and specify new futures =)
 
twiling1983:
Thanks but then it's easier for me to recompile the file every 3 months and specify new futures =)
Yes, it looks like crutches, but... as an option...
 

Hello. How can I make an indicator window forcefully show values up to 10,000 decimal places, it only shows values up to tenths, although there is no normalization in the code.

http://i.shotnes.com/u/441/0813/1vyds1z0.15y.png

Regards Alexey.

UPD found the answer.

IndicatorSetInteger(INDICATOR_DIGITS,5);

 
twiling1983:

Hello. How can I make an indicator window forcefully show values up to 10,000 decimal places, it only shows values up to tenths, although there is no normalization in the code.

http://i.shotnes.com/u/441/0813/1vyds1z0.15y.png

Regards Alexey.

Please use the forum's built-in tools when pasting pictures:Forum: How to paste a picture
 

Please tell me, when using Standard Library, when getting Ask and Bid, is it necessary to do mysymbol.RefreshRates();

i.e. should I refresh or for data from Library I don't need to refresh?

mysymbol.RefreshRates();
 double ask =mysymbol.Ask();
 double bid =mysymbol.Bid();

or
 double ask =mysymbol.Ask();
 double bid =mysymbol.Bid();
Reason: