Need a restart function of my EA

MQL4 Эксперты C++

Работа завершена

Время выполнения 55 минут
Отзыв от заказчика
Exellent work and great programmer thank you again
Отзыв от исполнителя
Good Customer Thanks

Техническое задание

Hello,
I would need my EA to start from the beginning (as if I dragged the EA on the chart)
when I close the order from the terminal by clicking on the cross

Exemple 

I drag my EA on the chart, it opens at a price for example 1.35240 and afterwards it is doing very good work.
But when I close the order from the terminal the EA immediately opens an order and that's a problem for me.
what I would like is that when I close the order from the terminal is that my order opens only to the given value 1.35240.

Complete Code


//+------------------------------------------------------------------+
//|                                                       test35.mq4 |
//|                                                              xxx |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "xxx"
#property link      "http://www.mql5.com"
#property version   "1.00"
#property strict
extern double lots=0.50;
extern int TakeProfit=12;
extern int StopLoss=5;
extern int magic=165276;
extern double Level = 1.34400;


bool RunOnce=false;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   RunOnce=false;
   MathSrand(GetTickCount());
   if(Digits==5 || Digits==3)
     {
      TakeProfit  *=10;
      StopLoss    *=10;
     }
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   int ticet;
   int t=MathRand();
  
   if(CountVsego()==0)
        {
      if(t>16384)
        {
         if(RunOnce || (Ask ==Level && Level !=0))
         {
            ticet=OrderSend(Symbol(),OP_BUY,lots,Ask,3,Bid-StopLoss*Point,Ask+TakeProfit*Point,"a",magic,0,clrGreen);
            if(ticet>0)
            {
               RunOnce=true;
            }
         }
        } 
     else if(t<16384)
        {
         if(RunOnce || (Bid ==Level && Level !=0))
         {
            ticet=OrderSend(Symbol(),OP_SELL,lots,Bid,3,Ask+StopLoss*Point,Bid-TakeProfit*Point,"a",magic,0,clrRed);
            if(ticet>0)
            {
               RunOnce=true;
            }
         }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountSELL()
  {
   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 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 CountVsego()
  {
   int Vsego;
   Vsego=CountBUY()+CountSELL();

   return(Vsego);
  }
//+------------------------------------------------------------------+

Откликнулись

1
Разработчик 1
Оценка
(620)
Проекты
680
57%
Арбитраж
25
16% / 60%
Просрочено
228
34%
Свободен
2
Разработчик 2
Оценка
(48)
Проекты
73
37%
Арбитраж
22
9% / 41%
Просрочено
14
19%
Работает
3
Разработчик 3
Оценка
(31)
Проекты
42
26%
Арбитраж
10
20% / 50%
Просрочено
8
19%
Свободен
Похожие заказы
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
Hi, I need a robot, which wil get instructions to trade in 3 symbols at the same time based on few parameters and calculations. Example: There is 1 symbol called Gold-Near and the rate for it is 1000-1002 If i specify that when the rate reaches 1050, it should sell 1 lot Upon execution it will have to sell 1 lot of cme gold, buy 3 lots of mcx gold and buy currently (lots will be based on calculation). All the
Hello, i am searching for an experienced, professional software engineer, who can convert three Indicators from MQL4 to MQL5. This may sound like an easy job, but one indicator is like a trading system and therefore a bit complex. So you need to have a very good understanding of both languages. You should also be able to code MQL5 classes ( https://www.mql5.com/en/docs/basis/oop ). The intention is to code MQL5
I have a full code ,, There are some errors in this.It does not add to the chart, does not show arrow marks, does not alert ,, fix this problem and work properly,, Contact on telegram @Gw_rakib1
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
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
The following url shows the steps to get MT4 to communicate with a MS SQL Server Express database. I need help getting that to work as the article is not making sense to me Integrating MetaTrader 4 Client Terminal with MS SQL Server - MQL4 Articles (mql5.com)

Информация о проекте

Бюджет
30+ USD
VAT (20%): 6 USD
Итого: 36 USD
Исполнителю
27 USD
Сроки выполнения
до 10 дн.