[136 dev2] "wizard initialized" variables don't get initialized in mql5

In the SQX mt5 engine, this strategy works as expected. But once put into mt5 terminal the variables supposed to be used as the indicator period don't get initialized properly.

...

2022.07.17 15:25:48.610 Core 01 2022.03.30 20:00:00   Incorrect input parameter InpAtrPeriod = 0. Indicator will use value 14 for calculations.
2022.07.17 15:25:48.610 Core 01 2022.03.30 20:00:00   Incorrect input parameter InpAtrPeriod = 0. Indicator will use value 14 for calculations.
...



Attachments
Strategy 133129.sqx
(298.05 KiB)
Screenshot_92.png
(91.27 KiB)
Screenshot_91.png
(264.65 KiB)
  • Votes +2
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

b
#1

bentra

17.07.2022 21:34

Task created

b
#2

bentra

17.07.2022 21:50
of course, the bar is never open during the OnInit so this is the problem:


  if(_sqIsBarOpen == true){       // Action #1         TPp = AssignVrbVleEntMlt1;       // Action #2         SLp = AssignVrbVleEntMlt2;       // Action #3         TPm = AssignVrbVleEntMlt3;       // Action #4         SLm = AssignVrbVleEntMlt4;       // Action #5         BarsValid = AssignVrbVleEntMlt5;       // Action #6         ExitAfterBars = AssignVrbVleEntMlt6;   }


Also, the whole init rule code needs to be moved up to execute BEFORE initIndicators inside the OnInit function!


b
#3

bentra

17.07.2022 21:52
Voted for this task.
b
#4

bentra

17.07.2022 22:01
Making it look like this fixed it.


//+------------------------------------------------------------------+ //| Expert initialization function                                   | //+------------------------------------------------------------------+ int OnInit(){    VerboseLog("--------------------------------------------------------");    VerboseLog("Starting the EA");    if(!checkComments()){       return(INIT_FAILED);    }    // OnInit  rules //------------------------ // Rule: init //------------------------       // Action #1         TPp = AssignVrbVleEntMlt1;       // Action #2         SLp = AssignVrbVleEntMlt2;       // Action #3         TPm = AssignVrbVleEntMlt3;       // Action #4         SLm = AssignVrbVleEntMlt4;       // Action #5         BarsValid = AssignVrbVleEntMlt5;       // Action #6         ExitAfterBars = AssignVrbVleEntMlt6;    //Show all subchart symbols in market watch    //initMagicNumber();    if(!initIndicators()) return(INIT_FAILED);        gPointCoef = calculatePointCoef(Symbol());    //VerboseLog("Broker stop level: ", SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL));    VerboseLog("--------------------------------------------------------");                  if(sqDisplayInfoPanel) {      sqInitInfoPanel();    }        SQTime = new CSQTime();


E
#5

Emmanuel

06.08.2022 15:36
Voted for this task.
g
#6

Lee Guan Chuan

01.09.2022 06:57

Status changed from New to Fixed


Votes: +2

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please