How does one create an "if closed" statement?

 

I want to insert new instructions in my EA. I want to tell it at a certain point that if a close happened, then it shd carry out following instructions. Below is how I want to do it but I do not know if it is correct.

 if (  CLOSELONG(Symbol())   )

{

//instructions here...

//instructions here...

 

Please say if this is correct 

 
dafiriscott:

I want to insert new instructions in my EA. I want to tell it at a certain point that if a close happened, then it shd carry out following instructions. Below is how I want to do it but I do not know if it is correct.

 if (  CLOSELONG(Symbol())   )

{

//instructions here...

//instructions here...

 

Please say if this is correct 

You have to use OnTradeTransaction() event handler if you want to detect "close". Also, I suggest you to read this article         Orders, Positions and Deals in MetaTrader 5
 
angevoyageur:
You have to use OnTradeTransaction() event handler if you want to detect "close". Also, I suggest you to read this article         Orders, Positions and Deals in MetaTrader 5
Thank you very much
 
angevoyageur:
You have to use OnTradeTransaction() event handler if you want to detect "close". Also, I suggest you to read this article         Orders, Positions and Deals in MetaTrader 5
How can I do this with MQL4 please?
 
dafiriscott:
How can I do this with MQL4 please?
This forum is about MT5/mql5, please post your question about MT4/mql4 on mql4.com forum.
MQL4: automated trading forum
  • www.mql5.com
MQL4: automated trading forum
 
angevoyageur:
This forum is about MT5/mql5, please post your question about MT4/mql4 on mql4.com forum.
Done
Reason: