Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1173

 
leonerd:

How do I know if a symbol is available for an account without having to open it in the market place?

Usually on the DC's website, where the account types are described, there are also contract specifications. If the specification is different for each account type, then the available instrument lists reflect only those that are available for that account type. Actually, some brokerage companies show in the Market Watch not only the symbols that can be traded, but other symbols as well. They are available for the account, the quotes go, but you cannot trade. If you are interested in how to programmatically list all available symbols, then use SymbolsTotal, SymbolName functions.

 

There is a function.

double XX=0;

double x()
{
  XX++;

return(XX);
}


Each function call will change variable ХХ, and I need ХХ to be external (according to my logic), but each function call started with ХХ being 0 and accordingly return(ХХ) will return its value. I.e . I don't understand how to make the variable XX external and the function could be called "autonomously", in isolation. Exactly by means of MQ4. Thank you!

 
Александр:

There is a function.


Each function call will change variable XX, and I need XX to be external (by the logic I want), but each function call started with XX being 0 and accordingly return(XX) returned its value. I.e . I don't understand how to make the variable XX external and the function could be called "autonomously", in isolation. Exactly by means of MQ4. Thank you!

The approach of increasing the counter is completely incomprehensible. Why not increase it directly, why do we need a function?

 
Александр:

There is a function.


Each function call will change variable ХХ, and I need ХХ to be external (by the logic I want), but each function call started with ХХ being 0 and accordingly return(ХХ) will return its value. I.e . I don't understand how to make the variable XX external, and the function could be called "autonomously", in isolation. Exactly by means of MQ4. Thank you!

So inside the function it is zeroed out and that's it.

double XX=0;

double x()
{
  XX=0;
  XX++;
return(XX);
}
 
Alexey Viktorov:

So inside the function, zero it out and that's it.

It will always return 1)

 
Vitaly Muzichenko:

This way 1 will always be returned)

The way the code is presented, yes it will always return 1. But my understanding is that this is not a very well simplified version of the function, that's why I suggested such a solution.

Well, let's say the function has a while loop and we need to track how many iterations of the loop there were.

If not, we'll wait for clarification of the question.

 

The difficulty is that (to remember the current value) I create an external variable. But if I call the function several times and at DIFFERENT times, I will get the same value of that variable. And I need several autonomous "sets" of the same function. I don't want to use loops, for obvious reasons. A loop is a perfect example of what I need. It's like a self-contained function that lives only during the loop.

 

The difficulty is that (to remember the current value) I create an external variable. But if I call the function several times and at DIFFERENT times, I will get the same value of that variable. And I need several autonomous "sets" of the same function. I don't want to use loops, for obvious reasons. A loop is a perfect example of what I need. It is like a self-contained function that lives only during a loop.


That's what I need.

double XX=0;

double x()
{
  XX=0;
  XX++;
return(XX);
}
///////////////
int start()

{

 Print(" x() = ',x()); // Проверка в 10:00, вызывал функцию в 08:00.
 x() = 40;// условно конечно

///////////

 Print(" x() = ',x()); // Проверка в 10:00, здесь вызвал вызывал функцию раньше в 01:00.
 x() =70;// условно конечно

return(0);
}
 
The easiest way out is to have several identical functions with different names (not counting loops). But I don't know how many times I have to call it, so I want an elegant solution.
 

I have a question about calling up indicators via iCustom.

1. There is a possibility to exclude some indicator parameters from the list of parameters passed to iCustom. For example, I do not want to pass some string parameter or any other. an indicator external parameter with the sinput modifier should also be specified in iCustom when calling from an Expert Advisor?

2. What is the best solution, if the indicator has a lot of parameters (about hundreds)? Is there a ready solution, how to call this indicator?

Thank you.

Reason: