RSI entry.
if(rsi == rsi_level) signal = BUYSIGNAL; Doubles are rarely equal. Understand the links in:
The == operand. - MQL4 programming forum #2 (2013)
Hello I am requesting your help on this piece of code. The idea is the EA should open both long and sell when the rsi is at 50 level. Note 50 level not greater or less than the level. Below is my code but if I use the equals sign (==) the orders are not triggered. Someone help
Doubles are rarely equal. Understand the links in:
The == operand. - MQL4 programming forum #2 (2013)
Thank you
string GetEntrySignal() { string signal = ""; double prev_rsi = 0; double curr_rsi = 0; double rsi = iRSI(_Symbol,PERIOD_CURRENT,RSIperiod,RSIprice,0); //buy if(rsi == rsi_level) signal = BUYSIGNAL; //sell if(rsi == rsi_level)signal= SELLSIGNAL; return signal; }
string GetEntrySignal() { string signal = ""; double prev_rsi = 0; double curr_rsi = 0; double rsi_Buy_Level=70; double rsi_Sell_Level=30; double rsiprev = iRSI(_Symbol,PERIOD_CURRENT,RSIperiod,RSIprice,1); double rsicurr = iRSI(_Symbol,PERIOD_CURRENT,RSIperiod,RSIprice,0); //buy if(rsiprev<rsi_Buy_Level && rsicurr>rsi_Buy_Level) signal = BUYSIGNAL; // Sell if(rsiprev>rsi_Sell_Level && rsicurr<rsi_Sell_Level) signal = SELLSIGNAL; //if(rsi == rsi_level) signal = BUYSIGNAL; //sell i//f(rsi == rsi_level)signal= SELLSIGNAL; return signal; }
Hello I am requesting your help on this piece of code. The idea is the EA should open both long and sell when the rsi is at 50 level. Note 50 level not greater or less than the level. Below is my code but if I use the equals sign (==) the orders are not triggered. Someone help