What didn't work ? Please show your code if you need coding help.
Alain Verleyen:
What didn't work ? Please show your code if you need coding help.
It does not return the value of RSI, it returns 10 even when I changed the symbol or timeframe
What didn't work ? Please show your code if you need coding help.
MT5.2014:
It does not return the value of RSI, it returns 10 even when I changed the symbol or timeframe
It does not return the value of RSI, it returns 10 even when I changed the symbol or timeframe
#property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 double iRSIBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { CopyBuffer(iRSI(_Symbol,PERIOD_H4,14,PRICE_CLOSE),0,0,1,iRSIBuffer); double irsiv = iRSIBuffer[0]; Comment (irsiv); if(irsiv<30.00) { Alert("Buy"); } return(rates_total); }it shows the comment (irsiv value) correctly, but it does not show the alert correctly (the if clause does not work)
MT5.2014:
it shows the comment (irsiv value) correctly, but it does not show the alert correctly (the if clause does not work)
it shows the comment (irsiv value) correctly, but it does not show the alert correctly (the if clause does not work)
Hi dude, I have the same issue, could you make it work?
I'm having the same proble with my code. It just prints out 10.0 constantly, also if I try it with iMA
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- double rsi = iRSI(NULL,0, 14, PRICE_CLOSE); //double movingAverage = iMA(NULL,0,15,0,MODE_SMA,PRICE_MEDIAN); Alert(rsi); } //+------------------------------------------------------------------+
Skester96: I'm just starting to use MQL5 and when I try to call the rsi, my terminal just
prints 10 constanly.
Of course, it does.
- What does iRSI return?
- Why are you calling it outside of OnInit?
Skester96:
I'm just starting to use MQL5 and when I try to call the rsi, my terminal just prints 10 constanly. Here is the sample code:
Read the documentation
Documentation on MQL5: Technical Indicators / iRSI
- www.mql5.com
//| Demo_iRSI.mq5 | //| Copyright 2011, MetaQuotes Software Corp. | //| https://www.mql5.com | "The method of creation of the handle is set through the 'type' parameter (function type...
Unfortunately the example in the documetation is a bit overkill for newbies. I was struggeling with the same issue.
IMHO the following article has a pretty good explanation for this issue:
https://www.mql5.com/en/articles/43
Have a look into the section: Connecting indicators
How to call indicators in MQL5
- www.mql5.com
In MQL5 there are several ways to call indicators, and they are mostly carried out using IndicatorCreate() and iCustom() functions. Moreover, these functions only return indicator handle, and further work on indicators is done through it. So what is a handle? How to deal with IndicatorCreate() and iCustom() functions? And how your expert will...
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
Hi guys,
I used iRSI function in following format
int iRSI(
string symbol, // symbol name
ENUM_TIMEFRAMES period, // period
int ma_period, // averaging period
ENUM_APPLIED_PRICE applied_price // type of price or handle
);
in an indicator to get the value of RSI on the last bar of a chart, but it did not work, does it need extra code or I am doing something wrong.
Thanks