Execution of the first one outputs an empty string:
int start()
{
Comment(SymbolOK());
return(0);
}
But the second function outputs a string ID "EURUSD" (well, depends on the chart, but outputs, although according to the logic of the function it should be an empty string):
int start()
{
Comment(SymbolPROBLEM());
return(0);
}
Execution of the first one outputs an empty string:
But the second function outputs a string ID "EURUSD" (well, depends on the chart, but outputs, although according to the logic of the function it should be an empty string):
Help me understand what is wrong? Thank you
Your if(false) will never work, so value will not change in any way, and will most likely be an empty string. Although I don't know how values of string variables are initiated. Maybe they are not initiated at all, then in your version anything can be output.
Sepulca: Your if(false) will never work, so value will not change in any way, and will most likely be an empty string. Although I don't know how values of string variables are initiated. Maybe they are not initiated at all, then in your version anything can be output.
"...If no initial value is set explicitly, a numeric variable is initialized to zero (0) and a string variable is initialized to empty string....".
zoritch: "...If no initial value is set explicitly, a numeric variable is initialised to zero (0) and a string variable is initialised to the empty string...."
There you go, you've even found it in the documentation too... But generally speaking a d...n... question. Not to bother, it's not so hard to type instead:
There you go, you even found it in the documentation... But generally speaking, it's a dumb question. It's not too hard to type instead:
something like this:
Thank you for answering. About the documentation, I know that without explicit initialization, the string variable will be an empty string, but this function returns a character code of the tool. I.e. we will never get into a condition (false intentionally), so how value becomes Symbol() in this version (this example of the function is exaggerated), that is, with implicit initialization the string variable is not an empty string (and I really counted on it), but something unclear, or rather the mechanism of implicit string initialization is not clear. "Stuffing" the variable declaration is not difficult, it's just the behaviour of the system outside of the documentation that's somehow confusing. And most importantly, this happens when you use Symbol().
I have written an arbitrage Expert Advisor. The entry signal is generated - if the current divergence of price lines of theDELTA_MAindicator exceeds the DELTA value set in the parameters:
//жжжжжжжжжжжжжжжжжжжжжжж Ищем возможность войти в рынок жжжжжжжжжжжжжжжжжжжжжжжж// Задаем ценовые линии МА на 1-м баре
MA_1= (iMA(Symbol_1,Period(),per2,0,ma_method,Price,1)-
iMA(Symbol_1,Period(),per1,0,ma_method,Price,1)) ;
MA_2= (iMA(Symbol_2,Period(),per2,0,ma_method,Price,1)-
iMA(Symbol_2,Period(),per1,0,ma_method,Price,1)) ;
ДЕЛЬТА_MA = MathAbs(MA_1 - MA_2 ) ; //- разность ценовых линий на 1 баре //------------------------------------------------ if (ДЕЛЬТА_MA > ДЕЛЬТА && MA_1 > MA_2)//если линии разошлись больше заданного значения//(первыя выше второй), то продаем 1-й инструмент и покупаем/продаем второй
TradeDOWN=true; else TradeDOWN=false;
The EA works fine and correctly! The problems started when I wanted to insert a filter that allows entering only if the first condition is met - the convergence of price lines at the same time:
externdouble ДЕЛЬТА = 350;
externstring ____F____ = "=== FILTER ===";
externbool FILTER_= true; //Арбитр. вход реализуется только при схождении линий
The algorithm for such a condition is implemented as follows
Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 4.
Why does the code in the loop not work
while(!IsStopped())
{
code
Sleep(50);
}
but by ticks it works fine
Why does the code in the loop not work
А! Got it! Thank you!!!
Problem with Symbol() MT4:
2 functions to illustrate:
Execution of the first one outputs an empty string:
But the second function outputs a string ID "EURUSD" (well, depends on the chart, but outputs, although according to the logic of the function it should be an empty string):
Help me understand what is wrong? Thank you
Problem with Symbol() MT4:
2 functions to illustrate:
Execution of the first one outputs an empty string:
But the second function outputs a string ID "EURUSD" (well, depends on the chart, but outputs, although according to the logic of the function it should be an empty string):
Help me understand what is wrong? Thank you
Your if(false) will never work, so value will not change in any way, and will most likely be an empty string. Although I don't know how values of string variables are initiated. Maybe they are not initiated at all, then in your version anything can be output.
"...If no initial value is set explicitly, a numeric variable is initialised to zero (0) and a string variable is initialised to the empty string...."
There you go, you've even found it in the documentation too... But generally speaking a d...n... question. Not to bother, it's not so hard to type instead:
string value;something like this:
There you go, you even found it in the documentation... But generally speaking, it's a dumb question. It's not too hard to type instead:
something like this:
Thank you for answering. About the documentation, I know that without explicit initialization, the string variable will be an empty string, but this function returns a character code of the tool. I.e. we will never get into a condition (false intentionally), so how value becomes Symbol() in this version (this example of the function is exaggerated), that is, with implicit initialization the string variable is not an empty string (and I really counted on it), but something unclear, or rather the mechanism of implicit string initialization is not clear. "Stuffing" the variable declaration is not difficult, it's just the behaviour of the system outside of the documentation that's somehow confusing. And most importantly, this happens when you use Symbol().
Good afternoon everyone!
I have written an arbitrage Expert Advisor. The entry signal is generated - if the current divergence of price lines of the DELTA_MA indicator exceeds the DELTA value set in the parameters:
The EA works fine and correctly! The problems started when I wanted to insert a filter that allows entering only if the first condition is met - the convergence of price lines at the same time:

The algorithm for such a condition is implemented as follows