Analyzing Candlestick Patterns [ru] code error

 

 hi  All

I downloaded an indictaor(Analyzing Candlestick Patterns [ru] ) from MQL5  site articles.

when i compile it give a error {'TERMINAL_LANGUAGE' - can't convert enum candlestick_patterns.mq5 }

and the code is as below

asif1550@gmail.com 

//+------------------------------------------------------------------+
//|                                         Candlestick Patterns.mq5 |
//|                                                         VDV Soft |
//|                                                 vdv_2001@mail.ru |
//+------------------------------------------------------------------+
#property copyright "VDV Soft"
#property link      "vdv_2001@mail.ru"
#property version   "1.00"

#include "CandlestickType.mqh"

#property indicator_chart_window

//--- plot 1
#property indicator_label1  ""
#property indicator_type1   DRAW_LINE
#property indicator_color1  Blue
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- input parameters
input int   InpPeriodSMA=10;        // Period of averaging
input bool InpAlert=true;           // Enable. signal
input int InpCountBars=1000;        // Amount of bars for calculation
input color InpColorBull=DodgerBlue;// Color of bullish models
input color InpColorBear=Tomato;    // Color of bearish models
input bool  InpCommentOn=true;      // Enable comment
input int  InpTextFontSize=7;       // Font size
//---- indicator buffers
//--- indicator handles
//--- list global variable
string prefix="Patterns ";
datetime CurTime=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//--- We wait for a new bar
   if(rates_total==prev_calculated)
     {
      return(rates_total);
     }

////--- delete object
   string objname,comment;
//   for(int i=ObjectsTotal(0,0,-1)-1;i>=0;i--)
//     {
//      objname=ObjectName(0,i);
//      if(StringFind(objname,prefix)==-1)
//         continue;
//      else
//         ObjectDelete(0,objname);
//     }
   int objcount=0;
//---
   int limit;
   if(prev_calculated==0)
     {
      if(InpCountBars<=0 || InpCountBars>=rates_total)
         limit=InpPeriodSMA*2;
      else
         limit=rates_total-InpCountBars;
     }
   else
      limit=prev_calculated-1;
   if(!SeriesInfoInteger(Symbol(),0,SERIES_SYNCRONIZED))
      return(0);
// Variable of time when the signal should be given
   CurTime=time[rates_total-2];
// Determine the market (forex or not)
 
   bool _forex=false;
   if(SymbolInfoInteger(Symbol(),SYMBOL_TRADE_CALC_MODE)==(int)SYMBOL_CALC_MODE_FOREX) _forex=true;
 bool _language=TerminalInfoInteger (TERMINAL_LANGUAGE)== 1251; // Russian language of the terminal(This is the error point.kindly help anybod.Thank  you.Asif)
//--- calculate Candlestick Patterns
   for(int i=limit;i<rates_total-1;i++)
     {
      CANDLE_STRUCTURE cand1;
      if(!RecognizeCandle(_Symbol,_Period,time[i],InpPeriodSMA,cand1))
         continue;
/* Check patterns on one candlestick */
 
      //------     
      // Inverted Hammer, the bullish model
      if(cand1.trend==DOWN && // check direction of trend
         cand1.type==CAND_INVERT_HAMMER) // the "Inverted Hammer" check
        {
         comment=_language?"Inverted Hammer (Bull)":"Inverted Hammer";
         DrawSignal(prefix+"Invert Hammer the bull model"+string(objcount++),cand1,InpColorBull,comment);
        }
      // Hanging Man, the bearish model
      if(cand1.trend==UPPER && // check direction of trend
         cand1.type==CAND_HAMMER) // the "Hammer" check
        {
         comment=_language?"Hanging Man (Bear)":"Hanging Man";
         DrawSignal(prefix+"Hanging Man the bear model"+string(objcount++),cand1,InpColorBear,comment);
        }
      //------     
      // Hammer, the bullish model
      if(cand1.trend==DOWN && // check direction of trend
         cand1.type==CAND_HAMMER) // the "Hammer" check
        {
         comment=_language?"Hammer (Bull)":"Hammer";
         DrawSignal(prefix+"Hammer, the bull model"+string(objcount++),cand1,InpColorBull,comment);
        }
 

 
Asif:

 hi  All

I downloaded an indictaor(Analyzing Candlestick Patterns [ru] ) from MQL5  site articles.

when i compile it give a error {'TERMINAL_LANGUAGE' - can't convert enum candlestick_patterns.mq5 }

and the code is as below

Hi Asif, 

1. Please re-edit your comment again and this time use SRC button to post your code, it will much easier and help for us to read and copy paste.

 

2. I really don't know why MetaQuotes publish such an error codes, there's plenty of them in code bases and articles, and in Russian mql5 there are also complaint about it.

Try this, see if this work, that piece of code is only for showing comment anyway

 //bool _language=TerminalInfoInteger (TERMINAL_LANGUAGE)== 1251; // Russian language of the terminal
 string _language=TerminalInfoString (TERMINAL_LANGUAGE);

 

 

 

You should use TerminalInfoString (TERMINAL_LANGUAGE). It'll return string value.

Documentation on MQL5: Checkup / TerminalInfoString
Documentation on MQL5: Checkup / TerminalInfoString
  • www.mql5.com
Checkup / TerminalInfoString - Documentation on MQL5
 
Asif:

 hi  All

I downloaded an indictaor(Analyzing Candlestick Patterns [ru] ) from MQL5  site articles.

when i compile it give a error {'TERMINAL_LANGUAGE' - can't convert enum candlestick_patterns.mq5 }


 bool _language=TerminalInfoInteger (TERMINAL_LANGUAGE)== 1251; // Russian language of the terminal(This is the error point.kindly help anybod.Thank  you.Asif)

This error has been fixed. Please, download the updated attachments from the article Analyzing Candlestick Patterns