Download MetaTrader 5

How does one create an "if closed" statement?

To add comments, please log in or register
Dafiri Irimagha
251
Dafiri Irimagha  

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 

Alain Verleyen
Moderator
35109
Alain Verleyen  
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
Dafiri Irimagha
251
Dafiri Irimagha  
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
Dafiri Irimagha
251
Dafiri Irimagha  
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?
Alain Verleyen
Moderator
35109
Alain Verleyen  
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
Dafiri Irimagha
251
Dafiri Irimagha  
angevoyageur:
This forum is about MT5/mql5, please post your question about MT4/mql4 on mql4.com forum.
Done
To add comments, please log in or register