I have some new ideas about this problem. It seems to come from GlobalVariablesDeleteAll().
If you call this function just before GlobalVariableSetOnCondition(), the problem occurs.
This is the test (it's a SCRIPT, not an indicator)
If you call this function just before GlobalVariableSetOnCondition(), the problem occurs.
This is the test (it's a SCRIPT, not an indicator)
//+------------------------------------------------------------------+
//| TEST_SCRIPT.mq4
//|
//|
//| A test script to show a problem with the following commands :
//| - GlobalVariableSetOnCondition(...)
//|
//+------------------------------------------------------------------+
#include <stderror.mqh>
#include <stdlib.mqh>
int start()
{
// We delete all global variables to begin from scratch
GlobalVariablesDeleteAll();
/*
* The definition of GlobalVariableSetOnCondition() says ;
* << If there is no global variable, the function will generate
* error ERR_GLOBAL_VARIABLE_NOT_FOUND (4058) and return FALSE >>
*/
Print( "GlobalVariableSetOnCondition( \"GV_TEST\", 1.0, 2.0 ) returns ",
GlobalVariableSetOnCondition( "GV_TEST", 1.0, 2.0 ),
" and GetLastError() is << ",ErrorDescription( GetLastError() )," >>" );
return(0);
}
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
<< If there is no global variable, the function will generate error ERR_GLOBAL_VARIABLE_NOT_FOUND (4058) and return FALSE >>
But if you execute :
the result is :
There is no 4058 error generated.