Download MetaTrader 5
To add comments, please log in or register
Do you have idle PCs? Connect them to MQL5 Cloud Network and earn money!
milfordT
128
milfordT 2014.08.22 19:23 

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,

Carl Schreiber
5935
Carl Schreiber 2014.09.09 15:50  

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

There should be a solution for such offline-charts.

whroeder1
13596
whroeder1 2014.09.09 18:57  
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.
milfordT
128
milfordT 2014.09.15 15:05  
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?
milfordT
128
milfordT 2014.09.16 23:10  
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
5
eyalgiga 2014.11.13 08:02  

Well???

Nobody answered this importnat question yet!!!

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

Anobody??? 

Carl Schreiber
5935
Carl Schreiber 2014.11.13 11:26  
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?
eyalgiga
5
eyalgiga 2014.11.13 19:53  

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]);
  
  } 

Carl Schreiber
5935
Carl Schreiber 2014.11.13 21:26  

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[]?

/
To add comments, please log in or register