find reason for last closed order on symbol

 

Hello,


   I am working on an EA and am looking for a technique to do the following:

   Before opening an order, I want to find the last time an order on the desired symbol was closed and get the following info:

   1. Did it close in my favor.

   2. What Bar did it close on or, does the current bar == the bar the order closed on.

   If you know a technique, but don't have code, that is fine. I just need some pointers into the right direction.


take care,

lee

 
  1. OrderSelect() and OrderProfit() > 0
  2. OrderSelect() and int iBar = iBarShift(NULL,0, OrderCloseTime())
Was it too hard to RTFM?
 
kleelof:

Hello,


   I am working on an EA and am looking for a technique to do the following:

   Before opening an order, I want to find the last time an order on the desired symbol was closed and get the following info:

   1. Did it close in my favor.

   2. What Bar did it close on or, does the current bar == the bar the order closed on.

   If you know a technique, but don't have code, that is fine. I just need some pointers into the right direction.

Loop through the OrderHistory,  find the newest Order that matches your symbol,  OrderSelect it, Check it's OrderProfit(),  check it's OrderCloseTime(),  use iBarShift() to find the OrdrCloseTime() bar number,  is it 0 ?  Done.

 

Please read the documentation,   Trading Functions  &  Timeseries access

 

Thanks,

ALso, WHRoeder, there is no need to make such jerkoff comments.

It is not always easy to sort out and find answers to obscure things like this when you are new and the documentation is extensive.

If this forum is not for asking questions and getting insight into the system, then what is it for?


lee

 
kleelof:

Thanks,

ALso, WHRoeder, there is no need to make such jerkoff comments.

It is not always easy to sort out and find answers to obscure things like this when you are new and the documentation is extensive.

If this forum is not for asking questions and getting insight into the system, then what is it for

It's also for saying "Thank you"  when someone tries to help you and tries to help you hep yourself,  helping yourself if the fastest way to get help.

 

What you asked is very far from obscure,  it's basic Order History interrogation,  if it were obscure you wouldn't have gotten 2 similar answers within 11 minutes of asking for help

 

Hello,

  Sorry if my 'Thanks' was not clear enough. I do appreciate the help.

  If you are a programmer as well, then you must know what it is like trying to learn a new language. And especially one that requires so much specialized calls and functionality as MQL4 does.

  If you look at it like this, then you surly can understand why something like the request above can be difficult to sort out for a newbie, but not someone who has been working with MQL4 for sometime like you and WHRoeder.

lee

 
kleelof:

Hello,

  Sorry if my 'Thanks' was not clear enough. I do appreciate the help.

  If you are a programmer as well, then you must know what it is like trying to learn a new language. And especially one that requires so much specialized calls and functionality as MQL4 does.

  If you look at it like this, then you surly can understand why something like the request above can be difficult to sort out for a newbie, but not someone who has been working with MQL4 for sometime like you and WHRoeder.

Yes,  of course it takes time to learn your way around the documentation . . .  but the sooner you RTFM the sooner you will become familiar with it's layout,  I'd suggest you start at the top level,  Documentation,  and get an appreciation where you can find common groups of Functions,  for example Technical Indicators or  Conversion Functions  I still have problems finding some stuff,  for example break,  but then the search can be used to find that in less than 5 seconds.
 
Yes whroeder is usually rude and coincidentally the guy with the helmet who also happens to be a moderator usually backs him up
 
tonny:
Yes whroeder is usually rude and coincidentally the guy with the helmet who also happens to be a moderator usually backs him up
And Tonny is a SPAMMER who is one SPAMMING post away from a permanent BAN . . .
 
WHRoeder: Is usually 'rude' to spammers, trolls, and those too lazy to search, rtfm, or post a readable question because they have already been 'rude' to me by wasting my time. The rest usually get help.
Reason: