hedge after 2 bars

 

Hello,


Can you give me an idea how to write a function which closes a transaction and open opposite one if TP hadn't been taken for 2 bars period or help me with writing something like this.

Thank you in advance for any kind of help :)


Jakub 

 
magicjakub: Can you give me an idea how to write a function which closes a transaction and open opposite one if TP hadn't been taken for 2 bars period or help me with writing something like this.
  1. How do you think you do it?
    1. Find the open order.
    2. Get the open time.
    3. Use iBarShift to find how many bars ago.
    4. If more than two, close the trade and open the other.

  2. Help you with what? You haven't stated a problem, you stated a want.
    You have only four choices:
    1. Search for it,
    2. Beg at Will code your trading systems for free - Free Expert Advisors - Trading Systems - MQL5 programming forum, or Coding help - MQL4 and MetaTrader 4 - MQL4 programming forum, or Need help with coding - General - MQL5 programming forum, or Free MQL4 To MQL5 Converter - General - MQL5 programming forum, or Requests & Ideas (MQL5 only!).
    3. learn to code it. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
    4. or pay (Freelance) someone to code it.
    We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
              No free help
              urgent help.
 

Thanks, that's all i wanted to :) Thanks for an idea :)