Need a function Equity target

MQL4 Indicateurs Experts

Tâche terminée

Temps d'exécution 3 heures
Commentaires de l'employé
Good Customer
Commentaires du client
Exellent work, super and fast thank you I recomande :)

Spécifications

Hello,

My problem is the trigger on the AccountProfit function.
 what I would like is that it is on AccountEquity + Target .


Example:

My account Equity is 458, my target is 1, when my AccountEquity will arrive at
459 "Boom" all orders are closed, and my AccountEquity goes to 460 then 461 ect ....


//+------------------------------------------------------------------+
//|                                              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.3000;
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
input int GlobalEATP=1; // Profit close in USD (should be positive value, 0=off)
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;
double profitCurrent=0;
string label_name="profit";
//+------------------------------------------------------------------+
//| 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();
   
   statisticEA();
   if(profitCurrent>=GlobalEATP && GlobalEATP>0)
      CloseAll();


  }
//+------------------------------------------------------------------+
//| 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)
           {
          ---------------------------------------------------------------+


Répondu

1
Développeur 1
Évaluation
(1086)
Projets
1437
45%
Arbitrage
48
73% / 13%
En retard
35
2%
Travail
2
Développeur 2
Évaluation
(365)
Projets
412
36%
Arbitrage
35
26% / 57%
En retard
63
15%
Gratuit
3
Développeur 3
Évaluation
(586)
Projets
918
46%
Arbitrage
31
39% / 29%
En retard
93
10%
Gratuit
4
Développeur 4
Évaluation
(173)
Projets
201
49%
Arbitrage
18
11% / 44%
En retard
1
0%
Gratuit
5
Développeur 5
Évaluation
(620)
Projets
680
57%
Arbitrage
25
16% / 60%
En retard
228
34%
Gratuit
6
Développeur 6
Évaluation
(466)
Projets
697
56%
Arbitrage
43
30% / 33%
En retard
113
16%
Travail
Commandes similaires
I want a program that will help calculate and enter the market on full margin for me. I just need to put in the price for entry, Stop loss and TP then it will calculate the lot sizes for entering the trade on full margin on Mt5
"I need an expert advisor (EA) based on stochastic divergence and candlestick formation. It should be able to identify both hidden and regular divergences. The EA should also include modified risk-reward ratios, modified timeframes, and a trailing stop loss. It is important that the EA is 100% accurate. Once an experienced developer applies, I will share the complete strategy."
I am seeking a highly skilled and experienced developer to assist with an important project. I need a development of an automated trading bot for NinjaTrader, utilizing a 4 SMA (Simple Moving Average) crossing strategy, with additional custom diversions for trade entries. The bot needs to be based on a strategy involving the crossing of four different SMAs. The exact periods for these SMAs and the conditions for
I need someone that can make expert advisor for backtesting purpose. The input file is History trade report export file from MQl5 the expert advisor should open position the exact time of open trade on the report. The same as the close time
So i have copier EA. The idea is the EA will triggered through manual OP by user via mobile or whatever platform. Let's say 0.01 lot to trigger it. After the EA takes master's position, the EA will be standby mode. If the master take more OP, the EA still not take the master's position (OP) until the user input manually once again via mobile for another 0.01 lot. Since this is a MT4 EA, Whenever user want to close
Hello, send robot models with a solid strategy (to trade forex), I want to use it to make money for the week. It is important that you present me with your profitability graph and a test. I also want to hire him for future jobs
I am looking to develop an automated trading bot based on a strategy involving the crossing of four Simple Moving Averages (SMA). The bot should be capable of entering trades based on this strategy. Additionally, I would like to incorporate some custom diversions tailored for NinjaTrader
Seeking an experienced MQL5 developer to create a sophisticated Expert Advisor focused on harmonic pattern trading . The EA will be designed to identify and trade based on popular harmonic patterns in the forex market. Entry and Exit Logic: Develop smart entry and exit rules based on pattern completions and price action confirmations. Risk Management: Incorporate adjustable risk-per-trade settings and position sizing
preciso de um robô com duas médias móveis, uma exponencial high e uma exponencial low. preciso também ter a opção de utilizar e todos os tempos gráficos e alterar os parâmetros das médias. entrada de compra será feita quando um candle de alta romper e fechar a cima da média high e fechará a posição quando um candle de baixa romper e fechar a baixo da média low. a venda será feita quando o candle de baixa romper e
Description - An expert advisor(s), placing sell trades in EUR/USD, based on the close price of the previous two candles, as shown in the figure below. The trades would be made in the 5 minute, 1 hour, and 1 day timeframes. In the 5 minute and 1 hour timeframes the market orders would be placed at the start of a new candle, at specific times EST. The order would be cancelled at the close of that candle, i.e after 5

Informations sur le projet

Budget
30+ USD
TVA (20%): 6 USD
Total: 36 USD
Pour le développeur
27 USD
Délais
à 2 jour(s)