Download MetaTrader 5

How does one create an "if closed" statement?

To add comments, please log in or register
Have you published a program in the Market? Place it in your blog as well - the widget will help!
Dafiri Irimagha
226
Dafiri Irimagha 2013.09.22 02:39 

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
30723
Alain Verleyen 2013.09.22 10:21  
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
226
Dafiri Irimagha 2013.09.22 14:26  
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
226
Dafiri Irimagha 2013.09.22 14:51  
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
30723
Alain Verleyen 2013.09.22 15:21  
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
226
Dafiri Irimagha 2013.09.22 17:23  
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