Convert a MT4 EA to a cTrader cBot

Tarea técnica

Here is the code that needs to be converted:-


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

//+                           Code generated using FxPro Quant 2.1.4 |

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

#property strict


#define __STRATEGY_MAGIC 1001000000

#define __SLEEP_AFTER_EXECUTION_FAIL 400



struct InputsStr

  {

   string            _Currency;       // Symbol

   string            _TimeFrame;      // TimeFrame

   string               _Slowing;       // Slowing

   string               _Whole_Number_Input;       // Period

   string               _Grid_Points;       // Grid Points

   string            _SL_Percentage;       // SL Percentage

   string               _RSI_Buy_Limit;         // RSI Buy Limit

   string               _Sell_TP_in_Points;       // Sell TP in Points

   string               _Max_Days;        // Max Days

   string               _Stoc_Buy_Limit;        // Stoc Buy Limit

   string            _Mom_Buy_Limit;       // Mom Buy Limit

   string               _D_Period;         // D Period

   string               _Stoc_Sell_Limit;       // Stoc Sell Limit

   string               _RSI_Sell_Limit;        // RSI Sell Limit

   string            _Mom_Sell_Limit;        // Mom Sell Limit

   string               _Buy_TP_in_Points;        // Buy TP in Points

   string               _Max_Open_Trades;        // Max Open Trades

   string            _Lot_Percentage;       // Lot Percentage

  };

struct Inputs

  {

   string            _Currency;       // Symbol

   string            _TimeFrame;      // TimeFrame

   int               _Slowing;       // Slowing

   int               _Whole_Number_Input;       // Period

   int               _Grid_Points;       // Grid Points

   double            _SL_Percentage;       // SL Percentage

   int               _RSI_Buy_Limit;         // RSI Buy Limit

   int               _Sell_TP_in_Points;       // Sell TP in Points

   int               _Max_Days;        // Max Days

   int               _Stoc_Buy_Limit;        // Stoc Buy Limit

   double            _Mom_Buy_Limit;       // Mom Buy Limit

   int               _D_Period;         // D Period

   int               _Stoc_Sell_Limit;       // Stoc Sell Limit

   int               _RSI_Sell_Limit;        // RSI Sell Limit

   double            _Mom_Sell_Limit;        // Mom Sell Limit

   int               _Buy_TP_in_Points;        // Buy TP in Points

   int               _Max_Open_Trades;        // Max Open Trades

   double            _Lot_Percentage;       // Lot Percentage

  };


//Default Input variables

string _Currency ;

int  _TimeFrame;

int _Slowing;

int _Whole_Number_Input;

int _Grid_Points ;

double _SL_Percentage ;

int _RSI_Buy_Limit ;

int _Sell_TP_in_Points;

int _Max_Days ;

int _Stoc_Buy_Limit ;

double _Mom_Buy_Limit;

int _D_Period;

int _Stoc_Sell_Limit;

int _RSI_Sell_Limit ;

double _Mom_Sell_Limit;

int _Buy_TP_in_Points;

int _Max_Open_Trades ;

double _Lot_Percentage;


//Global declaration

double _Momentum;

double _Stochastic_3;

double _RSI;

bool _Compare_7;

bool _Compare_10;

bool _Compare_1;

bool _Compare_9;

bool _Compare_11;

double _Arithmetic;

bool _Compare_12;

bool _Compare_2;



Inputs inputsAct[] ;

InputsStr inputs[];


// Global Variables

input string _FileName="MRS14.csv" ; // Input File

input int    _GlobalMaxOrders=20;


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

//|                                                                  |

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

int init()

  {

   if(ReadCSVFile())

     {

      if(ArraySize(inputsAct)<=0)

         return INIT_FAILED;

     }

   else

     {

      return INIT_FAILED ;

     }

   return(0);

  }


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

//|                                                                  |

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

int start()

  {


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

     {

      SetSettings(inputsAct[i]._Currency);

      //Local declaration

      bool _Close_Position_1 = false;

      bool _Sell = false;

      bool _Buy = false;

      bool _Buy_2 = false;

      bool _Sell_2 = false;

      _Momentum = iMomentum(_Currency,_TimeFrame, _Whole_Number_Input, 0, 0);

      _Stochastic_3 = iStochastic(_Currency, _TimeFrame, _Whole_Number_Input, _D_Period, _Slowing, 0, 0, 0, 0);

      _RSI = iRSI(_Currency, _TimeFrame, _Whole_Number_Input,0, 0);


      _Compare_7 = (_RSI > _RSI_Sell_Limit);

      _Compare_10 = (_Momentum > _Mom_Sell_Limit);

      _Compare_1 = (_RSI < _RSI_Buy_Limit);

      _Compare_9 = (_Momentum < _Mom_Buy_Limit);

      _Compare_11 = (Number_of_Open_Trades(1,_Currency) < _Max_Open_Trades);

      _Arithmetic = ((_Grid_Points *

                      (-1)) *

                     (Number_of_Open_Trades(1,_Currency)));

      _Compare_12 = (_Stochastic_3 > _Stoc_Sell_Limit);

      _Compare_2 = (_Stochastic_3 < _Stoc_Buy_Limit);



      if((__OpenTime(1, _Currency) + 24*60*60 * (_Max_Days) < TimeCurrent()))

        {

         _Close_Position_1 = __isOpenedPosition(1, _Currency);

         if(_Close_Position_1)

           {

            int ticket = OrderTicket();

            int type = OrderType();

            double lots = OrderLots();

            string sym = OrderSymbol();

            _Close_Position_1 = OrderClose(ticket, lots, MarketInfo(sym, MODE_BID) + MarketInfo(sym, MODE_SPREAD) * MarketInfo(sym, MODE_POINT) * (type==1 ? 1:0), 0);

           }

        }


      if(GetGlobalOrders()>=_GlobalMaxOrders)

         return 0 ;


      if(((_Compare_7 &&

           (_Compare_12 &&

            !__selectOrderBySymbol(_Currency))) &&

          _Compare_10))

          

         _Sell = Sell(_Currency,1, ((_Lot_Percentage *

                           (AccountFreeMargin())) /

                          (100000)), 0, ((AccountFreeMargin() /

                                          ((100 /

                                            (_SL_Percentage)))) /

                                         (((_Lot_Percentage *

                                            (AccountFreeMargin())) /

                                           (100000)))), 0, _Sell_TP_in_Points, 5, _Max_Open_Trades, 0, "");


      if((((_Compare_2 &&

            !__selectOrderBySymbol(_Currency)) &&

           _Compare_1) &&

          _Compare_9))

          

         _Buy = Buy(_Currency,1, ((_Lot_Percentage *

                         (AccountFreeMargin())) /

                        (100000)), 0, ((AccountFreeMargin() /

                                        ((100 /

                                          (_SL_Percentage)))) /

                                       (((_Lot_Percentage *

                                          (AccountFreeMargin())) /

                                         (100000)))), 0, _Buy_TP_in_Points, 5, _Max_Open_Trades, 0, "");



      if((((((__selectOrderBySymbol(_Currency) &&

              ((_Arithmetic < 0) &&

               (__ProfitPoints(1, _Currency) < _Arithmetic))) &&

             _Compare_11) &&

            _Compare_2) &&

           _Compare_1) &&

          _Compare_9))

          

         _Buy_2 = Buy(_Currency,1, ((_Lot_Percentage *

                           (AccountFreeMargin())) /

                          (100000)), 0, ((AccountFreeMargin() /

                                          ((100 /

                                            (_SL_Percentage)))) /

                                         (((_Lot_Percentage *

                                            (AccountFreeMargin())) /

                                           (100000)))), 0, _Buy_TP_in_Points, 5, _Max_Open_Trades, 0, "");


      if((((((__selectOrderBySymbol(_Currency) &&

              ((_Arithmetic < 0) &&

               (__ProfitPoints(1, _Currency) < _Arithmetic))) &&

             _Compare_11) &&

            _Compare_12) &&

           _Compare_7) &&

          _Compare_10))

         _Sell_2 = Sell(_Currency,1, ((_Lot_Percentage *

                             (AccountFreeMargin())) /

                            (100000)), 0, ((AccountFreeMargin() /

                                            ((100 /

                                              (_SL_Percentage)))) /

                                           (((_Lot_Percentage *

                                              (AccountFreeMargin())) /

                                             (100000)))), 0, _Sell_TP_in_Points, 5, _Max_Open_Trades, 0, "");

     }



   return(0);

  }




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

//|                                                                  |

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

bool __selectOrderBySymbol(string symbol)

  {

   for(int i = 0; i < OrdersTotal(); i++)

     {

      if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == symbol)

         return(true);

     }

   return(false);

  }




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

//|                                                                  |

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

bool __selectOrderByMagic(int magic, string symbol)

  {

   for(int i = 0; i < OrdersTotal(); i++)

     {

      if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) && OrderMagicNumber() == __STRATEGY_MAGIC + magic && OrderSymbol() == symbol)

         return(true);

     }

   return(false);

  }




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

//|                                                                  |

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

datetime __OpenTime(int magic, string symbol)

  {

   if(!__selectOrderByMagic(magic, symbol))

      return(0);

   return(OrderOpenTime());

  }




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

//|                                                                  |

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

double __ProfitPoints(int magic, string symbol)

  {

   if(!__selectOrderByMagic(magic, symbol))

      return(0);

   if(OrderType() == OP_BUY)

      return ((MarketInfo(OrderSymbol(),MODE_BID) - OrderOpenPrice())/MarketInfo(OrderSymbol(),MODE_POINT));

   else

      if(OrderType() == OP_SELL)

         return ((OrderOpenPrice() - (MarketInfo(OrderSymbol(),MODE_ASK)))/MarketInfo(OrderSymbol(),MODE_POINT));

   return (0);

  }




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

//|                                                                  |

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

bool __isOpenedPosition(int magic, string symbol)

  {

   if(!__selectOrderByMagic(magic, symbol))

      return(false);

   return(OrderType()==OP_BUY || OrderType()==OP_SELL);

  }




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

//|                                                                  |

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

int __Ticket(int magic, string symbol)

  {

   if(!__selectOrderByMagic(magic, symbol))

      return(0);

   return(OrderTicket());

  }




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

//|                                                                  |

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

int Number_of_Open_Trades(int MagicIndex, string symbol)

  {

   int res = 0;

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

     {

      if(!OrderSelect(i, SELECT_BY_POS))

         continue;

      if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() != symbol)

         continue;

      res ++;

     }

   return (res);

  }



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

//|                                                                  |

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

bool Sell(string symbol ,int MagicIndex, double Lots, int StopLossMethod, double StopLossPoints, int TakeProfitMethod, double TakeProfitPoints, int Slippage, int MaxOpenTrades,

          int MaxFrequencyMins, string TradeComment)

  {

   int digits=(int)MarketInfo(symbol,MODE_DIGITS);

   double points=MarketInfo(symbol,MODE_POINT);

   double bid=MarketInfo(symbol,MODE_BID);

   double ask=MarketInfo(symbol,MODE_ASK);

   

   static double pipSize = 0;

   if(pipSize == 0)

      pipSize = points * (1 + 9 * (digits == 3 || digits == 5));


   double sl = 0, tp = 0;

   double stopLossPoints = 0, takeProfitPoints = 0;


   int numberOfOpenTrades = 0;


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

     {

      if(!OrderSelect(i, SELECT_BY_POS))

         continue;

      if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() != symbol)

         continue;

      numberOfOpenTrades ++;

     }


   if(MaxOpenTrades > 0 && numberOfOpenTrades >= MaxOpenTrades)

      return(false);


   if(MaxFrequencyMins  > 0)

     {

      int recentSeconds = MaxFrequencyMins * 60;


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

        {

         if(!OrderSelect(i, SELECT_BY_POS))

            continue;

         if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() !=symbol)

            continue;

         if(TimeCurrent() - OrderOpenTime() < recentSeconds)

            return(false);

        }


      int hstTotal=OrdersHistoryTotal();


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

        {

         if(!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))

            continue;

         if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() != symbol)

            continue;

         if(TimeCurrent() - OrderOpenTime() < recentSeconds)

            return(false);

         break;

        }

     }


   if(Lots < MarketInfo(symbol,MODE_MINLOT))

      return(false);


   if(AccountFreeMarginCheck(symbol, OP_SELL,Lots) <= 0)

     {

      Print("Sell order error: insufficient capital");

      return(false);

     }


   if(StopLossPoints > 0)

     {

      if(StopLossMethod == 0)

        {

         sl = NormalizeDouble(bid + StopLossPoints * points, digits);

         stopLossPoints = StopLossPoints;

        }

      else

         if(StopLossMethod == 1)

           {

            sl = NormalizeDouble(bid + StopLossPoints * pipSize, digits);

            stopLossPoints = StopLossPoints * (1 + 9 * (digits == 3 || digits == 5));

           }

         else

           {

            sl = StopLossPoints;

            stopLossPoints = (sl - bid)/points;

           }

     }


   if(TakeProfitPoints > 0)

     {

      if(TakeProfitMethod == 0)

        {

         tp = NormalizeDouble(bid - TakeProfitPoints * points, digits);

         takeProfitPoints = TakeProfitPoints;

        }

      else

         if(TakeProfitMethod == 1)

           {

            tp = NormalizeDouble(bid - TakeProfitPoints * pipSize, digits);

            takeProfitPoints = TakeProfitPoints * (1 + 9 * (digits == 3 || digits == 5));

           }

         else

           {

            tp = TakeProfitPoints;

            takeProfitPoints = (bid - tp)/Point;

           }

     }


   double stopLevel = MarketInfo(symbol,MODE_STOPLEVEL) + MarketInfo(symbol,MODE_SPREAD);


   if((sl > 0 && stopLossPoints <= stopLevel) || (tp > 0 && takeProfitPoints <= stopLevel))

     {

      Print("Cannot Sell: Stop loss and take profit must be at least "

            + DoubleToStr(MarketInfo(symbol,MODE_STOPLEVEL) + MarketInfo(symbol,MODE_SPREAD),0)

            + " points away from the current price");

      return (false);

     }


   RefreshRates();

   int result = OrderSend(symbol, OP_SELL, Lots, bid, Slippage, sl, tp, "FxProQuant" + "(" + WindowExpertName() + ") " + TradeComment,__STRATEGY_MAGIC + MagicIndex);


   if(result == -1)

     {

      Print("Failed to Sell: " + IntegerToString(GetLastError()));

      Sleep(__SLEEP_AFTER_EXECUTION_FAIL);

      return(false);

     }


   return(true);

  }



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

//|                                                                  |

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

bool Buy(string symbol ,int MagicIndex, double Lots, int StopLossMethod, double StopLossPoints, int TakeProfitMethod, double TakeProfitPoints, int Slippage, int MaxOpenTrades,

         int MaxFrequencyMins, string TradeComment)

  {

    int digits=(int)MarketInfo(symbol,MODE_DIGITS);

   double points=MarketInfo(symbol,MODE_POINT);

   double bid=MarketInfo(symbol,MODE_BID);

   double ask=MarketInfo(symbol,MODE_ASK);

   

   static double pipSize = 0;

   if(pipSize == 0)

      pipSize = points * (1 + 9 * (digits == 3 || digits == 5));


   double sl = 0, tp = 0;

   double stopLossPoints = 0, takeProfitPoints = 0;


   int numberOfOpenTrades = 0;


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

     {

      if(!OrderSelect(i, SELECT_BY_POS))

         continue;

      if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() != symbol)

         continue;

      numberOfOpenTrades ++;

     }


   if(MaxOpenTrades > 0 && numberOfOpenTrades >= MaxOpenTrades)

      return(false);


   if(MaxFrequencyMins  > 0)

     {

      int recentSeconds = MaxFrequencyMins * 60;


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

        {

         if(!OrderSelect(i, SELECT_BY_POS))

            continue;

         if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() != symbol)

            continue;

         if(TimeCurrent() - OrderOpenTime() < recentSeconds)

            return(false);

        }


      int hstTotal=OrdersHistoryTotal();


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

        {

         if(!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))

            continue;

         if(OrderMagicNumber() != __STRATEGY_MAGIC + MagicIndex || OrderSymbol() !=symbol)

            continue;

         if(TimeCurrent() - OrderOpenTime() < recentSeconds)

            return(false);

         break;

        }

     }


   if(Lots < MarketInfo(symbol,MODE_MINLOT))

      return(false);


   if(AccountFreeMarginCheck(symbol, OP_SELL,Lots) <= 0)

     {

      Print("Buy error: insufficient capital");

      return(false);

     }


   if(StopLossPoints > 0)

     {

      if(StopLossMethod == 0)

        {

         sl = NormalizeDouble(ask - StopLossPoints * points, digits);

         stopLossPoints = StopLossPoints;

        }

      else

         if(StopLossMethod == 1)

           {

            sl = NormalizeDouble(ask - StopLossPoints * pipSize, digits);

            stopLossPoints = StopLossPoints * (1 + 9 * (digits == 3 || digits == 5));

           }

         else

           {

            sl  = StopLossPoints;

            stopLossPoints = (ask - sl)/Point;

           }

     }


   if(TakeProfitPoints > 0)

     {

      if(TakeProfitMethod == 0)

        {

         tp = NormalizeDouble(ask + TakeProfitPoints * points, digits);

         takeProfitPoints = TakeProfitPoints;

        }

      else

         if(TakeProfitMethod == 1)

           {

            tp = NormalizeDouble(ask + TakeProfitPoints * pipSize, digits);

            takeProfitPoints = TakeProfitPoints * (1 + 9 * (digits == 3 || digits == 5));

           }

         else

           {

            tp = TakeProfitPoints;

            takeProfitPoints = (tp - ask)/Point;

           }

     }


   double stopLevel = MarketInfo(symbol,MODE_STOPLEVEL) + MarketInfo(symbol,MODE_SPREAD);


   if((sl > 0 && stopLossPoints <= stopLevel) || (tp > 0 && takeProfitPoints <= stopLevel))

     {

      Print("Cannot Buy: Stop loss and take profit must be at least "

            + DoubleToStr(MarketInfo(symbol,MODE_STOPLEVEL) + MarketInfo(symbol,MODE_SPREAD),0)

            + " points away from the current price");

      return (false);

     }


   RefreshRates();

   int result = OrderSend(symbol, OP_BUY, Lots, ask, Slippage, sl, tp, "FxProQuant" + "(" + WindowExpertName() + ") " + TradeComment, __STRATEGY_MAGIC + MagicIndex);


   if(result == -1)

     {

      Print("Failed to Buy: " + IntegerToString(GetLastError()));

      Sleep(__SLEEP_AFTER_EXECUTION_FAIL);

      return(false);

     }


   return(true);

  }


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

//|                                                                  |

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

bool ReadCSVFile()

  {

   if(!FileIsExist(_FileName))

      return false ;


   int handle=FileOpen(_FileName,FILE_CSV|FILE_READ,";") ;

   int line=0;

   if(handle!=INVALID_HANDLE)

     {

      while(!FileIsEnding(handle))

        {

         ArrayResize(inputs,line+1);

         inputs[line]._Currency=FileReadString(handle);

         inputs[line]._TimeFrame=FileReadString(handle);

         inputs[line]._Slowing=FileReadString(handle);

         inputs[line]._Whole_Number_Input=FileReadString(handle);

         inputs[line]._Grid_Points=FileReadString(handle);

         inputs[line]._SL_Percentage=FileReadString(handle);

         inputs[line]._RSI_Buy_Limit=FileReadString(handle);

         inputs[line]._Sell_TP_in_Points=FileReadString(handle);

         inputs[line]._Max_Days=FileReadString(handle);

         inputs[line]._Stoc_Buy_Limit=FileReadString(handle);

         inputs[line]._Mom_Buy_Limit=FileReadString(handle);

         inputs[line]._D_Period=FileReadString(handle);

         inputs[line]._Stoc_Sell_Limit=FileReadString(handle);

         inputs[line]._RSI_Sell_Limit=FileReadString(handle); ;

         inputs[line]._Mom_Sell_Limit=FileReadString(handle);

         inputs[line]._Buy_TP_in_Points=FileReadString(handle);

         inputs[line]._Max_Open_Trades=FileReadString(handle);

         inputs[line]._Lot_Percentage=FileReadString(handle);

         line++ ;

        }

      FileClose(handle);

     }

   else

     {

      return false ;

     }


   ArrayResize(inputsAct,ArraySize(inputs)-1);

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

     {

      inputsAct[i]._Currency=inputs[i+1]._Currency;

      inputsAct[i]._TimeFrame=inputs[i+1]._TimeFrame;

      inputsAct[i]._Slowing=(int)inputs[i+1]._Slowing;

      inputsAct[i]._Whole_Number_Input=(int)inputs[i+1]._Whole_Number_Input;

      inputsAct[i]._Grid_Points=(int)inputs[i+1]._Grid_Points;

      inputsAct[i]._SL_Percentage=StringToDouble(inputs[i+1]._SL_Percentage);

      inputsAct[i]._RSI_Buy_Limit=(int)inputs[i+1]._RSI_Buy_Limit;

      inputsAct[i]._Sell_TP_in_Points=(int)inputs[i+1]._Sell_TP_in_Points;

      inputsAct[i]._Max_Days=(int)inputs[i+1]._Max_Days;

      inputsAct[i]._Stoc_Buy_Limit=(int)inputs[i+1]._Stoc_Buy_Limit;

      inputsAct[i]._Mom_Buy_Limit=StringToDouble(inputs[i+1]._Mom_Buy_Limit);

      inputsAct[i]._D_Period=(int)inputs[i+1]._D_Period;

      inputsAct[i]._Stoc_Sell_Limit=(int)inputs[i+1]._Stoc_Sell_Limit;

      inputsAct[i]._RSI_Sell_Limit=(int)inputs[i+1]._RSI_Sell_Limit;

      inputsAct[i]._Mom_Sell_Limit=StringToDouble(inputs[i+1]._Mom_Sell_Limit);

      inputsAct[i]._Buy_TP_in_Points=(int)inputs[i+1]._Buy_TP_in_Points;

      inputsAct[i]._Max_Open_Trades=(int)inputs[i+1]._Max_Open_Trades;

      inputsAct[i]._Lot_Percentage=StringToDouble(inputs[i+1]._Lot_Percentage) ;

     }

   return true ;

  }


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

//|                                                                  |

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

int StringToTimeFrame(string tf)

  {

   if(tf=="M1")

      return PERIOD_M1 ;

   else

      if(tf=="M5")

         return PERIOD_M5 ;

      else

         if(tf=="M15")

            return PERIOD_M15 ;

         else

            if(tf=="M30")

               return PERIOD_M30 ;

            else

               if(tf=="H1")

                  return PERIOD_H1 ;

               else

                  if(tf=="H4")

                     return PERIOD_H4 ;

                  else

                     if(tf=="D1")

                        return PERIOD_D1 ;

                     else

                        if(tf=="W1")

                           return PERIOD_W1 ;

                        else

                           if(tf=="MN1")

                              return PERIOD_MN1 ;


   return PERIOD_CURRENT ;

  }



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

//|                                                                  |

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

void SetSettings(string symbol)

  {

   bool found=false ;

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

     {

      if(inputsAct[i]._Currency==symbol)

        {

         _Currency=inputsAct[i]._Currency ;

         _TimeFrame=StringToTimeFrame(inputsAct[i]._TimeFrame);

         _Slowing = inputsAct[i]._Slowing;

         _Whole_Number_Input = inputsAct[i]._Whole_Number_Input;

         _Grid_Points = inputsAct[i]._Grid_Points;

         _SL_Percentage = inputsAct[i]._SL_Percentage;

         _RSI_Buy_Limit = inputsAct[i]._RSI_Buy_Limit;

         _Sell_TP_in_Points = inputsAct[i]._Sell_TP_in_Points;

         _Max_Days = inputsAct[i]._Max_Days;

         _Stoc_Buy_Limit = inputsAct[i]._Stoc_Buy_Limit;

         _Mom_Buy_Limit = inputsAct[i]._Mom_Buy_Limit;

         _D_Period = inputsAct[i]._D_Period;

         _Stoc_Sell_Limit = inputsAct[i]._Stoc_Sell_Limit;

         _RSI_Sell_Limit = inputsAct[i]._RSI_Sell_Limit;

         _Mom_Sell_Limit = inputsAct[i]._Mom_Sell_Limit;

         _Buy_TP_in_Points = inputsAct[i]._Buy_TP_in_Points;

         _Max_Open_Trades = inputsAct[i]._Max_Open_Trades;

         _Lot_Percentage =inputsAct[i]._Lot_Percentage;

         found=true ;

         break ;

        }

      else

        {

         continue ;

        }

     }


   if(!found)

     {

      _Currency=symbol;

      _TimeFrame=PERIOD_CURRENT ; // Trading TimeFrame

      _Slowing = 3;       // Slowing

      _Whole_Number_Input = 10;       // Period

      _Grid_Points = 200;       // Grid Points

      _SL_Percentage = 1;       // SL Percentage

      _RSI_Buy_Limit = 25;         // RSI Buy Limit

      _Sell_TP_in_Points = 300;       // Sell TP in Points

      _Max_Days = 14;        // Max Days

      _Stoc_Buy_Limit = 15;        // Stoc Buy Limit

      _Mom_Buy_Limit = 99.5;       // Mom Buy Limit

      _D_Period = 3;         // D Period

      _Stoc_Sell_Limit = 85;       // Stoc Sell Limit

      _RSI_Sell_Limit = 75;        // RSI Sell Limit

      _Mom_Sell_Limit = 100.5;        // Mom Sell Limit

      _Buy_TP_in_Points = 300;        // Buy TP in Points

      _Max_Open_Trades = 6;        // Max Open Trades

      _Lot_Percentage = 0.5;       // Lot Percentage

     }

  }


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

//|                                                                  |

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

int GetGlobalOrders()

  {

   int cnt=0 ;

   for(int i=0; i<OrdersTotal(); i++)

     {

      if(OrderSelect(i,SELECT_BY_POS) && OrderMagicNumber()==__STRATEGY_MAGIC+1)

         cnt ++;

     }

   return cnt ;

  }

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


Archivos adjuntos:

Han respondido

1
Desarrollador 1
Evaluación
(38)
Proyectos
50
10%
Arbitraje
1
0% / 0%
Caducado
8
16%
Libre
2
Desarrollador 2
Evaluación
Proyectos
2
0%
Arbitraje
3
67% / 33%
Caducado
0
Libre
Solicitudes similares
Greenprint strategy 30 - 100 USD
Hello i need someone who can create an indicator to show the resistance support and pivot areas like in the shown images the indicators are bollinger bands moving averages also we have rsi and ma . Pictures below. You should be able to do work properly requesting a trial check when work is complete the indicator should also work with synthetic indices
I want someone who can create a Automatic mobile trading bot/EA with my kind of strategy...Example: : When The market is buying and rejects an has created an M formation the First leg is higher than the second leg(first leg Higher high,second leg lower high then a line must touch the peak of the Higher high then connect with the peak of the lower High as a Footprint line,then there must be Another line that touches
SpotBot45 30+ USD
I know nothing about trading so am looking for a custom made automated trading bot with medium risk and maximum returns.I am looking for about a ten percent return per day minimum and minimise as much risk where possible
Hello, I need help me with fixing a custom indicator for me. I need the indicator buffer value fixing to work perfectly with EA. I think once you bid and check the file you will understand the matter of the issue. Normally the indicator is good to give the signal. But based on the signal I can't get into the EA. Because of the buffer value working issue. Also some time it's doing issue to show the singnal when
I would like to make a SMC EA for MT5 based on multi timeframes analyzing the price action. and make it more details with more user input added.'' source code needed'' First of all here's a video which helped me for this: https://www.youtube.com/watch?v=vEXji2ClXMc The ea should find a entry signal that based on the SMC concept below and each entry trigger can be turned on and off. Based on the Multi timeframe of
I need smart, professional, and fast programmer for doing this project quickly, that have experience in EA with minimum 300 projects finish and without arbitration, and have good review and reputation from their client Share your link review, if you not qualified, dont apply! I will bidding the programmer from experience, review, reputation, price, and days working My EA using Moving Average, Average True Range, and
Hello programmers, I'm seeking for a professional reverse engineer that is able to debug and optionally decompile (if that is feasible) an expert advisor that uses a DLL-lock. The job is very challenging, therefore I'm only looking for expert C++/DLL engineers that is able to reproduce the original strategy in details (if decompilation is not possible, the code is not required, but a full explanation of the strategy
Hello I'm in possesion of a straightforward MT% Expert AdvisorThat I want to convert into DXTrade. Are you able to do this conversion? Kindly let me know if the fil atached will be enough
Hello, I need a quote for developing a bot for my renko based trading system on ctrader platform and based on the attached specification your expertise is highly needed for this project Thanks
i want an EA that enters based on the form of a candle if the lower wick is bigger then the rest of the candle i want buy and if the upperwick is bigger then the rest of the candle i want a sell single, i want it to enter with the sl 1 tick lower or higher then the lower or upperwick depening on buy or sell trade. then the stoploos needs to move when the trade goes to 0,5% sl too break even, when trad eis on 1% sl to

Información sobre el proyecto

Presupuesto
120 - 160 USD
Para el ejecutor
108 - 144 USD
Plazo límite de ejecución
de 5 a 10 día(s)