MQL4 Programs

MQL4 Programs
    program running
        1.script 2.Expert advisor 3. indicator
        int OnInit()  1. 2. 3    allowto use void return type
        void OnDeinit() 1.2. 3 
        void OnStart()  1       Start event handler
        int OnCalculate( const int rates_total, const int prev_calculated,const datetime   
        &time[],const double &open[],const double &Hight[],const double &Low[],const double
        &Close[],const long &tickVolume[], const long &Volume[],const in &spread[])   3 
        Calculate event handler for all prices
        void Ontick()        2                   newTick event handler
        void OnTimer()     1, 2, 3                  timer event handler
        double OnTester()     2                      tester event handler
        void OnChartEvent(const int id, const long &lparam,const double &dparam,const string
        string &sparam)  2, 3   chartEvent
       
      funtions prohibited in Indicators and Expert Advisors
      The following functions are prohibited in indicators:
      OrderSend()
      SendFtp()
      sleep()
      ExpertRemove()
      Messagebox()
      the following functions are prohibited in Expert Advisors and scripts:
      SetIndexBuffer();
      IndicatorSetDouble()
      IndicatorSetInteger()
      IndicatorSetString()
     
      the above restrictions apply to the called library.
  
   Indicators are loaded in the follwing cases:
   an indicator is attached to a chart;
   terminal start(if the indicators was attached to the chart prior  to the shutdown of the terminal);
   loading of a template(if the indicator is attached to one of the profile charts);
   change of a symbol and or timeframe of a chart ,to which the indicator is attached.
   after the sucessful recompilation of an indicator(if the inidicators was attached to a chart);
   change of input parameter of the indicator.
  
   indicators are unloaded in the following cases:
   when detaching an indictor from a chart;
   terminal shutdown (if the indicator was attached to a chart);
   loading of a template(if an indicator is attached to a chart);
   closing od a chart to which the indicator was attched.
   change of a profile(if the indicator is attached to one of chartss of the changed profile);
   change of symbol and/ ortimeframe of a chart, to which the indicator is attached;
   change of input paraneters of the indicator.
  
  
   Expert Advisors are loading in the following cases:
   when attaching an expert advior  to a chart;
   terminal start(if the expert advisor was attached to the chart prir to the shutdown of the terminal);
   loading of a template(if the expert advisor attached to the chart is specified in the  template);
   change of a profile(if the expert advisor is attached to the one of the profile charts);
   connection to an account ,even if the account number is the sanme(if the  expert advisor was attached to the chart before the authorization of the terminal on the server).
  
   expert advisors are unloaded in the following cases:
   when detaching an expert advisor fron a chart
   if a new Expert advisor ia attched to a chart,if another expert advisor has been attached already,this expert advisor is unloaded.
   terminal shutdown(if the expoert Advisor was attached to a chart);
   loading  of a template(if an expert advisor is attached to teh chart);
   close of a chart, to which the expert advisor is attached.
   change of a profile (if the expert advisor attached to one of charts of the changed profile);
   change of the account to which the terminal is cinnected(if the expert advissor was attached to the chart before the authorization of the terminal on the server)
  
   calling the expertRemove() function.
  
  
 loading an unloading of scripts
 script are loaded immediately after they are attached to a chart and unloaded immediately after they complete their operation.
 
 input parameters and source code compilation.

上一篇:字符串练习


下一篇:李宏毅强化学习笔记【5.Imitation Learning】