Please i need help

 

Hello for all i need this EA can buy or sell without RSI Please anyone can help me ? I have this code and I cannot do the coding. If anyone can help me for free by changing the code to be as I want.


//+------------------------------------------------------------------+

//|                                                      ProjectName |

//|                                      Copyright 2020, CompanyName |

//|                                       http://www.companyname.net |

//+------------------------------------------------------------------+

#include <Trade/Trade.mqh>



input group "=====Demo setting====="

input datetime StartWork = D'2018.01.01';

input datetime EndWork = D'2025.02.13';

input bool     CloseAll_at_EndWork = false;

input group "=====Day work setting====="

input bool                UseTimeWork=true;

input string              TimeOpen="10:00";                      // Time Start trade

input string              TimeClose="15:00";                    // Time Stop trade

input bool                CloseAll_at_TimeClose = true;

input group "=====Default setting====="

input int Magic = 2; // Mn.



int      TimeSey4as,TimeStart,TimeStop;

int barsTotal;

CTrade trade;



int handles[];



string symbols[] =

  {

   "AUDUSD_",

   "EURUSD_",

   "GBPUSD_",

   "USDCAD_",

   "USDCHF_",

   "USDJPY_",

  };



double volumes[] =

  {

   0.01,

   0.01,

   0.01,

   0.01,

   0.01,

   0.01,



  };

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

int OnInit()

  {



   if(UseTimeWork)

     {

      string _TimeOpen=TimeOpen;

      string _TimeClose=TimeClose;

      StringTrimLeft(_TimeOpen);

      StringTrimRight(_TimeOpen);

      StringReplace(_TimeOpen,"-",":");

      StringTrimLeft(_TimeClose);

      StringTrimRight(_TimeClose);

      StringReplace(_TimeClose,"-",":");

      if(StringFind(_TimeOpen,":",0)>-1 && StringFind(_TimeClose,":",0)>-1)

        {

         string sep=":";                          

         ushort u_sep;                            

         string result[],result1[];               

         u_sep=StringGetCharacter(sep,0);

         int k=StringSplit(_TimeOpen,u_sep,result);

         if(k!=2)

           {

            Alert("Wrong time setting");

            return(INIT_FAILED);

           }

         TimeStart=(int)(StringToInteger(result[0])*60+StringToInteger(result[1]));

         if(TimeStart>=1440)

           {

            Alert("Wrong time setting");

            return(INIT_FAILED);

           }

         int k1=StringSplit(_TimeClose,u_sep,result1);

         if(k1!=2)

           {

            Alert("Wrong time setting");

            return(INIT_FAILED);

           }

         TimeStop=(int)(StringToInteger(result1[0])*60+StringToInteger(result1[1]));

         if(TimeStop>=1440)

           {

            Alert("Wrong time setting");

            return(INIT_FAILED);

           }

        }

      else

        {

         Alert("Wrong time setting");

         return(INIT_FAILED);

        }

     }



   ArrayResize(handles,ArraySize(symbols));

   for(int i = 0; i < ArraySize(symbols); i++)

     {

      handles[i] = iRSI(symbols[i],PERIOD_CURRENT,14,PRICE_CLOSE);

     }



   trade.SetExpertMagicNumber(Magic);



   return(INIT_SUCCEEDED);

  }



//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {





  }



//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

void OnTick()

  {



   if(TimeCurrent()<=StartWork)    

     {

    

      return;

     }



   if(TimeCurrent()>=EndWork)    

     {

      

      if(CloseAll_at_EndWork)

        {

         for(int i = 0; i < ArraySize(symbols); i++)

           {

            trade.Sell(volumes[i],symbols[i]);

            trade.Buy(volumes[i],symbols[i]);

           }

        }

      return;

     }



   bool Trade =true;



   if(UseTimeWork)

     {

      if(Trade)

        {



         TimeSey4as=Hour()*60+Minute();

         if(((TimeSey4as>=TimeStart || TimeSey4as<TimeStop) && TimeStart>TimeStop) || ((TimeSey4as>=TimeStart && TimeSey4as<TimeStop) && TimeStart<TimeStop) || TimeStart==TimeStop)

            Trade=true;

         else

            Trade=false;

        }

     }



   if(!Trade && CloseAll_at_TimeClose)

     {

      for(int i1 = 0; i1 < ArraySize(symbols); i1++)

        {

         for(int i = PositionsTotal()-1; i >= 0; i--)

           {

            ulong posTicket = PositionGetTicket(i);

            if(PositionGetString(POSITION_SYMBOL) == symbols[i1] && PositionGetInteger(POSITION_MAGIC) == Magic)

              {

               if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY)

                 {

                  trade.PositionClose(posTicket);

                 }

               else

                 {

                  if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL)

                    {

                     trade.PositionClose(posTicket);

                    }

                 }

              }

           }

        }

     }



   int bars = iBars(_Symbol,PERIOD_CURRENT);

   if(barsTotal < bars)

     {

      barsTotal = bars;

      for(int i = 0; i < ArraySize(symbols); i++)

        {

         doStuff(symbols[i],handles[i],volumes[i],Trade);

        }

     }

  }



//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

void doStuff(string symbol, int handle, double volume,bool can_open)

  {

   double rsi[];

   CopyBuffer(handle,MAIN_LINE,1,1,rsi);



   bool isRsiBuy = rsi[0] < 30;

   bool isRsiSell = rsi[0] > 70;



   for(int i = PositionsTotal()-1; i >= 0; i--)

     {

      ulong posTicket = PositionGetTicket(i);

      if(PositionGetString(POSITION_SYMBOL) == symbol && PositionGetInteger(POSITION_MAGIC) == Magic)

        {

         if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY)

           {

            if(isRsiSell)

              {

               trade.PositionClose(posTicket);

              }

            isRsiSell = false;

           }

         else

           {

            if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL)

              {

               if(isRsiBuy)

                 {

                  trade.PositionClose(posTicket);

                 }

               isRsiSell = false;

              }

           }

        }

     }



   if(can_open)

     {

      if(isRsiSell)

        {

         trade.Sell(volume,symbol);

        }

      else

         if(isRsiBuy)

           {

            trade.Buy(volume,symbol);

           }

     }

  }



//+------------------------------------------------------------------+

int Hour()

  {

   MqlDateTime tm;

   TimeCurrent(tm);

   return(tm.hour);

  }



int Minute()

  {

   MqlDateTime tm;

   TimeCurrent(tm);

   return(tm.min);

  }
 
  1. Bash123456: i need this EA can buy or sell without RSI

    No RSI, means it will close any open orders and then open one buy and one sell each market tick. Better rethink.

  2. Bash123456: Please anyone can help me ? I have this code and I cannot do the coding. If anyone can help me for free by changing the code to be as I want.

    Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
         How To Ask Questions The Smart Way. (2004)
              Prune pointless queries.

    You have only four choices:

    1. Search for it (CodeBase or Market). Do you expect us to do your research for you?

    2. Try asking at:

    3. MT4: Learn to code it.
      MT5: Begin learning to code it.

      If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
                I need HEEEELP, please, it's URGENT...really ! - General - MQL5 programming forum (2017)

    4. Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
                Hiring to write script - General - MQL5 programming forum (2019)

    We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
              No free help (2017)

Reason: