opening a new trade when a previous has closed.

 

Hi 

Im having trouble coding and script that allows me to open a trade automatically when my last active trade closes.

for example my "buy has hit its take profit."

I would like a "sell position to open" automatically 

and vice versa 

any help would be greatly appreciated 

thanks 

Extract profit down to the last pip
Extract profit down to the last pip
  • www.mql5.com
The article describes an attempt to combine theory with practice in the algorithmic trading field. Most of discussions concerning the creation of Trading Systems is connected with the use of historic bars and various indicators applied thereon. This is the most well covered field and thus we will not consider it. Bars represent a very artificial entity; therefore we will work with something closer to proto-data, namely the price ticks.
 
Brownie92: any help would be greatly appreciated

Help you with what? 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)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
          No free help (2017)

 
Brownie92:

Hi 

Im having trouble coding and script that allows me to open a trade automatically when my last active trade closes.

for example my "buy has hit its take profit."

I would like a "sell position to open" automatically 

and vice versa 

any help would be greatly appreciated 

thanks 


For this you could use the event handler OnTradeTransaction or OnTrade.

It will be called in case of a change to an open position.



 
Dominik Christian Egert #:

For this you could use the event handler OnTradeTransaction or OnTrade.

It will be called in case of a change to an open position.



Thanks for the help it's greatly appreciated.