if(rsi == rsi_level) signal = BUYSIGNAL;
Doubles are rarely equal. Understand the links in:
The == operand. - MQL4 programming forum #2 (2013)
Ernest Akoyi:
Like William rightly said, the probability of getting rsi == 50 is low 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
You can try coding it as a cross , that’s what I do
William Roeder #:
Doubles are rarely equal. Understand the links in:
The == operand. - MQL4 programming forum #2 (2013)
Thank you
Ernest Akoyi:
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 = 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; }

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
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