EA CODING QNs

 

Hi how do i write an mql4 ea with the following function:


1. open buy and sell together

2:

if(rsi gradient is negative(going down))

close buy order, set x pips tp  and y pips sl  for the sell order 


else if ( rsi gradient is positive (going up))

close sell order, set x pips tp  and y pips sl  for the buy order 


else (fyi if there is no clear indication of the direction of the rsi)

do nothing but continue hold the trade


anyone can help with this...? just starting to learn how to write

 

Why open both a buy and a sell if you are just going to close one?

You just lose money on the spread and possible commissions.

Better just to open a single trade according to the RSI.

The first thing that you need to do is study the documentation for iRSI and write the code to check whether it is rising or falling.