OnInit and OnTick never called when ea on offline chart

 

I was able to get some period converter indicators online. and generate different time period offline charts

 ATM_P4L_PeriodConverter_I

ATM_Period_Converter_opt 

 

However I can't get my EA to run on these offline charts.

I can see the offline chart price moving so I assume they are getting price ticks.

 

I put in print statements to see if OnInit or OnTick were being called and they are not.  I even tried stripping out all the logic excep for the print statements but I never see any of these prints happening in the log.

 

//+------------------------------------------------------------------+
//|                                                      Test123.mq4 |
//|                                                                  |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright ""
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Print("OnInit() EXECUTING");
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   Print("OnDeinit() EXECUTING");
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   Print("OnTick() EXECUTING");
   
  }
//+------------------------------------------------------------------+

Does anyone have a solution?

 

thanks,

 

I have never tried it but google for 'Renko-Chart' and 'offline'.

There should be a solution for such offline-charts.

 
milfordT: I put in print statements to see if OnInit or OnTick were being called and they are not.  I even tried stripping out all the logic excep for the print statements  
Strip out everything, doesn't change anything.
It is the offline chart generator that has to post the message to refresh the chart.
 
Hi WHRoeder. thanks for reply. It seems like that could be problem. However I do see the offline price changing I checked the souce and see that it is calling PostMessageA. PostMessageA(hwnd,WM_COMMAND,CHART_CMD_UPDATE_DATA,0); Does this need to change in some way?
 
I had to work on other things but came back to this today and found where the later versions of MT4 require Unicode and so I changed my PostMessageA calls to PostMessageW. Now init and deinit get called in my offline chart but OnTick() never gets called. I tried changing this to use start () but start () is not called either. I had to change to another EA as my test one caused the error 'Test123' is not an expert. Any help out there please? thanks
 

Well???

Nobody answered this importnat question yet!!!

Is it possible to call OnTick() function on an offline chart????

Anobody??? 

 
eyalgiga:

Well???

Nobody answered this importnat question yet!!!

Is it possible to call OnTick() function on an offline chart????

Anobody??? 

I guess not - may be you can use OnTimer() as repeating function?
 

OnTimer() works good but when I'm trying to get real-time data from Renko charts (such as Open[], Close[], Bars), I don't get the real values,

All I get is constant values each time OnTimer()  is called. For example, below code displays the same value (by Alert function)

 Any idea why?

 

int OnInit()
  {
//--- create timer
   EventSetTimer(1);
     
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
     
  }

//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
  
    Alert (Close[1]);
  
  } 

 

1) Please use SRC beside the camera!

2) As the name says it it's offline - you have to catch the relevant data you need yourself - I guess .

3) Try (I have no experience) to use iClose("EURUSD",PERIOD_M1, ..) instead of Close[]?

 
milfordT:
I had to work on other things but came back to this today and found where the later versions of MT4 require Unicode and so I changed my PostMessageA calls to PostMessageW. Now init and deinit get called in my offline chart but OnTick() never gets called. I tried changing this to use start () but start () is not called either. I had to change to another EA as my test one caused the error 'Test123' is not an expert. Any help out there please? thanks

@eyalgiga / @milfordT

Did you get the solution to this problem?

I am in 2018, and i have the same problem. Build a EA to work in a offline renko chart but it doesn´t work because onTick() and start() are not called.


Thanks guys

 
Talita Laura Bispo Da Silva:

@eyalgiga / @milfordT

Did you get the solution to this problem?

I am in 2018, and i have the same problem. Build a EA to work in a offline renko chart but it doesn´t work because onTick() and start() are not called.


Thanks guys

The solution is to use eventchartcustom in the generator to notify the offline chart of the tick through the onchartevent handler.  You can also quickly serialize a bunch of data and pass it through the string param as csv and parse it on the other end for rapid transfers of data between charts.
Reason: