can we make Frankenstein work?

 
int OnInit()
  {
  
//---
   if(!m_symbol.Name(Symbol())) // sets symbol name
      return(INIT_FAILED);
   RefreshRates();
{
//--- Initializing expert
   if(!ExtExpert.Init(m_symbol.Name(),Period(),Expert_EveryTick,m_magic));
     
      //--- failed
      printf(__FUNCTION__+": error initializing expert");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Creating signal
   CExpertSignal *signal=new CExpertSignal;
   if(signal==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating signal");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//---
   ExtExpert.InitSignal(signal);
   signal.ThresholdOpen(Signal_ThresholdOpen);
   signal.ThresholdClose(Signal_ThresholdClose);
   signal.PriceLevel(Signal_PriceLevel);
   signal.StopLevel(Signal_StopLevel);
   signal.TakeLevel(Signal_TakeLevel);
   signal.Expiration(Signal_Expiration);
//--- Creating filter CSignalITF
   CSignalITF *filter0=new CSignalITF;
   if(filter0==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating filter0");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
   signal.AddFilter(filter0);
//--- Set filter parameters
   filter0.GoodHourOfDay(Signal_ITF_GoodHourOfDay);
   filter0.BadHoursOfDay(Signal_ITF_BadHoursOfDay);
   filter0.GoodDayOfWeek(Signal_ITF_GoodDayOfWeek);
   filter0.BadDaysOfWeek(Signal_ITF_BadDaysOfWeek);
   filter0.Weight(Signal_ITF_Weight);
//--- Creating filter CSignalSAR
   CSignalSAR *filter1=new CSignalSAR;
   if(filter1==NULL)


//--- Creating filter CSignalAC
   CSignalAC *filter7=new CSignalAC;
   if(filter7==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating filter7");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
   signal.AddFilter(filter7);
//--- Set filter parameters
   filter7.Weight(Signal_AC_Weight);
//--- Creation of trailing object
   CTrailingFixedPips *trailing=new CTrailingFixedPips;
   if(trailing==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating trailing");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Add trailing to expert (will be deleted automatically))
   if(!ExtExpert.InitTrailing(trailing))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing trailing");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Set trailing parameters
   trailing.StopLevel(Trailing_FixedPips_StopLevel);
   trailing.ProfitLevel(Trailing_FixedPips_ProfitLevel);
//--- Creation of money object
   CMoneySizeOptimized *money=new CMoneySizeOptimized;
   if(money==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating money");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Add money to expert (will be deleted automatically))
   if(!ExtExpert.InitMoney(money))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing money");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Set money parameters
   money.DecreaseFactor(Money_SizeOptimized_DecreaseFactor);
   money.Percent(Money_SizeOptimized_Percent);
//--- Check all trading objects parameters
   if(!ExtExpert.ValidationSettings())
     {
      //--- failed
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Tuning of all necessary indicators
   if(!ExtExpert.InitIndicators())
     {
      //--- failed
      printf(__FUNCTION__+": error initializing indicators");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- ok

   string err_text="";
   if(!CheckVolumeValue(InpLots,err_text))
     {
      Print(__FUNCTION__,", ERROR: ",err_text);
      return(INIT_PARAMETERS_INCORRECT);
     }
//---
   m_trade.SetExpertMagicNumber(m_magic);
   m_trade.SetMarginMode();
   m_trade.SetTypeFillingBySymbol(m_symbol.Name());
   m_trade.SetDeviationInPoints(m_slippage); 
//--- create handle of the indicator iMA
  handle_iMA=iMA(m_symbol.Name(),(ENUM_TIMEFRAMES(iMA_TIME)),Inp_MA_ma_period,MAshift,ENUM_MA_METHOD(MODE_EMA1),ENUM_APPLIED_PRICE(PRICE_HIGH_MA));
//--- if the handle is not created 
   if(handle_iMA==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code 
      PrintFormat("Failed to create handle of the iMA indicator for the symbol %s/%s, error code %d",
                  m_symbol.Name(),
                  EnumToString(Period()),
                  GetLastError());
      //-  -- the indicator is stopped early 
      return(INIT_FAILED);
     }
//--- create handle of the indicator iMACD
   handle_iMACD=iMACD(m_symbol.Name(),(ENUM_TIMEFRAMES(iMACD_TIME)),Inp_fast_ema_period,Inp_slow_ema_period,Inp_signal_period,ENUM_APPLIED_PRICE(PRICE_CLOSE1));
//--- if the handle is not created 
   if(handle_iMACD==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code 
      PrintFormat("Failed to create handle of the iMACD indicator for the symbol %s/%s, error code %d",
                  m_symbol.Name(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early 
      return(INIT_FAILED);
      }
     //--- create handle of the indicator iMACD
   handle_iMACD1=iMACD(m_symbol.Name(),(ENUM_TIMEFRAMES(iMACD1_TIME)),Inp_fast_ema_period1,Inp_slow_ema_period1,Inp_signal_period1,ENUM_APPLIED_PRICE(PRICE_CLOSE1));
//--- if the handle is not created 
   if(handle_iMACD1==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code 
      PrintFormat("Failed to create handle of the iMACD1 indicator for the symbol %s/%s, error code %d",
                  m_symbol.Name(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early 
      return(INIT_FAILED);
     }
//--- create handle of the indicator iATR
   handle_iATR=iATR(m_symbol.Name(),(ENUM_TIMEFRAMES(iATR_TIME)),Inp_ATR_ma_period);
//--- if the handle is not created 
   if(handle_iATR==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code 
      PrintFormat("Failed to create handle of the iATR indicator for the symbol %s/%s, error code %d",
                  m_symbol.Name(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early 
      return(INIT_FAILED);
     }

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//--- we work only at the time of the birth of new bar
   static datetime PrevBars=0;
   datetime time_0=iTime(m_symbol.Name(),Period(),0);
   if(time_0==PrevBars)
      return;
   PrevBars=time_0;
   if(!RefreshRates())
      return;
//---
   double MA_2    = iMAGet(1);
   double MACD_1  = iMACDGet(MAIN_LINE,1);
   double MACD_2  = iMACDGet(MAIN_LINE,2);
   double MACD_3  = iMACDGet(SIGNAL_LINE,1);
   double MACD_4  = iMACDGet(SIGNAL_LINE,2);
   double ATR_1   = iATRGet(1);
   double RSI_1   = iRSIGet(1);
//--- check BUY
   if(iOpen(m_symbol.Name(),Period(),1)<MA_2 && RSI_1<RSIUpperLimit && 
      iClose(m_symbol.Name(),Period(),1)>MA_2 && RSI_1>RSIUpperLevel)
     {
      if(MACD_2<0 || (MathAbs(MACD_1)-MathAbs(MACD_2))/MathAbs(MACD_1)>MacdDiffBuy)
        {
         double sl=m_symbol.Ask()-ism*ATR_1;
         for(int i=0;i<4;i++)
           {
            double tp=m_symbol.Ask()+tpm*(i/2.0+1.0)*ATR_1;
            OpenBuy(sl,tp);
            //OrderSend(Symbol(),OP_BUY,InpLots,Ask,slippage,Ask-InitialStop,Ask+TakeProfit,DoubleToStr(oob+1+i,2),magicEA,0);
           }
        }
      return;
     }   if(iOpen(m_symbol.Name(),Period(),1)<MACD_3 && RSI_1<RSIUpperLimit && 
      iClose(m_symbol.Name(),Period(),1)>MACD_4 && RSI_1>RSIUpperLevel)
     {
      if(MACD_4<0 || (MathAbs(MACD_3)-MathAbs(MACD_4))/MathAbs(MACD_3)>MacdDiffBuy1)
        {
         double sl=m_symbol.Ask()-ism*ATR_1;
         for(int i=0;i<4;i++)
           {
            double tp=m_symbol.Ask()+tpm*(i/2.0+1.0)*ATR_1;
            OpenBuy(sl,tp);
            //OrderSend(Symbol(),OP_BUY,InpLots,Ask,slippage,Ask-InitialStop,Ask+TakeProfit,DoubleToStr(oob+1+i,2),magicEA,0);
           }
        }
      return;
     }
//--- check SELL
   if(iOpen(m_symbol.Name(),Period(),1)>MA_2 && RSI_1>RSILowerLimit && 
      iClose(m_symbol.Name(),Period(),1)<MA_2 && RSI_1<RSILowerLevel)
     {
      if(MACD_2>0 || (MathAbs(MACD_1)-MathAbs(MACD_2))/MathAbs(MACD_1)>MacdDiffSell)
        {
         double sl=m_symbol.Bid()+ism*ATR_1;
         for(int i=0;i<4;i++)
           {
            double tp=m_symbol.Bid()-tpm*(i/2.0+1.0)*ATR_1;
            OpenSell(sl,tp);
            //OrderSend(Symbol(),OP_BUY,InpLots,Ask,slippage,Ask-InitialStop,Ask+TakeProfit,DoubleToStr(oob+1+i,2),magicEA,0);
           }
        }
      return;
     } 
     
      if(iOpen(m_symbol.Name(),Period(),1)>MACD_1 && RSI_1>RSILowerLimit && 
      iClose(m_symbol.Name(),Period(),1)<MACD_4 && RSI_1<RSILowerLevel)
     {
      if(MACD_2>0 || (MathAbs(MACD_3)-MathAbs(MACD_2))/MathAbs(MACD_4)>MacdDiffSell1)
        {
         double sl=m_symbol.Bid()+ism*ATR_1;
         for(int i=0;i<4;i++)
           {
            double tp=m_symbol.Bid()-tpm*(i/2.0+1.0)*ATR_1;
            OpenSell(sl,tp);
            //OrderSend(Symbol(),OP_BUY,InpLots,Ask,slippage,Ask-InitialStop,Ask+TakeProfit,DoubleToStr(oob+1+i,2),magicEA,0);
           }
        }
      return;
     }
  }
  

im just trying to add 2 EA's into one,. 

 
i am wanting to know if i could take any EA and plug in ITF or any Cexpert functions/calls
 
//OrderSend(Symbol(),OP_BUY,InpLots,Ask,slippage,Ask-InitialStop,Ask+TakeProfit,DoubleToStr(oob+1+i,2),magicEA,0);

You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by the Ask.

  1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

  2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
              MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25

  3. The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)

    Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes.
    My GBPJPY shows average spread = 26 points, average maximum spread = 134.
    My EURCHF shows average spread = 18 points, average maximum spread = 106.
    (your broker will be similar).
              Is it reasonable to have such a huge spreads (20 pip spreads) in EURCHF? - General - MQL5 programming forum (2022)