Convert mq4 to mq5 with converter problem
-
So i trried to convert an indicator from mq4 to mq5 and it didnt quite work, does anyone know what to do next? 0_1552604782697_Jurik filter for EA.mq4
image url) -
If mq4 had not been created with fxdreema, it might not convert in conveter tool as I believe. Maybe an admin can confirm this...
-
@vish ahh good to know thanks!
-
The idea of the tool is to work with every program, but it doesn't, I know that it sometimes fails. And I know for sure that it fails with programs made with fxDreema (because of few constants that I need to review), but it's not supposed to work with fxDreema programs, because you can just create MQL5 project in fxDreema anyway.
I fixed some problems in the code and the result looks almost like the original, with some brown lines that should not be there:

#define OP_BUY 0 #define OP_SELL 1 #define OP_BUYLIMIT 2 #define OP_SELLLIMIT 3 #define OP_BUYSTOP 4 #define OP_SELLSTOP 5 #define MODE_OPEN 0 #define MODE_LOW 1 #define MODE_HIGH 2 #define MODE_CLOSE 3 #define MODE_VOLUME 4 #define MODE_TIME 5 #define MODE_TRADES 0 #define MODE_HISTORY 1 #define SELECT_BY_POS 0 #define SELECT_BY_TICKET 1 #define LONG_VALUE 4 #define FLOAT_VALUE 4 #define DOUBLE_VALUE 8 #define CHART_BAR 0 #define CHART_CANDLE 1 #define MODE_ASCEND 1 #define MODE_DESCEND 2 #define MODE_BID 9 #define MODE_ASK 10 #define MODE_POINT 11 #define MODE_DIGITS 12 #define MODE_SPREAD 13 #define MODE_STOPLEVEL 14 #define MODE_LOTSIZE 15 #define MODE_TICKVALUE 16 #define MODE_TICKSIZE 17 #define MODE_SWAPLONG 18 #define MODE_SWAPSHORT 19 #define MODE_STARTING 20 #define MODE_EXPIRATION 21 #define MODE_TRADEALLOWED 22 #define MODE_MINLOT 23 #define MODE_LOTSTEP 24 #define MODE_MAXLOT 25 #define MODE_SWAPTYPE 26 #define MODE_PROFITCALCMODE 27 #define MODE_MARGINCALCMODE 28 #define MODE_MARGININIT 29 #define MODE_MARGINMAINTENANCE 30 #define MODE_MARGINHEDGED 31 #define MODE_MARGINREQUIRED 32 #define MODE_FREEZELEVEL 33 #define MODE_CLOSEBY_ALLOWED 34 #define EMPTY -1 #define MODE_MAIN 0 #define MODE_SIGNAL 1 #define MODE_PLUSDI 1 #define MODE_MINUSDI 2 #define MODE_UPPER 1 #define MODE_LOWER 2 #define MODE_GATORJAW 1 #define MODE_GATORTEETH 2 #define MODE_GATORLIPS 3 #define MODE_TENKANSEN 1 #define MODE_KIJUNSEN 2 #define MODE_SENKOUSPANA 3 #define MODE_SENKOUSPANB 4 #define MODE_CHIKOUSPAN 5 #define MODE_CHINKOUSPAN 5 #define OBJPROP_TIME1 2000 #define OBJPROP_PRICE1 2001 #define OBJPROP_TIME2 2002 #define OBJPROP_PRICE2 2003 #define OBJPROP_TIME3 2004 #define OBJPROP_PRICE3 2005 #define OBJPROP_FIBOLEVELS 2006 #property copyright "www.forex-station.com" #property link "www.forex-station.com" //------------------------------------------------------------------ #property indicator_chart_window #property indicator_buffers 7 #property indicator_plots 5 #property indicator_color1 clrLime #property indicator_color2 clrOrange #property indicator_color3 clrOrange #property strict // // // // // enum enPrices { pr_close, // Close pr_open, // Open pr_high, // High pr_low, // Low pr_median, // Median pr_typical, // Typical pr_weighted, // Weighted pr_average, // Average (high+low+open+close)/4 pr_medianb, // Average median body (open+close)/2 pr_tbiased, // Trend biased price pr_tbiased2, // Trend biased (extreme) price pr_haclose, // Heiken ashi close pr_haopen , // Heiken ashi open pr_hahigh, // Heiken ashi high pr_halow, // Heiken ashi low pr_hamedian, // Heiken ashi median pr_hatypical, // Heiken ashi typical pr_haweighted, // Heiken ashi weighted pr_haaverage, // Heiken ashi average pr_hamedianb, // Heiken ashi median body pr_hatbiased, // Heiken ashi trend biased price pr_hatbiased2, // Heiken ashi trend biased (extreme) price pr_habclose, // Heiken ashi (better formula) close pr_habopen , // Heiken ashi (better formula) open pr_habhigh, // Heiken ashi (better formula) high pr_hablow, // Heiken ashi (better formula) low pr_habmedian, // Heiken ashi (better formula) median pr_habtypical, // Heiken ashi (better formula) typical pr_habweighted,// Heiken ashi (better formula) weighted pr_habaverage, // Heiken ashi (better formula) average pr_habmedianb, // Heiken ashi (better formula) median body pr_habtbiased, // Heiken ashi (better formula) trend biased price pr_habtbiased2 // Heiken ashi (better formula) trend biased (extreme) price }; enum enDisplay { en_lin, // Display line en_lid, // Display lines with dots en_dot // Display dots }; enum enFilterType { flt_val, // Apply filter to jurik value flt_prc, // Apply filter to price flt_all // Apply filter to all }; input ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT; // Time frame input int Length = 15; // Jurik and filter period to use input double Phase = 0.0; // Jurik phase input bool Double = false; // Jurik smooth double input enPrices Price = pr_haweighted; // Price to use input double Filter = 0; // Filter to use for filtering (<=0 for no filtering) input enFilterType FilterType = flt_all; // Filter should be applied to : input enDisplay DisplayType = en_lin; // Display type input int Shift = 0; // JMA shift input int LinesWidth = 3; // Lines width (when lines are included in display) input bool ArrowOnFirst = true; // Arrow on first bars input int UpArrowSize = 2; // Up Arrow size input int DnArrowSize = 2; // Down Arrow size input int UpArrowCode = 159; // Up Arrow code input int DnArrowCode = 159; // Down arrow code input double UpArrowGap = 0.5; // Up Arrow gap input double DnArrowGap = 0.5; // Dn Arrow gap input color UpArrowColor = clrLimeGreen; // Up Arrow Color input color DnArrowColor = clrOrange; // Down Arrow Color input bool Interpolate = true; // Interpolate in multi time frame mode? // // // // ENUM_TIMEFRAMES TimeFrame2 = TimeFrame; double jur[],jurDa[],jurDb[],arrowu[],arrowd[],trend[],count[]; string indicatorFileName; #define _mtfCall(_buff,_ind) iCustom(NULL,TimeFrame2,indicatorFileName,PERIOD_CURRENT,Length,Phase,Double,Price,Filter,FilterType,DisplayType,0,0,ArrowOnFirst,UpArrowSize,DnArrowSize,UpArrowCode,DnArrowCode,UpArrowGap,DnArrowGap,UpArrowColor,DnArrowColor,_buff,_ind) //+------------------------------------------------------------------ //| | //+------------------------------------------------------------------ // // void OnInit() { int lstyle = DRAW_LINE; if (DisplayType==en_dot) lstyle = DRAW_NONE; int astyle = DRAW_ARROW; if (DisplayType<en_lid) astyle = DRAW_NONE; SetIndexBuffer(0,jur,INDICATOR_DATA,true); SetIndexStyle(0,lstyle,EMPTY,LinesWidth); SetIndexBuffer(1,jurDa,INDICATOR_DATA,true); SetIndexStyle(1,lstyle,EMPTY,LinesWidth); SetIndexBuffer(2,jurDb,INDICATOR_DATA,true); SetIndexStyle(2,lstyle,EMPTY,LinesWidth); SetIndexBuffer(3,arrowu,INDICATOR_DATA,true); SetIndexStyle(3,astyle,0,UpArrowSize,UpArrowColor); SetIndexArrow(3,UpArrowCode); SetIndexBuffer(4,arrowd,INDICATOR_DATA,true); SetIndexStyle(4,astyle,0,DnArrowSize,DnArrowColor); SetIndexArrow(4,DnArrowCode); SetIndexBuffer(5,trend,INDICATOR_DATA,true); SetIndexBuffer(6,count,INDICATOR_DATA,true); indicatorFileName = WindowExpertName(); TimeFrame2 = fmax(TimeFrame,_Period); IndicatorShortName(timeFrameToString(TimeFrame2)+" JMA("+(string)Length+")"); return; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnCalculate(const int _rates_total, // size of input time series const int _prev_calculated, // bars handled in previous call const datetime& _time[], // Time const double& _open[], // Open const double& _high[], // High const double& _low[], // Low const double& _close[], // Close const long& _tick_volume[], // Tick Volume const long& _volume[], // Real Volume const int& _spread[] // Spread ) { FXD_ONCALCULATE_FAIL = false; // will be set to true if some indicator won't load int Bars = _rates_total; int i,counted_bars=((_prev_calculated>0)?_prev_calculated-1:0); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = fmin(Bars-counted_bars,Bars-1); count[0] = limit; if (TimeFrame2 != _Period) { limit = (int)fmax(limit,fmin(Bars-1,_mtfCall(7,0)*TimeFrame2/_Period)); if (trend[limit]==-1) CleanPoint(limit,jurDa,jurDb); for (i=limit;i>=0 && !_StopFlag; i--) { int y = iBarShift(NULL,TimeFrame2,iTime(_Symbol,_Period,i)); int x = y; if (ArrowOnFirst) { if (i<Bars-1) x = iBarShift(NULL,TimeFrame2,iTime(_Symbol,_Period,i+1)); } else { if (i>0) x = iBarShift(NULL,TimeFrame2,iTime(_Symbol,_Period,i-1)); else x = -1; } jur[i] = _mtfCall(0,y); jurDa[i] = EMPTY_VALUE; jurDb[i] = EMPTY_VALUE; arrowu[i] = EMPTY_VALUE; arrowd[i] = EMPTY_VALUE; trend[i] = _mtfCall(5,y); if (x!=y) { arrowu[i] = _mtfCall(3,y); arrowd[i] = _mtfCall(4,y); } // // // // // if (!Interpolate || (i>0 && y==iBarShift(NULL,TimeFrame2,iTime(_Symbol,_Period,i-1)))) continue; #define _interpolate(buff) buff[i+k] = buff[i]+(buff[i+n]-buff[i])*k/n int n,k; datetime time = iTime(NULL,TimeFrame2,y); for(n = 1; (i+n)<Bars && iTime(_Symbol,_Period,i+n) >= time; n++) continue; for(k = 1; k<n && (i+n)<Bars && (i+k)<Bars; k++) _interpolate(jur); } for(i=limit; i>=0; i--) if (trend[i]==-1) PlotPoint(i,jurDa,jurDb,jur); return(0); } // // // // // if (trend[limit]==-1) CleanPoint(limit,jurDa,jurDb); double pfilter = Filter; if (FilterType==flt_val) pfilter=0; double vfilter = Filter; if (FilterType==flt_prc) vfilter=0; double open[], close[], high[], low[]; for(i=limit; i>=0; i--) { double price = iFilter(getPrice(Price,i,Bars),pfilter,Length,i,Bars,0); jur[i] = iFilter(iDSmooth(price,Length,Phase,Double,i),vfilter,Length,i,Bars,1); jurDa[i] = EMPTY_VALUE; jurDb[i] = EMPTY_VALUE; arrowu[i] = EMPTY_VALUE; arrowd[i] = EMPTY_VALUE; trend[i] = (i<Bars-1) ? (jur[i]>jur[i+1]) ? 1 : (jur[i]<jur[i+1]) ? -1 : trend[i+1] : 0; if (trend[i]==-1) PlotPoint(i,jurDa,jurDb,jur); if (i<Bars-1 && trend[i]!=trend[i+1]) { if (trend[i] == 1) arrowu[i] = fmin(jur[i],iLow(_Symbol,_Period,i))-iATR(NULL,(ENUM_TIMEFRAMES)0,15,i)*UpArrowGap; if (trend[i] == -1) arrowd[i] = fmax(jur[i],iHigh(_Symbol,_Period,i))+iATR(NULL,(ENUM_TIMEFRAMES)0,15,i)*DnArrowGap; } } if (FXD_ONCALCULATE_FAIL) {return -1;} return _rates_total; return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // double wrk[][10]; #define bsmax 5 #define bsmin 6 #define volty 7 #define vsum 8 #define avolty 9 double iDSmooth(double price, double length, double phase, bool isDouble, int i, int s=0) { if (isDouble) return (iSmooth(iSmooth(price,MathSqrt(length),phase,i,s),MathSqrt(length),phase,i,s+10)); else return (iSmooth(price,length,phase,i,s)); } // // // // // double iSmooth(double price, double length, double phase, int i, int s=0) { int Bars = Bars(_Symbol,_Period); if (length <=1) return(price); if (ArrayRange(wrk,0) != Bars) ArrayResize(wrk,Bars); int r = Bars-i-1; if (r==0) { int k; for(k=0; k<7; k++) wrk[r][k+s]=price; for(; k<10; k++) wrk[r][k+s]=0; return(price); } // // // // // double len1 = MathMax(MathLog(MathSqrt(0.5*(length-1)))/MathLog(2.0)+2.0,0); double pow1 = MathMax(len1-2.0,0.5); double del1 = price - wrk[r-1][bsmax+s]; double del2 = price - wrk[r-1][bsmin+s]; double div = 1.0/(10.0+10.0*(MathMin(MathMax(length-10,0),100))/100); int forBar = MathMin(r,10); wrk[r][volty+s] = 0; if(MathAbs(del1) > MathAbs(del2)) wrk[r][volty+s] = MathAbs(del1); if(MathAbs(del1) < MathAbs(del2)) wrk[r][volty+s] = MathAbs(del2); wrk[r][vsum+s] = wrk[r-1][vsum+s] + (wrk[r][volty+s]-wrk[r-forBar][volty+s])*div; // // // // // wrk[r][avolty+s] = wrk[r-1][avolty+s]+(2.0/(MathMax(4.0*length,30)+1.0))*(wrk[r][vsum+s]-wrk[r-1][avolty+s]); double dVolty = 0; if (wrk[r][avolty+s] > 0) dVolty = wrk[r][volty+s]/wrk[r][avolty+s]; if (dVolty > MathPow(len1,1.0/pow1)) dVolty = MathPow(len1,1.0/pow1); if (dVolty < 1) dVolty = 1.0; // // // // // double pow2 = MathPow(dVolty,pow1); double len2 = MathSqrt(0.5*(length-1))*len1; double Kv = MathPow(len2/(len2+1),MathSqrt(pow2)); if (del1 > 0) wrk[r][bsmax+s] = price; else wrk[r][bsmax+s] = price - Kv*del1; if (del2 < 0) wrk[r][bsmin+s] = price; else wrk[r][bsmin+s] = price - Kv*del2; // // // // // double R = MathMax(MathMin(phase,100),-100)/100.0 + 1.5; double beta = 0.45*(length-1)/(0.45*(length-1)+2); double alpha = MathPow(beta,pow2); wrk[r][0+s] = price + alpha*(wrk[r-1][0+s]-price); wrk[r][1+s] = (price - wrk[r][0+s])*(1-beta) + beta*wrk[r-1][1+s]; wrk[r][2+s] = (wrk[r][0+s] + R*wrk[r][1+s]); wrk[r][3+s] = (wrk[r][2+s] - wrk[r-1][4+s])*MathPow((1-alpha),2) + MathPow(alpha,2)*wrk[r-1][3+s]; wrk[r][4+s] = (wrk[r-1][4+s] + wrk[r][3+s]); // // // // // return(wrk[r][4+s]); } //------------------------------------------------------------------- // //------------------------------------------------------------------- // // // // // #define _filterInstances 2 #define _filterInstancesSize 3 double workFil[][_filterInstances*_filterInstancesSize]; #define _fchange 0 #define _fachang 1 #define _fprice 2 double iFilter(double tprice, double filter, int period, int i, int bars, int instanceNo=0) { if (filter<=0) return(tprice); if (ArrayRange(workFil,0)!= bars) ArrayResize(workFil,bars); i = #ifdef __MQL4__ bars-i-1 #else i #endif; instanceNo*=_filterInstancesSize; // // // // // workFil[i][instanceNo+_fprice] = tprice; if (i<1) return(tprice); workFil[i][instanceNo+_fchange] = MathAbs(workFil[i][instanceNo+_fprice]-workFil[i-1][instanceNo+_fprice]); workFil[i][instanceNo+_fachang] = workFil[i][instanceNo+_fchange]; for (int k=1; k<period && (i-k)>=0; k++) workFil[i][instanceNo+_fachang] += workFil[i-k][instanceNo+_fchange]; workFil[i][instanceNo+_fachang] /= period; double stddev = 0; for (int k=0; k<period && (i-k)>=0; k++) stddev += MathPow(workFil[i-k][instanceNo+_fchange]-workFil[i-k][instanceNo+_fachang],2); stddev = MathSqrt(stddev/(double)period); double filtev = filter * stddev; if( MathAbs(workFil[i][instanceNo+_fprice]-workFil[i-1][instanceNo+_fprice]) < filtev ) workFil[i][instanceNo+_fprice]=workFil[i-1][instanceNo+_fprice]; return(workFil[i][instanceNo+_fprice]); } //------------------------------------------------------------------ // //------------------------------------------------------------------ // // // // // #define _prHABF(_prtype) (_prtype>=pr_habclose && _prtype<=pr_habtbiased2) #define _priceInstances 1 #define _priceInstancesSize 4 double workHa[][_priceInstances*_priceInstancesSize]; double getPrice(int tprice, int i, int bars, int instanceNo=0) { int Bars = Bars(_Symbol,_Period); double high = iHigh(_Symbol, _Period, i); double open = iOpen(_Symbol, _Period, i); double close = iClose(_Symbol, _Period, i); double low = iLow(_Symbol, _Period, i); if (tprice>=pr_haclose) { if (ArrayRange(workHa,0)!= Bars) ArrayResize(workHa,Bars); instanceNo*=_priceInstancesSize; int r = bars-i-1; // // // // // double haOpen = (r>0) ? (workHa[r-1][instanceNo+2] + workHa[r-1][instanceNo+3])/2.0 : (open+close)/2;; double haClose = (open+high+low+close) / 4.0; if (_prHABF(tprice)) if (high!=low) haClose = (open+close)/2.0+(((close-open)/(high-low))*MathAbs((close-open)/2.0)); else haClose = (open+close)/2.0; double haHigh = fmax(high,fmax(haOpen,haClose)); double haLow = fmin(low,fmin(haOpen,haClose)); // // // // // if(haOpen<haClose) { workHa[r][instanceNo+0] = haLow; workHa[r][instanceNo+1] = haHigh; } else { workHa[r][instanceNo+0] = haHigh; workHa[r][instanceNo+1] = haLow; } workHa[r][instanceNo+2] = haOpen; workHa[r][instanceNo+3] = haClose; // // // // // switch (tprice) { case pr_haclose: case pr_habclose: return(haClose); case pr_haopen: case pr_habopen: return(haOpen); case pr_hahigh: case pr_habhigh: return(haHigh); case pr_halow: case pr_hablow: return(haLow); case pr_hamedian: case pr_habmedian: return((haHigh+haLow)/2.0); case pr_hamedianb: case pr_habmedianb: return((haOpen+haClose)/2.0); case pr_hatypical: case pr_habtypical: return((haHigh+haLow+haClose)/3.0); case pr_haweighted: case pr_habweighted: return((haHigh+haLow+haClose+haClose)/4.0); case pr_haaverage: case pr_habaverage: return((haHigh+haLow+haClose+haOpen)/4.0); case pr_hatbiased: case pr_habtbiased: if (haClose>haOpen) return((haHigh+haClose)/2.0); else return((haLow+haClose)/2.0); case pr_hatbiased2: case pr_habtbiased2: if (haClose>haOpen) return(haHigh); if (haClose<haOpen) return(haLow); return(haClose); } } // // // // // switch (tprice) { case pr_close: return(close); case pr_open: return(open); case pr_high: return(high); case pr_low: return(low); case pr_median: return((high+low)/2.0); case pr_medianb: return((open+close)/2.0); case pr_typical: return((high+low+close)/3.0); case pr_weighted: return((high+low+close+close)/4.0); case pr_average: return((high+low+close+open)/4.0); case pr_tbiased: if (close>open) return((high+close)/2.0); else return((low+close)/2.0); case pr_tbiased2: if (close>open) return(high); if (close<open) return(low); return(close); } return(0); } // // // // // string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"}; int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200}; string timeFrameToString(int tf) { for (int i=ArraySize(iTfTable)-1; i>=0; i--) if (tf==iTfTable[i]) return(sTfTable[i]); return(""); } //------------------------------------------------------------------- // //------------------------------------------------------------------- // // // // // void CleanPoint(int i,double& first[],double& second[]) { int Bars = Bars(_Symbol,_Period); if (i>=Bars-3) return; if ((second[i] != EMPTY_VALUE) && (second[i+1] != EMPTY_VALUE)) second[i+1] = EMPTY_VALUE; else if ((first[i] != EMPTY_VALUE) && (first[i+1] != EMPTY_VALUE) && (first[i+2] == EMPTY_VALUE)) first[i+1] = EMPTY_VALUE; } void PlotPoint(int i,double& first[],double& second[],double& from[]) { int Bars = Bars(_Symbol,_Period); if (i>=Bars-2) return; if (first[i+1] == EMPTY_VALUE) if (first[i+2] == EMPTY_VALUE) { first[i] = from[i]; first[i+1] = from[i+1]; second[i] = EMPTY_VALUE; } else { second[i] = from[i]; second[i+1] = from[i+1]; first[i] = EMPTY_VALUE; } else { first[i] = from[i]; second[i] = EMPTY_VALUE; } } //== fxDreema MQL4 to MQL5 Converter ==// //-- Global Variables int FXD_SELECTED_TYPE = 0; // Indicates what is selected by OrderSelect(), 1 for trade, 2 for pending order, 3 for history trade ulong FXD_SELECTED_TICKET = 0; // The ticket number selected by OrderSelect() bool FXD_ONCALCULATE_FAIL = false; // Flag that causes OnCalculate() to return nothing if some indicator is used and failed to load, which means that indicator calculations must be repeated //-- Functions double iATR( string symbol, ENUM_TIMEFRAMES timeframe, int ma_period, int shift ) { int handle = iATR(symbol, timeframe, ma_period); return fxd_Indicator(handle, 0, shift); } bool IndicatorBuffers() { // this function has no equivalent in MQL5 return true; } bool SetIndexBuffer( int index, double &buffer[], ENUM_INDEXBUFFER_TYPE data_type, bool set_as_series ) { bool ret = SetIndexBuffer(index, buffer, data_type); if (ret) { ArraySetAsSeries(buffer, true); } return ret; } void SetIndexStyle( int index, int type, int style=EMPTY, int width=EMPTY, color clr=clrNONE) { if(width>-1) PlotIndexSetInteger(index,PLOT_LINE_WIDTH,width); if(clr!=CLR_NONE) PlotIndexSetInteger(index,PLOT_LINE_COLOR,clr); switch(type) { case 0: PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_LINE); break; case 1: PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_SECTION); break; case 2: PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_HISTOGRAM); break; case 3: PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_ARROW); break; case 4: PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_ZIGZAG); break; case 12: PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_NONE); break; default: PlotIndexSetInteger(index,PLOT_DRAW_TYPE,DRAW_LINE); } switch(style) { case 0: PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_SOLID); break; case 1: PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_DASH); break; case 2: PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_DOT); break; case 3: PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_DASHDOT); break; case 4: PlotIndexSetInteger(index,PLOT_LINE_STYLE,STYLE_DASHDOTDOT); break; default: return; } } void SetIndexArrow(int index, int code) { PlotIndexSetInteger(index, PLOT_ARROW, code); } string WindowExpertName() { return MQLInfoString(MQL_PROGRAM_NAME); } void IndicatorShortName(string name) { IndicatorSetString(INDICATOR_SHORTNAME, name); } double fxd_Indicator(int handle, int mode=0, int shift=0) { static double buffer[1]; ResetLastError(); if (handle < 0) { Print("Error: Indicator not handled (handle=",handle," | error code=",_LastError,")"); FXD_ONCALCULATE_FAIL = true; return EMPTY_VALUE; } for (int i=0; i<100; i++) { if (BarsCalculated(handle) > 0) { break; } // Sleep doesn't work for indicators, so we exit here if (MQLInfoInteger(MQL_PROGRAM_TYPE) == PROGRAM_INDICATOR) { FXD_ONCALCULATE_FAIL = true; return EMPTY_VALUE; } Sleep(50); } int copied = CopyBuffer(handle,mode,shift,1,buffer); if (copied > 0) { return buffer[0]; } //Print("Error: Cannot get indicator value (handle=",handle," | shift=",shift," | error code=",_LastError,")"); FXD_ONCALCULATE_FAIL = true; return EMPTY_VALUE; } //== fxDreema MQL4 to MQL5 Converter ==// -
@fxdreema said in Convert mq4 to mq5 with converter problem:
The idea of the tool is to work with every program, but it doesn't, I know that it sometimes fails. And I know for sure that it fails with programs made with fxDreema (because of few constants that I need to review), but it's not supposed to work with fxDreema programs, because you can just create MQL5 project in fxDreema anyway.
Makes sense i will take a look at it now again, the converter is a nice addition to the service