Need a restart function of my EA

MQL4 Experts C++

Job finished

Execution time 55 minutes
Feedback from customer
Exellent work and great programmer thank you again
Feedback from employee
Good Customer Thanks

Specification

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

Responded

1
Developer 1
Rating
(620)
Projects
680
57%
Arbitration
25
16% / 60%
Overdue
228
34%
Free
2
Developer 2
Rating
(48)
Projects
73
37%
Arbitration
22
9% / 41%
Overdue
14
19%
Working
3
Developer 3
Rating
(31)
Projects
42
26%
Arbitration
10
20% / 50%
Overdue
8
19%
Free
Similar orders
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)
Hi there - Overview We are seeking an experienced developer to create a Forex Robot Expert Advisor (EA) tailored to specific trading strategies and conditions. The EA will focus on the London trading session and will automate trades based on pre-defined calculations and market movements. *Responsibilities:* 1. *London Session Analysis:* - Develop functionality to highlight the London trading session on the forex
I am looking for someone who has experience working with the ZigZag indicator. I want to create a multi timeframe dashboard scanner based on ZigZag. I will explain more in private messages. if you feel capable & interest with that,please pm me for more details. thanks

Project information

Budget
30+ USD
VAT (20%): 6 USD
Total: 36 USD
For the developer
27 USD
Deadline
to 10 day(s)