fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Myraid
    3. Topics
    M
    • Profile
    • Following 1
    • Followers 1
    • Topics 8
    • Posts 10
    • Best 0
    • Controversial 1
    • Groups 0

    Topics created by Myraid

    • M

      my orders can not pick the variables from the formulas
      Questions & Answers • • Myraid

      2
      0
      Votes
      2
      Posts
      833
      Views

      roar

      Your "y" variable doesn't change at any point.
      Also, alone blocks will not work, there must always be a connection.

    • M

      building an ea for offline renko charts
      Questions & Answers • • Myraid

      2
      0
      Votes
      2
      Posts
      2120
      Views

      M

      yes, this is also possible with fxdreema, look in forum, somewhere in replies are few examples

    • M

      money management custom betting and balance percentage
      Questions & Answers • • Myraid

      3
      0
      Votes
      3
      Posts
      1529
      Views

      M

      @fxdreema thanks for the help , but i need you to help me do it if you can plz .....

    • M

      Having a problem with buffer on indicator appear
      Questions & Answers • • Myraid

      2
      -1
      Votes
      2
      Posts
      790
      Views

      fxDreema

      I guess you are talking for the "Indicator appear" block, but I don't recognize this code. From where did you get this code? If it's from the indicator... I can suggest to try it with "Trace" first, so you are sure that the output buffers are giving you good values.

    • M

      convert mq5 to mq4 indicator
      Questions & Answers • • Myraid

      2
      0
      Votes
      2
      Posts
      4169
      Views

      M

      #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

      #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

      //+------------------------------------------------------------------+
      //| iS7N_TREND.mq5 |
      //| Copyright 2010, SHOOTER777 |
      //| s7n@mail.ru |
      //+------------------------------------------------------------------+
      #property copyright "Copyright 2010, SHOOTER777"
      #property link "s7n@mail.ru"
      #property version "1.00"
      //---- indicator settings
      #property indicator_chart_window
      #property indicator_buffers 3
      #property indicator_plots 3
      #property indicator_plots 1
      //---- plot settings
      #property indicator_label1 "iTREND"
      //---
      #property indicator_color1 DarkBlue, LightBlue
      #property indicator_type1 DRAW_COLOR_LINE
      #property indicator_width1 2

      enum eColor
      {
      one_color_indicator,
      two_color_indicator
      };

      //--- input parameters of the iS7N_TREND indicator
      input int Per=20; // indicator period
      input eColor eC=1; // color scheme
      input color Up = DarkBlue; // bull color (uptrend)
      input color Down = LightBlue; // bear color (downtrend)
      input int iMax=200; //calc and plot iMx bars
      //--- as a fact, the number of calculated bars is iMx-Per
      //--- or in some cases more, for example if the specified period is greater than iMx
      //--- indicator buffers
      double dPlot[];
      double dColor[];
      //--- calculations buffers
      double dBuf_I[];
      //--- handles buffers
      double dBuf_1[];
      double dBuf_2[];
      //--- handles
      int ihMA_1;
      int ihMA_2;
      //--- global variables
      int P0,P2,P4;
      int iMx;
      int limit;
      string sShNm;
      //+------------------------------------------------------------------+
      //| Custom indicator initialization function |
      //+------------------------------------------------------------------+
      int OnInit()
      {
      //---
      int iPer=(string)(sShNm)+(string)("iS7N_TREND( ")+(string)(Per)+(string)(" )");
      int iBars=Bars(_Symbol,_Period); // number of bars in the history
      iMx=iMax;
      Print(" Total ",iBars," bars in the history are available");
      //---
      SetIndexBuffer(0,dPlot,(ENUM_INDEXBUFFER_TYPE)INDICATOR_DATA,true);
      PlotIndexSetString(0,PLOT_LABEL,"TREND");
      ArraySetAsSeries(dPlot,true);
      //---
      SetIndexBuffer(1,dColor,(ENUM_INDEXBUFFER_TYPE)INDICATOR_COLOR_INDEX,true);
      ArraySetAsSeries(dColor,true);
      //---
      SetIndexBuffer(2,dBuf_I,(ENUM_INDEXBUFFER_TYPE)INDICATOR_CALCULATIONS,true);
      ArraySetAsSeries(dBuf_I,true);
      //---
      ArraySetAsSeries(dBuf_1,true);
      ArraySetAsSeries(dBuf_2,true);
      //---
      IndicatorSetInteger(INDICATOR_DIGITS,_Digits-1);
      //---
      IndicatorSetString(INDICATOR_SHORTNAME,sShNm);
      //---
      // setting the buffer colors
      PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,Up);
      PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,Down);
      //---
      // if one color mode is selected
      if(eC==0)
      {
      Print("One color mode is selected");
      //--- set the second color the same as the first
      PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,Up);
      }
      else
      //--- don't change anything
      Print("Two-color mode is selected");
      //---
      vInPr(); // calculate periods
      //---
      if(!vInHandl()) // get the indicator handles
      {
      Print("???There was an error in initialization???");
      Print("Error ¹",GetLastError());
      return(-1);
      }
      //---
      return(0);
      }
      //+------------------------------------------------------------------+
      //| Custom indicator iteration function |
      //+------------------------------------------------------------------+
      int OnCalculate(const int rates_total,
      const int prev_calculated,
      const int begin,
      const double &price[])
      {
      FXD_ONCALCULATE_FAIL = false; // will be set to true if some indicator won't load

      FXD_ONCALCULATE_FAIL = false; // will be set to true if some indicator won't load

      //---
      if(prev_calculated<=0)
      {
      for(int i=0;i<=rates_total-1;i++)
      {
      dPlot[i]=EMPTY_VALUE;
      }
      }

      //--- the number of available bars should be greater than 10 periods of the indicator
      int iMn=10*P0;
      //--- we return if rates_total is less than needed (iMn)
      if(iMn>rates_total)return(0);
      //--- set correct size
      if(iMn>iMx) iMx=iMn;
      //--- calc as is
      if(iMx>rates_total)iMx=rates_total;
      //---
      int iii; // variable for the main loop

      //--- we will recalculate only preMx last bars
      int preMx=1;
      //--- if it first call...
      if(prev_calculated<=0)
      //--- recalculate all the bars
      {
      limit=iMx;
      Print("The indicator will be calculated for the ",limit-P0," last bars");
      Print("After that, the indicator will be calculated for the ",P0+preMx," last bars");
      //--- ArrayInitialize(dPlot,EMPTY_VALUE);
      }
      //--- otherwise, we recalc only preMx last bars
      else
      {
      limit=P0+preMx;
      }
      //---
      ArrayResize(dBuf_1,limit);
      ArrayResize(dBuf_2,limit);

      if(!vCopy()) return(0);

      for(iii=0; iii<limit; iii++)
      {
      dBuf_I[iii]=2.0*dBuf_2[iii]-dBuf_1[iii];
      }
      //---
      //Print("The indicator will be calculated for ",limit," bars");
      //---
      ArrayResize(dBuf_I,limit);
      //---
      for(iii=0; iii<limit-P0;iii++)
      {
      dPlot[iii]=iLWMA(dBuf_I,P4,iii);
      }
      //---
      for(iii=0; iii<limit-P0;iii++)
      {
      if(dPlot[iii]>dPlot[iii+1])
      dColor[iii]=0;
      else
      dColor[iii]=1;
      }
      ChartRedraw();
      if (FXD_ONCALCULATE_FAIL) {return -1;}
      if (FXD_ONCALCULATE_FAIL) {return -1;}

      return(rates_total);
      }
      //+------------------------------------------------------------------+
      //| vInPr |
      //+------------------------------------------------------------------+
      void vInPr()
      {
      P0=Per;
      P2=Per/2;
      P4= int (MathSqrt(Per));
      }
      //+------------------------------------------------------------------+
      //| vInHandl |
      //+------------------------------------------------------------------+
      bool vInHandl()
      {
      Print("Get the indicator handles for the iS7N_TREND indicator");
      //---
      ihMA_1 = iMA(Symbol(),(ENUM_TIMEFRAMES)0,P0,0,(ENUM_MA_METHOD)MODE_EMA,(ENUM_APPLIED_PRICE)PRICE_CLOSE);
      ihMA_2 = iMA(Symbol(),(ENUM_TIMEFRAMES)0,P2,0,(ENUM_MA_METHOD)MODE_EMA,(ENUM_APPLIED_PRICE)PRICE_CLOSE);
      //---
      if(ihMA_1<0 || ihMA_1<0)
      {
      Print(" Error creating indicators");
      return(false);
      }
      else
      {
      Print("The handles has been initialized successfully");
      Print("The main : Period = ",P0," Handle =",ihMA_1);
      Print("The secondary : Period = ",P2," Handle =",ihMA_2);
      return(true);
      }

      return 0;
      }
      //+------------------------------------------------------------------+
      //| vCopy |
      //+------------------------------------------------------------------+
      bool vCopy()
      {
      int n1,n2;
      n1=CopyBuffer(ihMA_1,0,0,limit,dBuf_1);
      n2=CopyBuffer(ihMA_2,0,0,limit,dBuf_2);
      if(n1==-1 || n2==-1)
      {
      Print("Error in call of the CopyBuffer function, error ¹=",GetLastError());
      return(false);
      }
      else return(true);

      return 0;
      }
      //+------------------------------------------------------------------+
      //| LWMA iMAOnArrayMQL4 |
      //+------------------------------------------------------------------+
      double iLWMA(double &array[],
      int period,
      int shift)
      {
      double buf[],arr[];
      int total=ArraySize(array);
      if(total>0 && total<=period) return(0);
      if(shift>total-period) return(0);

      if(ArrayResize(buf,total)<0) return(0);
      double sum=0.0,lsum=0.0;
      double price;
      int i,weight=0,pos=total-1;
      for(i=1;i<=period;i++,pos--)
      {
      price=array[pos];
      sum+=pricei;
      lsum+=price;
      weight+=i;
      }
      pos++;
      i=pos+period;
      while(pos>=0)
      {
      buf[pos]=sum/weight;
      if(pos==0) break;
      pos--;
      i--;
      price=array[pos];
      sum=sum-lsum+priceperiod;
      lsum-=array[i];
      lsum+=price;
      }
      return(buf[shift]);

      }
      //+------------------------------------------------------------------+

      //== 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 iMA(
      string symbol,
      ENUM_TIMEFRAMES timeframe,
      int ma_period,
      int ma_shift,
      ENUM_MA_METHOD ma_method,
      ENUM_APPLIED_PRICE applied_price,
      int shift
      )
      {
      applied_price++; // Fix, because all ENUM_APPLIED_PRICE in MQL5 are +1
      int handle = iMA(symbol,(ENUM_TIMEFRAMES)timeframe,ma_period,ma_shift,(ENUM_MA_METHOD)ma_method,(ENUM_APPLIED_PRICE)applied_price);

      return fxd_Indicator(handle,0,shift);

      }

      bool SetIndexBuffer(
      int index,
      double &buffer[],
      ENUM_INDEXBUFFER_TYPE data_type,
      bool set_as_series
      )
      {
      bool ret = SetIndexBuffer(index,buffer,(ENUM_INDEXBUFFER_TYPE)data_type,true);
      if (ret) {
      ArraySetAsSeries(buffer,true);
      }

      return ret;

      }

      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 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
      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;

      }

      double iMA(
      string symbol,
      ENUM_TIMEFRAMES timeframe,
      int ma_period,
      int ma_shift,
      ENUM_MA_METHOD ma_method,
      ENUM_APPLIED_PRICE applied_price,
      int shift
      )
      {
      applied_price++; // Fix, because all ENUM_APPLIED_PRICE in MQL5 are +1
      int handle = iMA(symbol, timeframe, ma_period, ma_shift, ma_method, applied_price);

      return fxd_Indicator(handle, 0, shift);

      }

      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 ==//

    • M

      i have made my ea based on the alligator , but it seems to make muiltple trades
      Questions & Answers • • Myraid

      1
      0
      Votes
      1
      Posts
      471
      Views

      No one has replied

    • M

      retriving the project i have been working on after a browser restart
      Questions & Answers • • Myraid

      3
      0
      Votes
      3
      Posts
      862
      Views

      fxDreema

      I can see your projects, you have 2 total. I don't know what browser you have, but I recommend Chrome... also there is a plugin for easy download for Chrome, so...

    • M

      how to make the trade not close in the same candle as the buy
      Questions & Answers • • Myraid

      3
      0
      Votes
      3
      Posts
      1460
      Views

      Andermaiden2nd

      If what you are trying to do is to open a trade when it crosses an MA and then close it when it crosses that same MA again then you need to know ther is a parameter in the "price vs indicator" block (at least when you choose to make the cross with an MA) that says "Minimum turnover distance". That is the distance it has to go away (from the MA) before crossing it again to effectively count it as another cross.

    • 1 / 1