//+------------------------------------------------------------------+ //| iFrAMA get value.mq5 | //| Copyright © 2021, Vladimir Karputov | //| https://www.mql5.com/en/users/barabashkakvn | //+------------------------------------------------------------------+ #property copyright "Copyright © 2021, Vladimir Karputov" #property link "https://www.mql5.com/en/users/barabashkakvn" #property version "1.000" //--- input parameters input group "FrAMA" input int Inp_FrAMA_ma_period = 14; // FrAMA: averaging period input int Inp_FrAMA_ma_shift = 0; // FrAMA: horizontal shift of indicator input ENUM_APPLIED_PRICE Inp_FrAMA_applied_price = PRICE_CLOSE; // FrAMA: type of price input group "Additional features" input bool InpPrintLog = false; // Print log //--- int handle_iFrAMA; // variable for storing the handle of the iFrAMA indicator bool m_init_error = false; // error on InInit //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- create handle of the indicator handle_iFrAMA=iFrAMA(Symbol(),Period(),Inp_FrAMA_ma_period, Inp_FrAMA_ma_shift,Inp_FrAMA_applied_price); //--- if the handle is not created if(handle_iFrAMA==INVALID_HANDLE) { //--- tell about the failure and output the error code PrintFormat("Failed to create handle of the iFrAMA indicator for the symbol %s/%s, error code %d", Symbol(), EnumToString(Period()), GetLastError()); //--- the indicator is stopped early m_init_error=true; return(INIT_SUCCEEDED); } //--- ChartIndicatorAdd(ChartID(),0,handle_iFrAMA); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- if(handle_iFrAMA!=INVALID_HANDLE) IndicatorRelease(handle_iFrAMA); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { if(m_init_error) return; //--- double frama[]; ArraySetAsSeries(frama,true); int start_pos=0,count=3; if(!iGetArray(handle_iFrAMA,0,start_pos,count,frama)) return; //--- string text=""; int limit=(count>3)?3:count; for(int i=0; i