  MQL5:     MetaTrader5.  2-,  
 


        MQL5   MetaTrader 5.  ,   .





  MQL5:     MetaTrader5

 2-,  



 



 ,2020



ISBN978-5-4496-8185-0

     Ridero







       https://github.com/novts/MetaTrader-5-Creating-Trading-Robots-and-Indicators-with-MQL5 (https://github.com/novts/MetaTrader-5-Creating-Trading-Robots-and-Indicators-with-MQL5)







,      MQL5  https://www.mql5.com/ru/docs.








     ,    .         .

   :

       MQL5-    .

Ƞ  : ,  , ,   .

     ,     ,     .

    ,           .

        .       MQL5,    ,    .

    MQL5     - ,     MQL5-     ࠖ     .

         ,  - .      .




 


    - ,             MQL5 .








      ,  ,   ,                  .

,   ?

   .

  ,       ,   ,    .

       .

   ?

FOREX     Foreign Exchange,    .

   ,    ,          -  .

     ,  ,  ,  ,  ,  ,   ..

,                 - .

Ƞ    .     1   , 젖 5 10 .

      -   , ,   -   .

Ƞ      ,   .

    ?

 , ,  ,     堖 ,      (   ),          ,    .

     ,             .

        ,      .

    ,  ,       ,     ,  蠖  , ,  .

    Forex       .

      ,  ,  .

Ƞ      ,    (),     ,     ,     .

     ,  ,     .

       (Reuters, Bloomberg, Dow Jones .),     ,    .

 ,    ,     ,     .

 ,     ,    ,      .

    ,        ,     蠖 ,  ,    .

  ,          12,      ,       - , ,            .

,     ?

    ,             .

Ƞ,     ,      , ,  , ,     .

,  ,               .

    ,        ,    ,   .       ,   .

 ,  ,            ,   ,    ,      . ,      .

       ,   .

   ,    - ,             MQL5 .

     ,    ,        - ,     .








 , ,   Forex Club.

    ,     .

    , , - .








  -   MetaTrader5.

Forex Club    :

  (Instant Execution)

        .    ,      .

Ƞ  (Market Execution)

               .

     (Instant Execution).








    MetaTrader5.








Ƞ  Forex Club,     .

,       ,    ,   .








  MetaTrader 5    Forex,   .

Ѡ MetaTrader 5     ,       .








    MetaTrader 5      .

    ,         ,    .








   MetaTrader 5,    MQL5,      ,     MetaTrader5.

MetaEditor      ,   MetaTrader.

Ѡ MetaEditor    ,  , ,     .








  MetaEditor    ,     .

     .




  


       MetaEditor.








        .

 ,    ,    ,        .








      .

        ,  ,     ,  ,  ,    , .

       MetaTrader 5     .

    ,   ,     ,       ,      ,   ,    ,     .

         OnInit (), OnDeinit (), OnCalculate () OnChartEvent().

  OnInit () ,  ,       ,    ,   ,    ,      .  ,  OnInit ()           .

  OnDeinit () ,  ,      ,      .

  OnCalculate ()     ,      ,   OnInit ()     ,       .  ,  OnCalculate ()        .

  OnChartEvent ()   ,    ,        ,     .

   ,        ,      OnInit (), OnDeinit (), OnCalculate () OnChartEvent().








       ,       .








              .




 


     .








 :

  (#property). Ӡ mql5-      #property,            .        . ,   ,  .     mq5-: #property  .

      #include,      .

 렖     .       , ,     .     ,   , -       .

     ,   ,     #include  .     ⠖  <_> \MQL5\Include,     #include  .

    ,  ,   , :

#property copyright

    :

#propertylink

    ,       description, :

#property description Average Directional Movement Index

   :

#property version 1.00

,  ,     .

      蠖        .

:

#property indicator_chart_window

    .

:

#property indicator_separate_window

    .

    ࠖ      , :

#property indicator_buffers6

       ࠖ      .

      ,  .

,  ADX:

#property indicator_plots3

    ()   +DI,   DI  ADX.

  頖    ,    .

,  ADX:

#property indicator_type1 DRAW_LINE

#property indicator_type2 DRAW_LINE

#property indicator_type3 DRAW_LINE

 ,    ADX  .

        ,   indicator_type.

       indicator_colorN.

,  ADX:

#property indicator_color1 LightSeaGreen

#property indicator_color2 YellowGreen

#property indicator_color3 Wheat

       ,   indicator_color.








  MQL5   Web-     .








      .

           ,       ,      .

  ,    ,   ,     .

     OnInit ()    SetIndexBuffer.

,  ADX:

SetIndexBuffer (0,ExtADXBuffer);

SetIndexBuffer (1,ExtPDIBuffer);

SetIndexBuffer (2,ExtNDIBuffer);

  ,    .

 ,    ,     .

     .

     ,     .

  ?

 ,   ,   ,     ,   .

,  ADX:

SetIndexBuffer (3,ExtPDBuffer, INDICATOR_CALCULATIONS);

SetIndexBuffer (4,ExtNDBuffer, INDICATOR_CALCULATIONS);

SetIndexBuffer (5,ExtTmpBuffer, INDICATOR_CALCULATIONS);

      INDICATOR_CALCULATIONS.

  :

    .

 ,   SetIndexBuffer,  , ..    ,       SetIndexBuffer,     ,       .

   ADX.








  MQL5,  Navigator (),  Indicators-> Examples     ADX.

  OnInit ()  :

// SetIndexBuffer (5,ExtTmpBuffer, INDICATOR_CALCULATIONS);

  ExtTmpBuffer    .

       MetaTrader5.








    .

array out ofrange

  ,              .

      ,     - .

      , ..     ,           OnCalculate    OnCalculate  ,   open [], high [], low [], close[].

   open [], high [], low [], close [] ,     rates_total.








,    OnCalculate   ArrayResize,    :

ArrayResize (ExtTmpBuffer, rates_total);

     rates_total   ,   .

      .

 ,   OnCalculate        , ..  rates_total ,       ,    OnCalculate,                .

    ,          .

  ,          SetIndexBuffer      .








  ,         CopyBuffer,        .

 CopyBuffer        .

    ,       INDICATOR_CALCULATIONS .

        ,  CopyBuffer      1,          -,       . Ƞ    ArrayResize     .








   ,           ?

-,   ,         , :

#property indicator_type1 DRAW_COLOR_LINE

      COLOR.

   #property indicator_buffers         .








 SetIndexBuffer       , :

SetIndexBuffer (1,ExtColorsBuffer, INDICATOR_COLOR_INDEX);

  #property indicator_color,   ,   , :

#property indicator_color1 Red, Green,Blue








, ,   ,    ,   ,   #property indicator_color.

  ,  0, 12.

    ,    ,       ,    .








  #property indicator_color,       :

        :

PlotIndexSetInteger (0,PLOT_COLOR_INDEXES,3);

Ƞ      :

PlotIndexSetInteger (0,PLOT_LINE_COLOR,0,Red);

     ,      0.

  :

#property indicator_color1 Red, Green,Blue








    .

      indicator_widthN,  N   , :

#property indicator_width11

      ࠖ  , , , -,    indicator_styleN,  N   , :

#property indicator_style1 STYLE_SOLID

, ,  indicator_labelN     DataWindow   , :

#property indicator_label1 ADX

#property indicator_label2 "+DI

#property indicator_label3 "-DI








     .

      ,        , :








#property indicator_level130.0

#property indicator_levelcolorRed

#property indicator_levelstyle STYLE_SOLID

#property indicator_levelwidth2

       ADX,    .








,   ADX,     MetaTrader 5, -,    ,       copyright, link description.








     indicator_label, indicator_color, indicator_width, indicator_style.

      .

ʠ ,         ,   ,        .








      Navigator   ,   copyright.








   :

#property indicator_label1 ADX

 ,    OnInit ()   :

string short_name=ADX (+string (ExtADXPeriod) +);

IndicatorSetString (INDICATOR_SHORTNAME, short_name);

   ADX (14)  .








 :

PlotIndexSetString (0,PLOT_LABEL, short_name);

     ,     .

 :

#property indicator_label2 "+DI

#property indicator_label3 "-DI

,   ,        .








   ADX     ,    .

 indicator_buffers 6

 indicator_plots 3

   ,        .

  ExtPDBuffer, ExtNDBuffer ExtTmpBuffer.

  OnCalculate ,   ExtPDBuffer, ExtNDBuffer, ExtTmpBuffer     ,        ExtADXBuffer, ExtPDIBuffer, ExtNDIBuffer,      .

   ,         INDICATOR_CALCULATIONS,        .








,   ADX ,:

   ,  +DI  堖 DI    ADX .

 ,  +DI  堖 DI,  ADX  ,    ,       .

   ,  +DI  堖 DI   ADX .

 ,  +DI  堖 DI,  ADX  ,    ,       .

,    ADX  ,    ADX  ,       .








      indicator_type1 DRAW_COLOR_LINE.

     indicator_buffers 7.

     ExtColorsBuffer.








Ƞ OnInit ()        SetIndexBuffer.

           .

, ,   ExtColorsBuffer   6,     .








  indicator_color1  .

Ƞ     indicator_width1.








  OnCalculate      for          .








        :








  MQL5     ExamplesRSI.

     ,     .

       :

#property indicator_level130

#property indicator_level270

    ,    .








   :

#property indicator_levelcolorRed

#property indicator_levelstyle STYLE_SOLID

#property indicator_levelwidth1

     .








   

     ,            .








,   MACD       .

      ,      .

         ,        .








      input   input,     .  , input      .

,   MACD  

     ,      ,         ,   .

   ,         ,  .

  ,     .








    .

  , ,  ,    ,      .

  ,        , ,     .








  MACD    ENUM_APPLIED_PRICE,     .

    .








    #property script_show_inputs   ,     .

  input      ,          .

       ,    .








,          ,    .








 input  MQL5-   ,  ,   extern .








Ѡ    ,    , ,   ,  , ,    , ,      , .

   ,    ,    new,       delete   .

 ,  ,    ,     ,  .

     ,         ,       ,    .

 ,  input     ,  蠖        .

       const          .

    static,     .

    ,    ,      .

 ,  ,  ,   ,    .

 ,      static.

  ,    , ,    , . Ƞ     ,      .

          ,    .

extern      .      extern.

 extern         MACD.








 MACD    MovingAverages,    #include   Include.

  MovingAverages  MACD   extern-:

extern inta=0;

       ,    .

  MovingAverages  MACD     :

static inta=0;

      .








  #include     #define,       , :








#define PI3.14




 


 :

HANDLE  ,    .   Windows  .








  handle           ,    .

 ,    ,         .

      int ,  ,     ,   ,   MACD:








  ࠖ int ExtFastMaHandle int ExtSlowMaHandle.

  ⠖        1226.

  ,     ,    ,     ,  .

              .

   ,             .








       iMA.

Ƞ MACD         iMA  OnInit().








   ࠖ InpFastEMA, InpSlowEMA InpAppliedPrice.

,     ,  .








  Indicators/Examples  MQL5       Custom Moving Average.mq5.

      iCustom.








  OnInit ()  MACD  ,       ,   iCustom.








    ,     .








      ,    IndicatorCreate.








  OnInit ()  MACD  ,       IndicatorCreate.








     ,     .

   ,      ,       IndicatorRelease.








       .

,    .     ?

   OnCalculate   CopyBuffer.








   CopyBuffer ()        .

,   ,       .

     ,      ,       ,    .

  MACD   .








  ExtFastMaBuffer ExtSlowMaBuffer      SetIndexBuffer.








Ƞ      Moving Average      CopyBuffer.








    ExtFastMaBuffer ExtSlowMaBuffer  ,     .

  ,      to_copy    ,  to_copy=1    ExtFastMaBuffer ExtSlowMaBuffer,      1.

     ArrayResize  ,    CopyBuffer       1.

     -,    . Ƞ  -    ,  , ,      .




 OnInit


  ,  OnInit (), OnDeinit (), OnCalculate ()       .








 OnInit ()          .

       ,   ,     ,     .

      .

   ,        SetIndexBuffer.








 data_type   INDICATOR_DATA (   , ,  ), INDICATOR_COLOR_INDEX ( ), INDICATOR_CALCULATIONS (   ).

   SetIndexBuffer  ,       ,    .

    INDICATOR_COLOR_INDEX     INDICATOR_DATA,     INDICATOR_COLOR_INDEX       INDICATOR_DATA.




  .


   .

   ,     (https://www.litres.ru/book/timur-mashnin-301845/yazyk-programmirovaniya-mql5-prodvinutoe-ispolzovanie-42597290/chitat-onlayn/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


