Strange problem with this algorithm.

 

Both indicator and EA  stop working after few minutes, or when new candle starts.

They both rely on some algorithm and data from several currency pairs, using the iClose("XYZpair") function.

More specifically:  The indicator appears to be getting left behind,  not to be running after a while,  and I even use a remaining candle time   function to dsiplay

remaining time,  and this freezes up as well, when the problem occurs,  the problem is solved only if I manually press the complile button.



This has happened with this algorithm only,   I tried running the EA on the OnTimer()   function,  it makes no difference,  the code simply stops running after a while.

I tried using the RefreshRates() function,  no difference,    the timer simply stops, everything is freezes



A very good algorithm, which does predict EURUSD moves,  but it's useless as an EA.  While other more comlicated EAs  work fine,  this simpler one has this freezing up issue,  which

makes no sense



These indicators I have posted on the market, run exactly this algorithm,  if you downlowed and run the demo,  you will see it stop working after a while,  it gets left behind ignoring the new cnadle,  or simply freezes up on current candle and requires the user to change time frame back and forth in order to get it working again...


<Deleted>



Moreover

On the EA,  the strategy tester won't run it at all,  but if kept under supervision and I keep compiling every time freezing occurs,  the EA does trade,  now this problem prevents me from

making this EA available here.   And a solid algorithm is practically useless because of this,  if the problem is solved I could continue this effort and make 2-3 cool  EAs  specifically for EURUSD.



Does the problem sound familiar to anyone??








 

 
What does the "expert" tab print ? 

are you seeing any ArrayOutOfRangeor ZeroDividemessages
 
Lorentzos Roussos:
What does the "expert" tab print ? 

are you seeing any ArrayOutOfRangeor ZeroDividemessages

Hi


Yes I can see a zerodivide warning,      'GMX line'   is the indicator   same one as the one I have in the market,   'test only'  is the EA using the same algorithm

Files:
problem.jpg  286 kb
problem_2.jpg  171 kb
 
GEORGIOS VERGAKIS:

Hi


Yes I can see a zerodivide warning,      'GMX line'   is the indicator   same one as the one I have in the market,   'test only'  is the EA using the same algorithm

2019.11.05 22:00:24.009 2019.06.26 12:00:00  Eurusd Trend and Hidden Gap Detector GBPUSD,H1: zero divide in 'EURUSD Trend Detector.mq4' (94,123)

You should contact your developer . 
 
GEORGIOS VERGAKIS:

Do not post links to market products in your posts.

Do so again and you may be banned.

 
Lorentzos Roussos:

2019.11.05 22:00:24.009 2019.06.26 12:00:00  Eurusd Trend and Hidden Gap Detector GBPUSD,H1: zero divide in 'EURUSD Trend Detector.mq4' (94,123)


thanks for pointing out the problem,  there are several stages of division,   but  all of them involve currency rates,  which would never reach zero

I suspect these two divisions,  where the latest cancle of EURUSD is used (hence the problem occuring almost always at candle start time),  I will start troubleshooting from there.

 

Files:
issue.jpg  12 kb
 
GEORGIOS VERGAKIS:

thanks for pointing out the problem,  there are several stages of division,   but  all of them involve currency rates,  which would never reach zero

I suspect these two divisions,  where the latest cancle of EURUSD is used (hence the problem occuring almost always at candle start time),  I will start troubleshooting from there.

 

Go straight to the lines the debuger mentioned ,look at the divider value and follow it backwards to see why it reaches zero . 

lines : 94 ,155 ,135 

 
Keith Watford:

Do not post links to market products in your posts.

Do so again and you may be banned.

Sorry,  I didn't mean to break the rules,   thanks for correcting me on this
 
Lorentzos Roussos:

Go straight to the lines the debuger mentioned ,look at the divider value and follow it backwards to see why it reaches zero . 

lines : 94 ,155 ,135 

ok  I think I found it, nothing to do with currency rates,  it's  this part here,   this can in fact reach zero!  when the lines converge 


I was too focused on trying solving this using the RefreshRates() function  and totally ignored the real cause of the problem



Thanks a lot!,    please understand I am more into algorithms,  and I lack experience in coding,    I was too frustrated with this algorithm and I was about to throw it away.  Even so, it will still

take me days to make it work well,   even so,  it can still be wrong, it may be wrong about the pressumed high/low,   but with the addition of one more function this risk can be mitigated.


If I fail to solve this,  I will post a related job request, in the jobs section,  this part of the code is okay for me to show.

Files:
problem.jpg  15 kb