You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.
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. 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.
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.
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>