How to know there is a trade request in my EA? OnTradeTransaction is a bit behind my needs

 

What i want to do: When there is a transaction request(whether it comes from a stop loss order, target price order, or EA), i need to run a function to check something.If the function returns true,i need to stop the  transaction before the request has been executed.

What i tried: Put my function at the top of OnTradeTransaction, but all request has been executed when my function ran.

What i am thinking: Check m_request.order and m_request.action at the millisecond level. I don't know if it's feasible, I'm researching.

PS:Can someone tell me some tips for using chatgpt to write mql5? In order to complete a task, I often need to modify the prompt multiple times, but it still calls functions outside of the official documentation or misuses the official functions

Documentation on MQL5: Language Basics / Functions / Event Handling Functions
Documentation on MQL5: Language Basics / Functions / Event Handling Functions
  • www.mql5.com
Event Handling Functions - Functions - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5