Forum

how to create a function to execute only on closing any position. whether ontrade or ontradetransaction . ?

I have created some functions to run ONLY when I CLOSE any POSITION and to achieve this i am using this function. void OnTradeTransaction ( const MqlTradeTransaction & trans, const MqlTradeRequest & request, const MqlTradeResult & result) { Print ( "type is:" , trans.type); if (trans.type ==

I am unable to get closing time for any position and ontrade not working

Hello, I am scripting an EA to send post request using sockets in mql5. void OnTick () { Print ( "history-->" , HistoryOrdersTotal ()); int socket = SocketCreate (); // Check the handle if (socket != INVALID_HANDLE ) { // Connect if all is well if ( SocketConnect (socket

OnTrade() function not working

I have scripted and EA to get post request to my server with the required response but I am not able to add it to any chart it is getting removed automatically , however it is working perfectly when i am using OnTick() function , please do resolve this error