I don't know why it didn't open the transaction Which code is missing?

 
#property copyright "berani2"
#property link      "https://www.mql5.com"
#property version   "1.00"
#include <Trade\Trade.mqh>
 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   EventSetTimer(60);
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+

void kar_al()
{
CTrade islemlerim;
int i = PositionsTotal()-1;
while(i>=0)
{
if(islemlerim.PositionClose(PositionGetSymbol(i)))
i--;
} 


}




void OnTick()
  {
 double bakiye= AccountInfoDouble(ACCOUNT_BALANCE);
double kar = AccountInfoDouble(ACCOUNT_PROFIT);
double varlik = AccountInfoDouble(ACCOUNT_EQUITY);
 
  MqlTradeRequest  islem_ac;
  MqlTradeResult islem_sonuc;
  ZeroMemory(islem_ac);
  
islem_ac.action =TRADE_ACTION_DEAL;
islem_ac.type = ORDER_TYPE_BUY;
islem_ac.symbol = _Symbol;
islem_ac.volume = 0.10;
islem_ac.type_filling = ORDER_FILLING_FOK;
islem_ac.price = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
islem_ac.tp =0.20;
islem_ac.deviation =50;
 if(!PositionSelect(_Symbol))
 {
 OrderSend(islem_ac,islem_sonuc);
 }
 
 if ((varlik-bakiye) >1)
 { kar_al();
 
 }
 
 
 
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Trade function                                                   |
//+------------------------------------------------------------------+
void OnTrade()
  {
//---
   
  }
//+------------------------------------------------------------------+

 

R you sure your broker is using ORDER_FILLING_FOK ?

tp is not set right. here is an example:


Global:

input int magicNumber = 1;         // Magic Number
input double Lots = 0.1;                // Lot Size
input int SL_Pips = 100;                // Stop Loss in Pips
input int TP_Pips = 200;                // Take Profit in Pips
input ENUM_ORDER_TYPE_FILLING BROKER_FILLING_TYPE = ORDER_FILLING_IOC; // Broker Filling Type

double Ask, Bid;


OnTick:

Ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
Bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);


buy signal example:

if (buySignal && PositionsTotal() == 0)
{
    double lotSize = Lots;
    double sl = Ask - SL_Pips * _Point;
    double tp = Ask + TP_Pips * _Point;

    MqlTradeRequest request;
    MqlTradeResult result;

    ZeroMemory(request);
    ZeroMemory(result);

    request.action = TRADE_ACTION_DEAL;
    request.symbol = _Symbol;
    request.volume = lotSize;
    request.type = ORDER_TYPE_BUY;
    request.type_filling = BROKER_FILLING_TYPE;
    request.price = Ask;

    if (sl >= 0){
        request.sl = NormalizeDouble(sl, _Digits);
    }

    if (tp >= 0){
        request.tp = NormalizeDouble(tp, _Digits);
    }

    request.deviation = 3;
    request.magic = magicNumber;
    request.comment = "SuperTrend Buy";

    if (OrderSend(request, result))
    {
        Print("Buy order sent successfully.");
        lastTradeTime = TimeCurrent(); 
    }
    else
    {
        Print("Failed to send buy order. Error: ", GetLastError());
    }
}


sell signal example:

if (sellSignal && PositionsTotal() == 0)
{
    double lotSize = Lots;
    double sl = Bid + SL_Pips * _Point;
    double tp = Bid - TP_Pips * _Point;

    MqlTradeRequest request;
    MqlTradeResult result;

    ZeroMemory(request);
    ZeroMemory(result);

    request.action = TRADE_ACTION_DEAL;
    request.symbol = _Symbol;
    request.volume = lotSize;
    request.type = ORDER_TYPE_SELL;
    request.type_filling = BROKER_FILLING_TYPE;
    request.price = Bid;

    if (sl >= 0) {
        request.sl = NormalizeDouble(sl, _Digits);
    }

    if (tp >= 0) {
        request.tp = NormalizeDouble(tp, _Digits);
    }

    request.deviation = 3;
    request.magic = 0;
    request.comment = "SuperTrend Sell";

    if (OrderSend(request, result))
    {
        Print("Sell order sent successfully.");
        lastTradeTime = TimeCurrent();  
    }
    else
    {
        Print("Failed to send sell order. Error: ", GetLastError());
    }
}