Mix two EAs together

Trabajo finalizado

Plazo de ejecución 3 días
Comentario del Cliente
Super job I recommend, very professionnal, thank you. :)
Comentario del Ejecutor
Great client! Hope to work with you in the future! thnx

Tarea técnica

Hello,
I would need to mix these two EAs together, and SUPER TAKE only works with GBPUSD


example:

once the two EAs together I want that when SUPER TAKE reaches "1"
(that the profit is 1 €) then all open positions on the GBPUSD are closed and 
only for GBPUSD.





here are the two EAs

Balbuzia, and SUPER TAKE
//+------------------------------------------------------------------+
//|                                              Balbuzia_3_in_1.mq4 |
//|                                         Copyright 2018, GCN ltd. |
//|                                          http://www.it-labmd.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, GCN ltd."
#property link      "http://www.it-labmd.com"
#property version   "1.00"
#property strict
extern double  lots1_1          = 0.01;
extern double  lots2_1          = 0.02;
extern double  lots3_1          = 0.04;
input int      TakeProfit1_1     =   10;
input int      StopLoss1_1       =   400;
input int      TakeProfit2_1     =   10;
input int      StopLoss2_1       =   400;
input int      TakeProfit3_1     =   10;
input int      StopLoss3_1       =   400;
extern int     magic_1=000013;
extern double  Level_1=1.2885;
extern double  MaxDeviation_1=9;         // Max Deviation, points

bool RunOnce_1=false;
int last_order_check_1=false;
datetime EaStartTime_1=TimeCurrent();
double takeprofit1_1=TakeProfit1_1;
double stoploss1_1=StopLoss1_1;
double takeprofit2_1=TakeProfit2_1;
double stoploss2_1=StopLoss2_1;
double takeprofit3_1=TakeProfit3_1;
double stoploss3_1=StopLoss3_1;

extern double  lots1_2          = 0.01;
extern double  lots2_2          = 0.02;
extern double  lots3_2          = 0.04;
input int      TakeProfit1_2     =   10;
input int      StopLoss1_2       =   400;
input int      TakeProfit2_2     =   10;
input int      StopLoss2_2       =   400;
input int      TakeProfit3_2     =   10;
input int      StopLoss3_2       =   400;
extern int     magic_2=000014;
extern int     Distance_2= 10;
double  Level_2          = 0;
extern double  MaxDeviation_2=9;         // Max Deviation, points

bool RunOnce_2=false;
int last_order_check_2=false;
datetime EaStartTime_2=TimeCurrent();
double takeprofit1_2=TakeProfit1_2;
double stoploss1_2=StopLoss1_2;
double takeprofit2_2=TakeProfit2_2;
double stoploss2_2=StopLoss2_2;
double takeprofit3_2=TakeProfit3_2;
double stoploss3_2=StopLoss3_2;
int distance_2=Distance_2;

extern double  lots1_3          = 0.01;
extern double  lots2_3          = 0.02;
extern double  lots3_3          = 0.04;
input int      TakeProfit1_3     =   10;
input int      StopLoss1_3       =   400;
input int      TakeProfit2_3     =   10;
input int      StopLoss2_3       =   400;
input int      TakeProfit3_3     =   10;
input int      StopLoss3_3       =   400;
extern int     magic_3=000015;
extern int     Distance_3= 10;
double  Level_3          = 0;
extern double  MaxDeviation_3=9;         // Max Deviation, points

bool RunOnce_3=false;
int last_order_check_3=false;
datetime EaStartTime_3=TimeCurrent();
double takeprofit1_3=TakeProfit1_3;
double stoploss1_3=StopLoss1_3;
double takeprofit2_3=TakeProfit2_3;
double stoploss2_3=StopLoss2_3;
double takeprofit3_3=TakeProfit3_3;
double stoploss3_3=StopLoss3_3;
int distance_3=Distance_3;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer

   MathSrand(GetTickCount());
   if(Digits==5 || Digits==3)
     {
      takeprofit1_1  =TakeProfit1_1*10;
      stoploss1_1    =StopLoss1_1*10;
      takeprofit2_1  =TakeProfit2_1*10;
      stoploss2_1    =StopLoss2_1*10;
      takeprofit3_1  =TakeProfit3_1*10;
      stoploss3_1    =StopLoss3_1*10;
      takeprofit1_2=TakeProfit1_2*10;
      stoploss1_2    =StopLoss1_2*10;
      takeprofit2_2  =TakeProfit2_2*10;
      stoploss2_2    =StopLoss2_2*10;
      takeprofit3_2  =TakeProfit3_2*10;
      stoploss3_2    =StopLoss3_2*10;
      distance_2=Distance_2*10;
      takeprofit1_3=TakeProfit1_3*10;
      stoploss1_3    =StopLoss1_3*10;
      takeprofit2_3  =TakeProfit2_3*10;
      stoploss2_3    =StopLoss2_3*10;
      takeprofit3_3  =TakeProfit3_3*10;
      stoploss3_3    =StopLoss3_3*10;
      distance_3=Distance_3*10;
     }
   Level_2=Level_1+Point()*distance_2;
   Level_3=Level_1-Point()*distance_3;
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   OnTick_1();
   OnTick_2();
   OnTick_3();
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick_1()
  {
   if(IsLastOrderClose(magic_1,EaStartTime_1))
     {
      OnInit();
      Print("Ea Closed Manually ");
      EaStartTime_1=TimeCurrent();
     }
   int ticet;
   int t=MathRand();
   double MA_Fast1,MA_Low1;
   if(CountVsego(magic_1)==0)
     {
      MA_Fast1=iMA( NULL,0,5, 0, MODE_SMA, PRICE_TYPICAL, 0);
      MA_Low1=iMA( NULL, 0, 14, 0, MODE_SMA, PRICE_CLOSE, 1);

      if(Counts(magic_1,EaStartTime_1,RunOnce_1)==0 && MA_Fast1>MA_Low1 && (RunOnce_1 || (Ask>=Level_1 && Ask<=Level_1+(MaxDeviation_1*_Point) && Level_1!=0)))
        {
         ticet=OrderSend(Symbol(),OP_BUY,lots1_1,Ask,3,Bid-stoploss1_1*Point,Ask+takeprofit1_1*Point,"1.1",magic_1,0,clrGreen);
        }

      if(Counts(magic_1,EaStartTime_1,RunOnce_1)==0 && MA_Fast1<MA_Low1 && (RunOnce_1 || (Bid<=Level_1 && Bid>=Level_1-(MaxDeviation_1*_Point) && Level_1!=0)))
        {
         ticet=OrderSend(Symbol(),OP_SELL,lots1_1,Bid,3,Ask+stoploss1_1*Point,Bid-takeprofit1_1*Point,"1.1",magic_1,0,clrRed);
        }

      if(Counts(magic_1,EaStartTime_1,RunOnce_1)==1)
        {
         if(getLastOrderCloseType(magic_1)==1) ticet=OrderSend(Symbol(),OP_BUY,lots2_1,Ask,3,Bid-stoploss2_1*Point,Ask+takeprofit2_1*Point,"1.2",magic_1,0,clrGreen);
         if(getLastOrderCloseType(magic_1)==0) ticet=OrderSend(Symbol(),OP_SELL,lots2_1,Bid,3,Ask+stoploss2_1*Point,Bid-takeprofit2_1*Point,"1.2",magic_1,0,clrRed);
        }

      if(Counts(magic_1,EaStartTime_1,RunOnce_1)==2)
        {
         if(getLastOrderCloseType(magic_1)==1) ticet=OrderSend(Symbol(),OP_BUY,lots3_1,Ask,3,Bid-stoploss3_1*Point,Ask+takeprofit3_1*Point,"1.3",magic_1,0,clrGreen);
         if(getLastOrderCloseType(magic_1)==0) ticet=OrderSend(Symbol(),OP_SELL,lots3_1,Bid,3,Ask+stoploss3_1*Point,Bid-takeprofit3_1*Point,"1.3",magic_1,0,clrRed);
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick_2()
  {
   if(IsLastOrderClose(magic_2,EaStartTime_2))
     {
      OnInit();
      Print("Ea Closed Manually ");
      EaStartTime_2=TimeCurrent();
     }
   int ticet;
   int t=MathRand();
   double MA_Fast1,MA_Low1;
   if(CountVsego(magic_2)==0)
     {
      MA_Fast1=iMA( NULL,0,5, 0, MODE_SMA, PRICE_TYPICAL, 0); 
      MA_Low1=iMA( NULL, 0, 14, 0, MODE_SMA, PRICE_CLOSE, 1);
      if(Counts(magic_2,EaStartTime_2,RunOnce_2)==0 && MA_Fast1>MA_Low1 && (RunOnce_2 || (Ask>=Level_2 && Ask<=Level_2+(MaxDeviation_2*_Point) && Level_2!=0)))
        {
         ticet=OrderSend(Symbol(),OP_BUY,lots1_2,Ask,3,Bid-stoploss1_2*Point,Ask+takeprofit1_2*Point,"2.1",magic_2,0,clrGreen);
        }
      if(Counts(magic_2,EaStartTime_2,RunOnce_2)==0 && MA_Fast1<MA_Low1 && (RunOnce_2 || (Bid<=Level_2 && Bid>=Level_2-(MaxDeviation_2*_Point) && Level_2!=0)))
        {
         ticet=OrderSend(Symbol(),OP_SELL,lots1_2,Bid,3,Ask+stoploss1_2*Point,Bid-takeprofit1_2*Point,"2.1",magic_2,0,clrRed);
        }
      if(Counts(magic_2,EaStartTime_2,RunOnce_2)==1)
        {
         if(getLastOrderCloseType(magic_2)==1) ticet=OrderSend(Symbol(),OP_BUY,lots2_2,Ask,3,Bid-stoploss2_2*Point,Ask+takeprofit2_2*Point,"2.2",magic_2,0,clrGreen);
         if(getLastOrderCloseType(magic_2)==0) ticet=OrderSend(Symbol(),OP_SELL,lots2_2,Bid,3,Ask+stoploss2_2*Point,Bid-takeprofit2_2*Point,"2.2",magic_2,0,clrRed);
        }

      if(Counts(magic_2,EaStartTime_2,RunOnce_2)==2)
        {
         if(getLastOrderCloseType(magic_2)==1) ticet=OrderSend(Symbol(),OP_BUY,lots3_2,Ask,3,Bid-stoploss3_2*Point,Ask+takeprofit3_2*Point,"2.3",magic_2,0,clrGreen);
         if(getLastOrderCloseType(magic_2)==0) ticet=OrderSend(Symbol(),OP_SELL,lots3_2,Bid,3,Ask+stoploss3_2*Point,Bid-takeprofit3_2*Point,"2.3",magic_2,0,clrRed);
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick_3()
  {
   if(IsLastOrderClose(magic_3,EaStartTime_3))
     {
      OnInit();
      Print("Ea Closed Manually ");
      EaStartTime_3=TimeCurrent();
     }
   int ticet;
   int t=MathRand();
   double MA_Fast1,MA_Low1;
   if(CountVsego(magic_3)==0)
     {
      MA_Fast1=iMA( NULL,0,5, 0, MODE_SMA, PRICE_TYPICAL, 0); // áûñòðàÿ ÌÀ
      MA_Low1=iMA( NULL, 0, 14, 0, MODE_SMA, PRICE_CLOSE, 1); // ìåäëåííàÿ ÌÀ 
      if(Counts(magic_3,EaStartTime_3,RunOnce_3)==0 && MA_Fast1>MA_Low1 && (RunOnce_3 || (Ask>=Level_3 && Ask<=Level_3+(MaxDeviation_3*_Point) && Level_3!=0)))
        {
         ticet=OrderSend(Symbol(),OP_BUY,lots1_3,Ask,3,Bid-stoploss1_3*Point,Ask+takeprofit1_3*Point,"3.1",magic_3,0,clrGreen);
        }
      if(Counts(magic_3,EaStartTime_3,RunOnce_3)==0 && MA_Fast1<MA_Low1 && (RunOnce_3 || (Bid<=Level_3 && Bid>=Level_3-(MaxDeviation_3*_Point) && Level_3!=0)))
        {
         ticet=OrderSend(Symbol(),OP_SELL,lots1_3,Bid,3,Ask+stoploss1_3*Point,Bid-takeprofit1_3*Point,"3.1",magic_3,0,clrRed);
        }
      if(Counts(magic_3,EaStartTime_3,RunOnce_3)==1)
        {
         if(getLastOrderCloseType(magic_3)==1) ticet=OrderSend(Symbol(),OP_BUY,lots2_3,Ask,3,Bid-stoploss2_3*Point,Ask+takeprofit2_3*Point,"3.2",magic_3,0,clrGreen);
         if(getLastOrderCloseType(magic_3)==0) ticet=OrderSend(Symbol(),OP_SELL,lots2_3,Bid,3,Ask+stoploss2_3*Point,Bid-takeprofit2_3*Point,"3.2",magic_3,0,clrRed);
        }
      if(Counts(magic_3,EaStartTime_3,RunOnce_3)==2)
        {
         if(getLastOrderCloseType(magic_3)==1) ticet=OrderSend(Symbol(),OP_BUY,lots3_3,Ask,3,Bid-stoploss3_3*Point,Ask+takeprofit3_3*Point,"3.3",magic_3,0,clrGreen);
         if(getLastOrderCloseType(magic_3)==0) ticet=OrderSend(Symbol(),OP_SELL,lots3_3,Bid,3,Ask+stoploss3_3*Point,Bid-takeprofit3_3*Point,"3.3",magic_3,0,clrRed);
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int getLastOrderCloseType(int magic)
  {
   datetime t=0;
   int tick=-1;
   int i,total=OrdersHistoryTotal();
   for(i=0; i<total; i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
           {
            if(t<OrderCloseTime())
              {
               t=OrderCloseTime();
               tick=OrderTicket();
              }
           }
        }
     }

   for(i=0; i<total; i++)
     {
      if(OrderSelect(tick,SELECT_BY_TICKET))
        {
         return OrderType();
        }
     }

   return tick;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountSELL(int magic)
  {
   int count=0;
   int i;
   for(i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_SELL)
            count++;
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountBUY(int magic)
  {
   int count=0;
   int i;
   for(i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderType()==OP_BUY)
            count++;
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
int Counts(int magic,datetime &EaStartTime,bool &RunOnce)
  {
   int count=0,i;

   for(i=OrdersHistoryTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic && OrderOpenTime()>=EaStartTime)
           {
            if(OrderProfit()<0)
              {
               if(count==0)
                 {
                  OnInit();
                  EaStartTime=TimeCurrent();
                  RunOnce=true;
                  return(count);
                 }
              }
            else
              {
               count++;
              }
           }
         if(count>2)
           {
            OnInit();
            EaStartTime=TimeCurrent();
            RunOnce=true;
            return(count);
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountVsego(int magic)
  {
   int Vsego;
   Vsego=CountBUY(magic)+CountSELL(magic);

   return(Vsego);
  }
//+------------------------------------------------------------------+
bool IsLastOrderClose(int magic,datetime &EaStartTime)
  {
   bool signal=false;
   for(int i=OrdersHistoryTotal()-1;i>=0;i--)
     {
      bool select=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
      if(select && OrderSymbol()==_Symbol && OrderMagicNumber()==magic)
        {
         if(OrderType()==OP_BUY && OrderOpenTime()>=EaStartTime)
           {
            if(OrderClosePrice()>OrderStopLoss() && OrderClosePrice()<OrderTakeProfit())
              {
               signal=true;
              }
            break;
           }
         else if(OrderType()==OP_SELL && OrderOpenTime()>=EaStartTime)
           {
            if(OrderClosePrice()<OrderStopLoss() && OrderClosePrice()>OrderTakeProfit())
              {
               signal=true;
              }
            break;
           }
        }
     }
   return(signal);
  }
//+------------------------------------------------------------------+

SUPER TAKE

//+------------------------------------------------------------------+
//|                    TakeProfit 1 |
//+------------------------------------------------------------------+

#property copyright ""
#property link      ""


                                       
extern double My_Money_Equity_Target=1;  
                                         
int Slippage=4;                                        
int i;

double   EquityTarget;
//+------------------------------------------------------------------+
                                  
//+------------------------------------------------------------------+
int init()
  {
//---- 
   EquityTarget = AccountEquity()+My_Money_Equity_Target;
//----
   return(0);
  }
//+------------------------------------------------------------------+
                               
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
                                         
//+------------------------------------------------------------------+


int start()
{
if (AccountEquity()>= EquityTarget)

   {
    for(i=OrdersTotal()-1;i>=0;i--)
       {
         if(OrderSelect(i,SELECT_BY_POS))
         {
            bool Res=false;
            if(OrderType()==OP_BUY)
            {
               Res = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Slippage,clrNONE);
            }else if(OrderType()==OP_SELL)
            {
               Res = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slippage,clrNONE);
            }else
            {
               Res = OrderDelete(OrderTicket());
            }
         } 
       }
      Print ("Equity reached to ",DoubleToStr(AccountEquity(),2));
      if(!Res)    return(0);
      EquityTarget = AccountEquity()+My_Money_Equity_Target;
   }  
   
   Comment("Balance: ",AccountBalance(),", Account Equity: ",AccountEquity(),", Account Profit: ",AccountProfit(),
           "\nMy Account Equity Target: ",EquityTarget);
   
  return(0);
}

Han respondido

1
Desarrollador 1
Evaluación
(204)
Proyectos
283
34%
Arbitraje
34
32% / 29%
Caducado
75
27%
Trabaja
Solicitudes similares
I want to decompile an ea file and get the source code, i need it really quick as fast as possible. the file must be delivered alongside the source code
I have an algo that is running on ProRealTime, they have their own language. It is a simple strategy with 5 conditions + SL/TP settings, very basic. I need someone that can convert or just create a functional MT5 algo (EA) from these conditions for me, if you do a good job I have around 10+ more algos that need to be transferred to MT5
Dear Developers, I would have a very simple request. I have a ML model developed in Python for EURUSD daily trading. I would like to backtest it in Meta Trader 5 using the Strategy Tester tool. For that I would need an Expert Advisor program. The input would be a csv file that contains two columns: - dates (going back for a few years on a daily basis) - trading signal (it can have only 2 values, either 1: Buy, or -1
Hi I have the code in pinescript for an indicator that I need done in Ninja Trader 1. The Trading View indicator code needs to be converted into and adapted for Ninja Trader 8 2. An indicator and Automated Trading Strategy needs to be developed. 3. Any parts of the Trading View Indicator that can't be replicated needs to be discussed with me and agreed before excluding. (there should not be any) 4. Trailing stop and
1. The Trading View indicator code needs to be converted into and adapted for Ninja Trader 8 2. An indicator and Automated Trading Strategy needs to be developed. 3. Any parts of the Trading View Indicator that can't be replicated needs to be discussed with me and agreed before excluding. (there should not be any) 4. Trailing stop and Trailing Draw Down options need to be implemented 5. Risk needs to be in % of
Create mt4 ea 50+ USD
To convert the provided MT4 indicator script into an Expert Advisor (EA) and implement prompt functionality for user input, we need to modify the code to handle external parameters and provide a user-friendly interface. Below is the EA code that incorporates prompts for user inputs
I WRITE a code i want to conect this for automatic trading through vps .and als advanced features for this code .i attached afile please watch .and give me perfect ea
Hi Developer, I would like to create the Scalping EA based for Mt4 on the investing.com data https://www.investing.com/currencies/eur-usd-technical EA have timing to adjust time to trade. follow the broker time. From starting time to end time EA have a adjustable Lot size (0.01 incremental to 0.01) EA have a adjustable TP (1pip to 100pip incremental 1pip) EA have a adjustable SL (1pip to 100pip incremental 1pip) EA
This is not an EA that actually opens/closes trades. Instead this project involves creating a dashboard where the user can create a grid trade scenario with initial entry and scale trade pip distances, lot sizes for each trade, and draw down amount. It then calculates the break-even + profit level where all trades would close. For each new scale trade the BE+ point is recalculated which is then displayed on the
Hi I have the code in pinescript for an indicator that I need done in Ninja Trader, I wanted this indicator in NT bcs I chart in NT, and if the indicator could also have been an automated strategy even better. Please confirm that it will be an indicator and Automated Trading Strategy

Información sobre el proyecto

Presupuesto
30+ USD
IVA (20%): 6 USD
Total: 36 USD
Para el ejecutor
27 USD
Plazo límite de ejecución
a 2 día(s)