Use MetaTrader like watching SlideShow or animated movie
okwh | 8 October, 2014
Use MetaTrader like watching SlideShow or animated movie
Introduction
Generally, we have multiple charts showing in metatrader.
BUT, if you use tile-mode to layout, those charts will be too small to display the change of market clearly, expecially you have not multiple monitores.
if you use cascade-mode to layout, those charts will shade each other, you have to display them one by one with mouse-click.
Now, from now ,with this indicator, You can observe the forex market like watching cartoons, like autoplay PPT slides!
MQL4 code :
#property indicator_chart_window //#property indicator_separate_window #property indicator_buffers 0 //extern---- input parameters extern int SecN=8; int init() { return(0); } int deinit() { return(0); } long prevChart=-1; datetime lasttime =0; int start() { if (lasttime>(TimeCurrent()-SecN)) return(0); lasttime=TimeCurrent(); if (prevChart==-1) prevChart=ChartFirst(); else prevChart=ChartNext(prevChart); ChartSetInteger(prevChart,CHART_BRING_TO_TOP,0,true); return(0); }
MQL5 code:
#property indicator_chart_window extern int SecN=6; int OnInit() { EventSetTimer(SecN); return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { EventKillTimer(); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ long prevChart=-1; void OnTimer() { if (prevChart==-1) prevChart=ChartFirst(); else prevChart=ChartNext(prevChart); ChartSetInteger(prevChart,CHART_BRING_TO_TOP,0,true); }
note:
(1) add this indicator to one chart only !
(2) in new MQL4, MQL5 code also can be used.
(3) in MQL5, have to use timer-event to do this, timer is effect in indicator, althrough manuals shown time used in EA only.
Conclusion
Now we can use MetaTrader in animation way. Chart windows can be display automatically like SildeShow, release ourself!!