When you post code please use the CODE button (Alt-S)!

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am writing my own EA to do a buy or sell order but it is only placing sell orders and no buy with no errors here codebelow
void OnTick()
{
// create a string variable for the signal
string signal="";
// calculate the RSI value
double RSIValue = iRSI(_Symbol,_Period,10,PRICE_CLOSE,0);
// if the RSI value is below 30
if (RSIValue<30)
{
//send a buy order
int buyticket = OrderSend
(
Symbol(),
OP_BUY,
0.10,
Ask,
3,
Ask-100*_Point,
Ask+10*_Point,
NULL,
0,
0,
Green
);
}
// if the RSI value is above 70
if (RSIValue>70)
{
//send a buy order
int sellticket = OrderSend
(
Symbol(),
OP_SELL,
0.10,
Bid,
3,
Bid+100*_Point,
Bid-10*_Point,
NULL,
0,
0,
Red
);
}
}