I will write an advisor free of charge - page 112

 
Good health to all! Judging by the feedback on the forum on my question whether it is possible to make an owl based on coloured lines from the usual indicators present in the chart, it became clear from the feedback - it is possible. I.e., for example, the green one crosses the blue one, the blue one crosses the red one, etc. And when these conditions coincide, an order is placed in the appropriate direction. Why exactly by the lines? Because such an Expert Advisor would be a great helperfor a beginning trader who experiments a lot and checks numerous theories, and a really valuable time and nerve-saving Expert Advisor. Why is my message here, in the free EAs section? Because it will surely be useful, if not to everyone, then to many people. I am enclosing a screenshot for better understanding of what I am talking about.
Files:
o9b4dq-1.jpg  73 kb
 
Hello. Is there any way you can automate the Forex Academy SniperX strategy?
 
Hi all. Could you suggest something similar to this --e-CloseByProfit- EA will close all positions when they reach a predefined total profit or loss level --- only on MT5. Thank you.
 

Hello. Could you help me, if you have time Question is this, I need the EA to open an order on each signal of two indicators, (they give a signal when they are in certain combination) in a word, there should be several buy or sell orders in the market, respectively, according to the signals of the indicators. But I have only one order in the market and until it closes the next one does not open...... Is it a matter of order counting? Please give me a hint. I can send you the code if you need it.

Many thanks in advance!

 
danil77783:

Hello. Can you help me if you have time Question is this, I need the EA to open an order on each signal of two indicators, (they give a signal when they are in certain combination) in a word, there should be several orders in the market to buy or sell, accordingly, according to the signals of the indicators. But I have only one order in the market and until it closes the next one does not open...... Is it a matter of order counting? Please give me a hint. If you need it, i can send you the code.

Thanks in advance!

Well, you cannot fix your EA without the code unless you start to understand the programming. Most likely, your EA is written on the template with 1 order in the market and it is actually very difficult to correct because working with multiple orders and on different criteria is very different.

 
Pawel Egoshin:
What you need is an EA, a regular martin with an increase in pitch.

Isn't there a single option for Ilan? In fact, there are an awful lot of such plummers right in the open source, but you probably need to be presented on a platter...

 
Sergey Martynov:

Of course a lot of time has passed, but quick look through the code says that I have to write the bot again, based on the strategy - because it makes no sense so many calls to the indicator, because already in the call the result of the subsequent comparison is given, unless it is calculated for a tool with 4 digits BEFORE the decimal point...

 
yuriy kovalchuk:
Hi, Can you suggest something similar to this --e-CloseByProfit- EA will close all positions when it reaches a predefined total profit or loss --- only on MT5. Thank you.

Something like that. Only you need to enter your balance + what you want to profit

//+------------------------------------------------------------------+
//|                                                  CloseEquity.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

//+------------------------------------------------------------------+
//|                                          Close all if a loss.mq5 |
//|                              Copyright © 2020, Vladimir Karputov |
//|                     https://www.mql5.com/ru/market/product/43516 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2020, Vladimir Karputov"
#property link      "https://www.mql5.com/ru/market/product/43516"
#property version   "1.000"
/*
   barabashkakvn Trading engine 3.112
*/
#include <Trade\Trade.mqh>
#include <Trade\AccountInfo.mqh>
//---
CPositionInfo  m_position;                   // object of CPositionInfo class
CTrade         m_trade;                      // object of CTrade class
CAccountInfo   m_account;                    // object of CAccountInfo class
//--- input parameters
input double   InpProfit            = 150000;      // Profit Equity, in money
input bool     InpPrintLog          = false;       // Print log
input ulong    InpMagic             = 42967428;    // Magic number
//---
bool     m_stop                     = false;
int      ticks_to_close             = 1;           // количество тиков до снятия эксперта
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   m_trade.SetExpertMagicNumber(InpMagic);
   m_trade.SetMarginMode();
   m_trade.SetTypeFillingBySymbol(Symbol());
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(AccountInfoDouble(ACCOUNT_EQUITY)>InpProfit)
     {
      if(IsPositionExists())
        {
         CloseAllPositions();
         return;
        }
      else
        {
         Alert("It is necessary to restart the adviser");
         ExpertRemoves();
         m_stop=true;
        }
     }
   if(m_stop)
      return;
//---
  }
//+------------------------------------------------------------------+
//| Is position exists                                               |
//+------------------------------------------------------------------+
bool IsPositionExists(void)
  {
   for(int i=PositionsTotal()-1; i>=0; i--)
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         return(true);
//---
   return(false);
  }
//+------------------------------------------------------------------+
//| Close all positions                                              |
//+------------------------------------------------------------------+
void CloseAllPositions(void)
  {
   for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positions
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         if(!m_trade.PositionClose(m_position.Ticket())) // close a position by the specified m_symbol
            if(InpPrintLog)
               Print(__FILE__," ",__FUNCTION__,", ERROR: ","CTrade.PositionClose ",m_position.Ticket());
  }
//+------------------------------------------------------------------+
//| start function                                                   |
//+------------------------------------------------------------------+
void ExpertRemoves(void)
  {
   static int tick_counter=0;
//---
   tick_counter++;
   Comment("\nДо выгрузки эксперта ",__FILE__," осталось ",
           (ticks_to_close-tick_counter)," тиков ");
//--- до
   if(tick_counter>=ticks_to_close)
     {
      ExpertRemove();
      Print(TimeCurrent(),": ",__FUNCTION__," эксперт будет выгружен");
     }
   Print("tick_counter = ",tick_counter);
//---
  }
//+------------------------------------------------------------------+
Files:
CloseEquity.mq5  10 kb
 
Alexsandr San:

Something like that. You just need to put in your balance sheet + whatever you want to make.


Nah, that's more reliable.

//+------------------------------------------------------------------+
//|                                                  CloseEquity.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

//+------------------------------------------------------------------+
//|                                          Close all if a loss.mq5 |
//|                              Copyright © 2020, Vladimir Karputov |
//|                     https://www.mql5.com/ru/market/product/43516 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2020, Vladimir Karputov"
#property link      "https://www.mql5.com/ru/market/product/43516"
#property version   "1.000"
/*
   barabashkakvn Trading engine 3.112
*/
#include <Trade\Trade.mqh>
#include <Trade\AccountInfo.mqh>
//---
CPositionInfo  m_position;                   // object of CPositionInfo class
CTrade         m_trade;                      // object of CTrade class
CAccountInfo   m_account;                    // object of CAccountInfo class
//--- input parameters
input string   Template             = "ADX";       // Имя шаблона(without '.tpl')
input double   InpProfit            = 150000;      // Profit Equity, in money
input bool     InpPrintLog          = false;       // Print log
input ulong    InpMagic             = 42967428;    // Magic number
//---
bool     m_stop                     = false;
int      ticks_to_close             = 1;           // количество тиков до снятия эксперта
uint     SLEEPTIME                  = 1;           // Время паузы между повторами в секундах
ENUM_TIMEFRAMES TimeFrame;                         // Change TimeFrame - Current = dont changed
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   m_trade.SetExpertMagicNumber(InpMagic);
   m_trade.SetMarginMode();
   m_trade.SetTypeFillingBySymbol(Symbol());
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(AccountInfoDouble(ACCOUNT_EQUITY)>InpProfit)
     {
      if(IsPositionExists())
        {
         CloseAllPositions();
         Sleep(SLEEPTIME*1000);
         CloseAllPositions();
         return;
        }
      else
        {
         Alert("It is necessary to restart the adviser");
         ExpertRemoves();
         DeleteChart();
         m_stop=true;
        }
     }
   if(m_stop)
      return;
//---
  }
//+------------------------------------------------------------------+
//| Is position exists                                               |
//+------------------------------------------------------------------+
bool IsPositionExists(void)
  {
   for(int i=PositionsTotal()-1; i>=0; i--)
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         return(true);
//---
   return(false);
  }
//+------------------------------------------------------------------+
//| Close all positions                                              |
//+------------------------------------------------------------------+
void CloseAllPositions(void)
  {
   for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positions
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         if(!m_trade.PositionClose(m_position.Ticket())) // close a position by the specified m_symbol
            if(InpPrintLog)
               Print(__FILE__," ",__FUNCTION__,", ERROR: ","CTrade.PositionClose ",m_position.Ticket());
  }
//+------------------------------------------------------------------+
//| start function                                                   |
//+------------------------------------------------------------------+
void ExpertRemoves(void)
  {
   static int tick_counter=0;
//---
   tick_counter++;
   Comment("\nДо выгрузки эксперта ",__FILE__," осталось ",
           (ticks_to_close-tick_counter)," тиков ");
//--- до
   if(tick_counter>=ticks_to_close)
     {
      ExpertRemove();
      Print(TimeCurrent(),": ",__FUNCTION__," эксперт будет выгружен");
     }
   Print("tick_counter = ",tick_counter);
//---
  }
//+------------------------------------------------------------------+
//| start function                                                   |
//+------------------------------------------------------------------+
void DeleteChart(void)
  {
   long currChart,prevChart=ChartFirst();
   int i=0,limit=100;
   bool errTemplate;
   while(i<limit)
     {
      currChart=ChartNext(prevChart);
      if(TimeFrame!=PERIOD_CURRENT)
        {
         ChartSetSymbolPeriod(prevChart,ChartSymbol(prevChart),TimeFrame);
        }
      errTemplate=ChartApplyTemplate(prevChart,Template+".tpl");
      if(!errTemplate)
        {
         Print("Error ",ChartSymbol(prevChart),"-> ",GetLastError());
        }
      if(currChart<0)
         break;
      Print(i,ChartSymbol(currChart)," ID =",currChart);
      prevChart=currChart;
      i++;
     }
  }
//+------------------------------------------------------------------+
Files:
 

Nah, that's more reliable.


THANK YOU