1 Buy 1 Sell

 

Good day,

I have put together an EA based on the conditions is above/is below so the signal is continuous. However I would like the EA to put in one trade on the initial signal only, close after TP, then only open after there has been the opposite buy/sell signal and conditions have been met.

For example: Is above conditions are met, one BUY signal sent, trade closed after TP reached - Is below conditions are met, one SELL signal sent, trade closed after TP reached - Is above conditions are met, one BUY signal sent, trade closed after TP reached etc..

Basically 1 Buy - 1 Sell -1 Buy - 1 Sell - 1 Buy - 1 Sell etc..

Is there any way to code this?

 
  1. Find the current trade and do nothing.
  2. If there isn't any, find the latest trade from history. Remember its type.
  3. Test for your condition(s) matching the opposite type, and open.
 
William Roeder #:
  1. Find the current trade and do nothing.
  2. If there isn't any, find the latest trade from history. Remember its type.
  3. Test for your condition(s) matching the opposite type, and open.
Thanks for the response. In terms of automating the entire process with the EA, how could you code this?
 
BernhardHVL # In terms of automating the entire process with the EA, how could you code this?

Exactly as written. Order/Position select loop, static or global variable to remember. Etc.

You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
          No free help (2017)
Reason: