How to make the MT4 auto refresh itself? - page 2

 
edfiuza: I use an EA attached to offline chart using RangeBars and some indicators.
The generator must be running and sending a post message for the offline chart to update.
 
RaptorUK:
In that case your post is off topic for this thread . . . please search the forum or use Google to search this forum for tick

Maybe you should read the title of this thread... "How to make the MT4 auto refresh itself?"  edfiusa was only asking the same question "I would like to refresh the chart every "n" seconds."

I would like to have one as well.

 
G123: Maybe you should read the title of this thread... "How to make the MT4 auto refresh itself?"  edfiusa was only asking the same question "I would like to refresh the chart every "n" seconds." I would like to have one as well.
Maybe you should read the entire thread instead of just the title. There is no reason to refresh the chart. The chart is fine. It is the broken indicator that needs to be fixed.
 
All that is needed is a utility to autorefresh the chart instead of trying to find the author and convince to spend time updating indicator.  This occurs from time to time and such a utility would be useful for those times when the only problem with an indicator is updating the screen properly.  In an ideal world we could notify authors of such problems and they would drop what they're doing and update the code and make the executable available in a reasonable time but we don't live in an utopian world... far from it.  I've only seen one or two utilities to auto refresh and one of them is Symphony Autorefresh but it doesn't seem to do the job.
 
  1. There is no utility because it is unnecessary.
  2. It does not occur from time to time, it occurs with a broken indicator.
  3. Why would it be useful "with an indicator is updating the screen properly." If it's working properly, what's the problem.
  4. If you can't get it fixed, why would you want to depend on it? Who knows what else is wrong with it.
  5. If "Symphony Autorefresh", whatever that is, doesn't work, code something that does. "But it doesn't seem to do the job," likely because the indicator is broken.
 

I would like an Auto-Reload of a template. Is this possible?

Reason / Explanation: I am using an EA that makes one trade cycle per day, then ceases operation. I must manually reload the template with EA, to prompt the EA to begin a new cycle same day.

I would appreciate if there was something I could do to force the EA to restart operations (eg. auto-reloading template).

EA modification is not possible.

 
  1. Yes. Write an indicator that loads the template.
  2. Do you really want to rely on a broken EA? Will it pick up existing orders when it restarts? Will it open more orders on start?
 
William Roeder:
  1. Yes. Write an indicator that loads the template.
  2. Do you really want to rely on a broken EA? Will it pick up existing orders when it restarts? Will it open more orders on start?

1. Could the Indicator be attached to the same chart, so when Template is loaded with EA and Indicator, it will repeat itself?

2.a EA is not "broken" per se: it is set to cease after one trade cycle. If I set EA to continue trading, performance deteriorates.

2.b EA completes a cycle, meaning it will have 0 orders open when it restarts.

2.c EA begins a new cycle when it restarts. Hence I must manually reload Template to kickstart it, or otherwise I will only get one trade cycle per day.

 
Matthew Todorovski:

1. Could the Indicator be attached to the same chart, so when Template is loaded with EA and Indicator, it will repeat itself?

2.a EA is not "broken" per se: it is set to cease after one trade cycle. If I set EA to continue trading, performance deteriorates.

2.b EA completes a cycle, meaning it will have 0 orders open when it restarts.

2.c EA begins a new cycle when it restarts. Hence I must manually reload Template to kickstart it, or otherwise I will only get one trade cycle per day.

So code it, or ask someone to code it.
 

if you want an indicator or EA to reload a template, add this code lines to your indicator or EA code.

add this 2 lines of code to your code on top of the code where the functions are

//**********************Put this 2 lines on top of the code*********************************************//
extern   string            TemplateName               = "My_Template";          //Template File Name
extern   ENUM_TIMEFRAMES   TemplateLoadTime           = PERIOD_M1;   //Template Load Time
//******************************************************************************************************//

the add theses lines on void OnDeInit

//******************************Put this at the End of int OnInit ()********************//
void OnDeinit(const int reason)
{
// ObjectsDeleteAll();
 ChartRedraw();
}
//*------------------------------------------------------------------*
bool NewBar(int tf=PERIOD_CURRENT)
{
   static datetime BarsRef = iTime(_Symbol, tf, 0); //pass first time or set it to 0
   
   if( BarsRef == 0 || BarsRef < iTime(_Symbol, tf, 0))
   {
      BarsRef = iTime(_Symbol, tf, 0);
      return (true);
   }
   return(false);
}
//****************************************************************************************//

then add these lines on int OnCalculate for indicators or on void Ontick for EAs.

//***********************Put this on int OnCalculate( for indicators) or on void OnTick () (For EAs) *******************************************//      
          if(NewBar(TemplateLoadTime))
   {
      
      if(StringLen(TemplateName)>1)
      {
         Print("Change template result: ",ChartApplyTemplate(0,TemplateName));
      }
   }
 //**********************************************************************************************************************************************//

you are done you have your indicator or EA reloading every M1 to NM new bar you choose..

just make sure you have the indicador reloader loaded on Graphic before save the template with the name "My_Template ".

good luck


<ex4 file deleted>

Reason: