please help me out here: I want to say if Equity greater than start blance +200 close all tades for the day

 
please help me out here: I want to say if Equity greater than start blance +200 close all tades for the day
//+------------------------------------------------------------------+
//|                                                     DMF Real.mq4 |
//|                 Copyright 2021, ITace Inc. (Marve)Software Corp. |
//|                                             https://www.ITace.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, ITace Inc. (Marve)Software Corp."
#property link      "https://www.ITace.com"
#property version   "1.00"
#property strict
input string TradingBetween = "16:00-23:59";
input double SL= 50;
input double TP= 15;
input double LotSize= 0.4;
input double PF=9;
input double SPF=9;
void OnTick()
{     
      bool closed, validTime = isValidTime2Trade(TradingBetween);
      double ask = MarketInfo ( Symbol(), MODE_ASK ),bid = MarketInfo ( Symbol(), MODE_BID );
      int ticket1, ticket2,OrdrTotal = OrdersTotal();
 if(OrdrTotal<1 && validTime==true)
   {
    ticket1=OrderSend(Symbol(),OP_SELL, LotSize, NormalizeDouble(bid,Digits),0,NormalizeDouble(bid+SL,Digits),NormalizeDouble(bid-TP,Digits),NULL,2000,0,clrRed);
    ticket2=OrderSend(Symbol(),OP_BUY ,LotSize, NormalizeDouble(ask,Digits),0,NormalizeDouble(ask-SL,Digits),NormalizeDouble(ask+TP,Digits),NULL,2000,0,clrGreen);
    }
   if(OrderSelect(SELECT_BY_POS,MODE_TRADES))
        {
         if(OrdrTotal==1 && OrderType()==OP_BUY)
           {
            if(Ask==OrderOpenPrice()-PF*_Digits) closed=OrderClose(OrderTicket(),OrderLots(),bid,0,clrWhite);
             {
            if(OrdrTotal==1 && OrderType()==OP_SELL)
            {
            if(Bid==OrderOpenPrice()+SPF*_Digits) closed=OrderClose(OrderTicket(),OrderLots(),ask,0,clrWhite);
            }
         }
       }  
     }
   
  }
  #define HR2400 86400
#define SECONDS uint
SECONDS    time(datetime when=0) {return SECONDS(when == 0 ? TimeCurrent() : when) % HR2400;               }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
datetime   date(datetime when=0) {return datetime((when == 0 ? TimeCurrent() : when) - time(when));      }
bool isValidTime(SECONDS t0, SECONDS t1, datetime when=0) {SECONDS now = time(when); return t0 < t1 ? t0 <= now && now < t1  : !isValidTime(t1, t0, when);}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void TradingTimeSplit(string str,int &t0,int&t1)
  {
   string res[];
   StringSplit(str,StringGetCharacter("-",0),res);
   string T0=res[0],T1=res[1];
   int H0,M0,H1,M1;
   ArrayFree(res);
   StringSplit(T0,StringGetCharacter(":",0),res);
   H0=StrToInteger(res[0]);
   M0=StrToInteger(res[1]);
   t0=H0*60*60+M0*60;
   ArrayFree(res);
   StringSplit(T1,StringGetCharacter(":",0),res);
   H1=StrToInteger(res[0]);
   M1=StrToInteger(res[1]);
   t1=H1*60*60+M1*60;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool isValidTime2Trade(string str)
  {
   int t0,t1;
   TradingTimeSplit(str,t0,t1);
   return(isValidTime(t0,t1));
  }
//+------------------------------------------------------------------+

1. please help me out here: I want to say if Equity greater than start blance +200 close all tades for the day

2. i have 2 POST_MODE TRADES condition but only first one works second condition not closing trades.

 
  1.    if(OrderSelect(SELECT_BY_POS,MODE_TRADES))

    Invalid call.

  2. Marvelous Agbor: please help me out here: I want to say if Equity greater than start blance +200 close all tades for the day

    Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help 2017.04.21

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum 2018.05.12

    We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
              No free help 2017.04.21

    At the start of the day remember the balance.
              Please help with one trade per day code - Day Trading - Expert Advisors and Automated Trading - MQL5 programming forum #3.2 2020.11.11

    Each tick test the balance and close all trades.

    In the presence of multiple orders (one EA multiple charts, multiple EAs, manual trading), while you are waiting for the current operation (closing, deleting, modifying) to complete, any number of other operations on other orders could have concurrently happened and changed the position indexing:

    1. For non-FIFO (non-US brokers), (or the EA only opens one order per symbol), you can simply count down, in a position loop, and you won't miss orders. Get in the habit of always counting down.
                Loops and Closing or Deleting Orders - MQL4 programming forum
    2. For In First Out (FIFO rules — US brokers), and you (potentially) process multiple orders per symbol, you must find the earliest order (count up), close it, and on a successful operation, reprocess all positions.
                CloseOrders by FIFO Rules - Strategy Tester - MQL4 programming forum - Page 2 #16
                MetaTrader 5 platform beta build 2155: MQL5 scope, global Strategy Tester and built-in Virtual Hosting updates - Best Expert Advisors - General - MQL5 programming forum #1.11 ACCOUNT_FIFO_CLOSE

    3. and check OrderSelect in case later positions were deleted.
                What are Function return values ? How do I use them ? - MQL4 programming forum
                Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
    4. and if you (potentially) process multiple orders, must call RefreshRates() after server calls if you want to use, on the next order / server call, the Predefined Variables (Bid/Ask.) Or instead, be direction independent and just use OrderClosePrice().