EA updates when using a strategy back tester but doesn't update when using live demo trading

 
Hi! I created a script that is able to update one minute calculations every one minute. It is a multi time frame EA that uses both a daily and one minute time frame. The daily time frame updates but the one minute time frame doesn't update when using a demo live account trading. When using the strategy back tester both the one minute and daily time frame update accordingly as instructed. Does anyone know where I might have gone wrong? This is seen with the XAGEUR pairs with the one minute time frame of the OS indicator calculations.
 

Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893

You have been informed of this multiples times. Please make sure to post in the correct section.


 
Fernando Carreiro #: Your topic has been moved to the section: Expert Advisors and Automated Trading. Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893. You have been informed of this multiples times. Please make sure to post in the correct section.

Okay, thank you.

 
Colin Kimble: Hi! I created a script that is able to update one minute calculations every one minute. It is a multi time frame EA that uses both a daily and one minute time frame. The daily time frame updates but the one minute time frame doesn't update when using a demo live account trading. When using the strategy back tester both the one minute and daily time frame update accordingly as instructed. Does anyone know where I might have gone wrong? This is seen with the XAGEUR pairs with the one minute time frame of the OS indicator calculations.

Your EA code is only detecting a new bar event on the current time-frame (namely the daily chart as per your screenshot).

Hence, your M1 indicators are only updated "daily" and not on every M1 bar.

You need to detect both time-frames independently, and make sure to synchronise the data.

Correction: You are in fact detecting the M1. I missed that. I will look at the code more carefully and get back later.

 
Fernando Carreiro #:

Your EA code is only detecting a new bar event on the current time-frame (namely the daily chart as per your screenshot).

Hence, your M1 indicators are only updated "daily" and not on every M1 bar.

You need to detect both time-frames independently, and make sure to synchronise the data.

Correction: You are in fact detecting the M1. I missed that. I will look at the code more carefully and get back later.

I really do appreciate how helpful you have been to me! Thank you so much!

 

Ok, I think I spotted the bug ...

   static datetime dtBarCurrentOneMinute  = WRONG_VALUE;
   datetime dtBarPreviousOneMinute = dtBarCurrentOneMinute;
   dtBarCurrentOneMinute  = iTime(_Symbol,PERIOD_M1, 0);
   bool     bNewBarEventOneMinute  = (dtBarCurrentOneMinute != dtBarPreviousOneMinute);

   if(bNewBarEvent)
     {

You are using the wrong variable. You are checking "bNewBarEvent" instead of "bNewBarEventOneMinute".

I did not look any further once I spotted the above bug. There may be other bugs. So, dedicate some time to look for any other bugs.

 
Fernando Carreiro #:

Ok, I think I spotted the bug ...

You are using the wrong variable. You are checking "bNewBarEvent" instead of "bNewBarEventOneMinute".

I did not look any further once I spotted the above bug. There may be other bugs. So, dedicate some time to look for any other bugs.

Thank you for all your help and wisdom!