How to call an indicator from EA?

 
void CheckForOpen()

 {

    int trend;    double CLOSE_current = iClose(NULL, 0, 0);    double CLOSE_prev = iClose(NULL, 0, 1);  

 trend=iCustom(Symbol(),0, "parabolic sar (mtf) 2.01",AccStep,AccLimit,PriceHigh,PriceLow, PriceSmoothing ,PriceSmoothingMethod,alertsOn,alertsOnCurrent,alertsSound,alertsEmail ,alertsNotify ,DrawAsDots ,Interpolate, 0);      

     return;   

   //--END

 }



extern ENUM_TIMEFRAMES    TimeFrame            = PERIOD_CURRENT;   // Time frame to use

extern double             AccStep              = 0.03;             // Accumulation step

extern double             AccLimit             = 0.3;              // Accumulation limit

extern ENUM_APPLIED_PRICE PriceHigh            = PRICE_CLOSE;      // Psar high price

extern ENUM_APPLIED_PRICE PriceLow             = PRICE_CLOSE;      // Psar low price

extern int                PriceSmoothing       = 0;                // Psar smoothing

extern ENUM_MA_METHOD     PriceSmoothingMethod = MODE_SMA;         // Psar ma smoothing method

extern bool               alertsOn             = false;             // Alerts on?

extern bool               alertsOnCurrent      = false;            // Alerts on current open bar?

extern bool               alertsMessage        = true;             // Alerts message?

extern bool               alertsSound          = false;            // Alerts sound?

extern bool               alertsEmail          = false;            // Alerts email?

extern bool               alertsNotify         = false;            // Alerts notification by phone?

extern bool               DrawAsDots           = true;             // Draw as dots or solid line

extern bool               Interpolate          = false;             // Interpolate in multi time frame?



extern bool               DrawAverage          = true;             // Displayy average line?

extern int                Shift                = 0;                // Shift



extern ENUM_TIMEFRAMES    TimeFrame            = PERIOD_CURRENT;   // Time frame to use

extern double             AccStep              = 0.02;             // Accumulation step

extern double             AccLimit             = 0.2;              // Accumulation limit

extern ENUM_APPLIED_PRICE PriceHigh            = PRICE_CLOSE;      // Psar high price

extern ENUM_APPLIED_PRICE PriceLow             = PRICE_CLOSE;      // Psar low price

extern int                PriceSmoothing       = 0;                // Psar smoothing

extern ENUM_MA_METHOD     PriceSmoothingMethod = MODE_SMA;         // Psar ma smoothing method

extern bool               alertsOn             = true;             // Alerts on?

extern bool               alertsOnCurrent      = false;            // Alerts on current open bar?

extern bool               alertsMessage        = true;             // Alerts message?

extern bool               alertsSound          = false;            // Alerts sound?

extern bool               alertsEmail          = false;            // Alerts email?

extern bool               alertsNotify         = false;            // Alerts notification by phone?

extern bool               DrawAsDots           = true;             // Draw as dots or solid line

extern bool               DrawAverage          = true;             // Displayy average line?

extern int                Shift                = 0;                // Shift

extern bool               Interpolate          = true;             // Interpolate in multi time frame?

Please help to call the parabolic sar (mtf) 2.01 indicator from EA.  It takes the following parameters as input. Please see attached file. 

Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Smoothing Methods
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Smoothing Methods
  • www.mql5.com
Many technical indicators are based on various methods of the price series smoothing. Some standard technical indicators require specification of the smoothing type as an input parameter. For specifying the desired type of smoothing, identifiers listed in the ENUM_MA_METHOD enumeration are used.
Files:
call.png  20 kb
 

Forum on trading, automated trading systems and testing trading strategies


When you post code please use the CODE button (Alt-S)!

Use the CODE button

 
Sergey Golubev:
Sorry ..
Im using Handphone
 
Sergey, thanks for suggestion. Any help ? Thanks
 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  2. Your call
    Indicator inputs
    "parabolic sar (mtf) 2.01",
                                 
    AccStep,
    AccLimit,
    PriceHigh,
    PriceLow, 
    PriceSmoothing ,
    PriceSmoothingMethod,
    alertsOn,
    alertsOnCurrent,
                                 
    alertsSound,
    alertsEmail ,
    alertsNotify ,
    DrawAsDots ,
    Interpolate, 
                                 
    0
    );
    
    extern ENUM_TIMEFRAMES    TimeFrame            = PERIOD_CURRENT;
    extern double             AccStep              = 0.03;          
    extern double             AccLimit             = 0.3;             
    extern ENUM_APPLIED_PRICE PriceHigh            = PRICE_CLOSE;   
    extern ENUM_APPLIED_PRICE PriceLow             = PRICE_CLOSE;   
    extern int                PriceSmoothing       = 0;             
    extern ENUM_MA_METHOD     PriceSmoothingMethod = MODE_SMA;      
    extern bool               alertsOn             = false;         
    extern bool               alertsOnCurrent      = false;         
    extern bool               alertsMessage        = true;          
    extern bool               alertsSound          = false;         
    extern bool               alertsEmail          = false;         
    extern bool               alertsNotify         = false;         
    extern bool               DrawAsDots           = true;          
    extern bool               Interpolate          = false;         
    extern bool               DrawAverage          = true;          
    extern int                Shift                = 0;             
    
    
 
RAON03XX:
Sergey, thanks for suggestion. Any help ? Thanks

How many accounts do you have ?

input ENUM_TIMEFRAMES TimeFrame= PERIOD_CURRENT;   // Time frame to use
input double             AccStep              = 0.03;             // Accumulation step
input double             AccLimit             = 0.3;              // Accumulation limit
input ENUM_APPLIED_PRICE PriceHigh            = PRICE_CLOSE;      // Psar high price
input ENUM_APPLIED_PRICE PriceLow             = PRICE_CLOSE;      // Psar low price
input int                PriceSmoothing       = 0;                // Psar smoothing
input ENUM_MA_METHOD     PriceSmoothingMethod = MODE_SMA;         // Psar ma smoothing method
input bool               alertsOn             = false;             // Alerts on?
input bool               alertsOnCurrent      = false;            // Alerts on current open bar?
input bool               alertsMessage        = true;             // Alerts message?
input bool               alertsSound          = false;            // Alerts sound?
input bool               alertsEmail          = false;            // Alerts email?
input bool               alertsNotify         = false;            // Alerts notification by phone?
input bool               DrawAsDots           = true;             // Draw as dots or solid line
input bool               Interpolate          = false;             // Interpolate in multi time frame?
input bool               DrawAverage          = true;             // Displayy average line?
input int                Shift                = 0;                // Shift
input ENUM_TIMEFRAMES    TimeFrame            = PERIOD_CURRENT;   // Time frame to use
input double             AccStep              = 0.02;             // Accumulation step
input double             AccLimit             = 0.2;              // Accumulation limit
input ENUM_APPLIED_PRICE PriceHigh            = PRICE_CLOSE;      // Psar high price
input ENUM_APPLIED_PRICE PriceLow             = PRICE_CLOSE;      // Psar low price
input int                PriceSmoothing       = 0;                // Psar smoothing
input ENUM_MA_METHOD     PriceSmoothingMethod = MODE_SMA;         // Psar ma smoothing method
input bool               alertsOn             = true;             // Alerts on?
input bool               alertsOnCurrent      = false;            // Alerts on current open bar?
input bool               alertsMessage        = true;             // Alerts message?
input bool               alertsSound          = false;            // Alerts sound?
input bool               alertsEmail          = false;            // Alerts email?
input bool               alertsNotify         = false;            // Alerts notification by phone?
input bool               DrawAsDots           = true;             // Draw as dots or solid line
input bool               DrawAverage          = true;             // Displayy average line?
input int                Shift                = 0;                // Shift
input bool               Interpolate          = true;             // Interpolate in multi time frame?

   int buffer_number_to_get=0;
   int bar_to_get=0;
   double indicator_buffer_0=iCustom(Symbol(),TimeFrame,"parabolic sar (mtf) 2.01",PERIOD_CURRENT,AccStep,AccLimit,PriceHigh,PriceLow, PriceSmoothing ,PriceSmoothingMethod,false,false,false,false,false,false,Interpolate,buffer_number_to_get,bar_to_get);      

You can change the timeframes call sequence from Calling it on the current timeframe and sending in the indicator inputs the Target timeframe if you dont get the desired result

* You have to send the timeframe setting *

 

Hello All,

  I did edit my original post as per suggestion / rules.

  I am sending current time frame but still does not work.

  Please help.

Thanks.