Access violation write to 0x769896FB in ...indy.ex4

 
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 1

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
//---
   return(INIT_SUCCEEDED);
  }
 
input int      FastMAPeriod =12; 
input int      SlowMAPeriod =26;
input int      SignalPeriod =9;
input ENUM_APPLIED_PRICE AppliedPrice =  PRICE_CLOSE ;  
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
    double os1  =  iOsMA(NULL, PERIOD_H4 ,FastMAPeriod ,SlowMAPeriod , SignalPeriod , AppliedPrice , 0); 
    return(rates_total);
  }

above code/indicator while loading crashes my terminal , saying not responding.

closely  looking at expert tab it say access violation write to 0x769896FB in myindy.ex4

after many hit and trail i found iOsMA called with timeframe other than default period of chart , it causes error.  i.e. if  chart period is h1  and iOSMA called with PERIOD_H1 it works smooth .

mt4 version : 4.00 build 920 

 can anyone give me possible reason why this is happening and guide me.

thanks advanced 

Files:
test.mq4  2 kb
 
 thanks for response , i thought there might be some issue in my code , do you see any  thing wrong with my code?
 

Your code looks finde to me and the bug you reported looks more like an address or pointer issue to me which may be caused by terminal.exe.

Even so, there is another thing you might like to test. The theory here is as follows: I believe that terminal.exe expects the input variables to show up somewhere at the beginning of your MQL4 file. Therefore you like to test this small modification and report back. Remove the yellow lines and put them at the beginning of your MQL4 file. Before the init OnInit(); function. Also make sure you remove all "unnecessary" white spaces in your declarations and variables. It might be that terminal.exe interprets the use of unncessary white spaces wrong. So please put the stuff in as I changed them. Also remove trailing white spaces behind the ";" symbol.

#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 1

input int      FastMAPeriod=12;
input int      SlowMAPeriod=26;
input int      SignalPeriod=9;
input ENUM_APPLIED_PRICE AppliedPrice = PRICE_CLOSE;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
//---
   return(INIT_SUCCEEDED);
  }
 
input int      FastMAPeriod =12;
input int      SlowMAPeriod =26;
input int      SignalPeriod =9;
input ENUM_APPLIED_PRICE AppliedPrice =  PRICE_CLOSE ;
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
    double os1  =  iOsMA(NULL, PERIOD_H4 ,FastMAPeriod ,SlowMAPeriod , SignalPeriod , AppliedPrice , 0); 
    return(rates_total);
  }
 
aakcaagac:

Your code looks finde to me and the bug you reported looks more like an address or pointer issue to me which may be caused by terminal.exe.

Even so, there is another thing you might like to test. The theory here is as follows: I believe that terminal.exe expects the input variables to show up somewhere at the beginning of your MQL4 file. Therefore you like to test this small modification and report back. Remove the yellow lines and put them at the beginning of your MQL4 file. Before the init OnInit(); function. Also make sure you remove all "unnecessary" white spaces in your declarations and variables. It might be that terminal.exe interprets the use of unncessary white spaces wrong. So please put the stuff in as I changed them. Also remove trailing white spaces behind the ";" symbol.

 thanks for your input ,

 i modified code as suggested by you , but same result  still i see the access violation error ,

 Point to note is : if  iOSMA is called with same timeframe as that of chart , it works okay but when other then default time frame  , it through this error and terminal crashes.

 if you don't mind , could you please run same file on your terminal and check if you facing same issue.

 what i am going to do is instead of calling iOSMA , i will test with other standard indicator and report you back.

 
terminal crash
 

tested with  iMA(NULL, PERIOD_M30 ,FastMAPeriod ,0 ,MODE_SMA , AppliedPrice , 0);

terminal is crashing again ,

does this mean we no longer able to run multi time frame indicators ? 

 

Depends how many indicators and timeframes you have and how big is the history base!

Just try that: Start a new indicator again and again until your EA, indicator or script crashes.

At least met4 hasn't been able (yet?) to free memory of requested indicators only self defined arrays can be freed.

 
gooly:

Depends how many indicators and timeframes you have and how big is the history base!

Just try that: Start a new indicator again and again until your EA, indicator or script crashes.

At least met4 hasn't been able (yet?) to free memory of requested indicators only self defined arrays can be freed.


  i have enough history in my terminal , the thing is indicator run on individual time frame with osma time same as chart time frame , but when you try attach indicator see the code file above , with osma timeframe other than chart's timeframe , it crashes the terminal , see the picture showing access violation error 
 
Code can not cause an access violation; exceeding an array causes

4002

ERR_ARRAY_INDEX_OUT_OF_RANGE

Array index is out of range

Access violation is an internal error in the terminal; report it.
 
WHRoeder:
Code can not cause an access violation; exceeding an array causes

4002

ERR_ARRAY_INDEX_OUT_OF_RANGE

Array index is out of range

Access violation is an internal error in the terminal; report it.
  yeah , i have reported the error at  service desk , waiting for their response.thanks
Reason: