Convert a MT4 EA to a cTrader cBot

Spécifications

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 ;

  }

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


Dossiers :

Répondu

1
Développeur 1
Évaluation
(38)
Projets
50
10%
Arbitrage
1
0% / 0%
En retard
8
16%
Gratuit
2
Développeur 2
Évaluation
Projets
2
0%
Arbitrage
3
67% / 33%
En retard
0
Gratuit
Commandes similaires
I want to design a website like https://www.ngnrates.com/ we will change some stuff but not much, if you can deliver a website like this let me know your budget and readiness to implement
Hey, great developer I have a thinkorswim script I want to convert it into TradingView. Can you please let me know if you can i will be looking for great developer that will bid for it best regards
Hey, great developer I have a thinkorswim script I want to convert it into TradingView. Can you please let me know if you can i will be looking for great developer that will bid for it best regards
Tradingview developer 30 - 35 USD
Hey greetings. I am in need of tradingview developer that can modify an open source PineScript indicator code to add additional features. Kindly bid for this project if it is what you handle and let proceed with the project
In summary 1) The bot will only take Firm Buy and Firm Sell Signals . 2) The bot will use the SL and TP based on the indicator . 3) the risk to reward is 2:1 but when the price reaches 1:1 set SL to Breakeven 4) the bot will take Firm Buy and Firm sell after the candle closes with a firm buy or firm sell 5) make sure to give an option for number of contracts to be traded . 6) Bot will close all the trades EOD
hi. I hv a strategy on tradingview need to convert to MT4/MT5 expert advisor for algo trading. would like to add some tradingview strategy setting to the EA(not included in my tradingview code): recalculate after order is filled, order size: xx% of equity
looking for help to get my ibkr automated, i have strategies already built in composer and have JSON for them, i really just need to he setup and explanation on how to maintain it and add new strategies
I am looking for someone who has experience working with the ZigZag indicator. I want to create a multi timeframe dashboard scanner based on ZigZag. I will explain more in private messages. if you feel capable & interest with that,please pm me for more details. thanks
Specify your Requirements Specification here point by point. Try to describe your requirements briefly and clearly, so that your potential developer is able to correctly assess its complexity and cost, as well as the required execution time. A bad or too generic description will result in your order being ignored, or you will spend a lot of time negotiating the details with each applicant. Remember: It is better to
Hello, greetings... I need help of an expert developer that's available, that can convert Tradestation script (EasyLanguage) to NinjaTrader, I've a strategy I need a quick conversion (details will be discussed when applied). Also I need cooperation for later projects... Thanks alot in advance

Informations sur le projet

Budget
120 - 160 USD
Pour le développeur
108 - 144 USD
Délais
de 5 à 10 jour(s)