Your Rsi/MARsi buffers have no size. You can't use them.
put them back like you had before and ADD the cross up/down buffers and change to total
#property indicator_buffers 4
Your Rsi/MARsi buffers have no size. You can't use them.
put them back like you had before and ADD the cross up/down buffers and change to total
Thank you WHRoeder,
I have changed the #property indicator_buffers to 4, but still no arrows. There is something not right in my program. i hope you can help
u have to initialize the array
double Rsi[1000]; double MARsi[1000]; or some no.
u have to initialize the array
I do not know what you mean by that.
When I change the program so that I get arrows when the RSI cross the 50 line, it is working.
But how do I get an arrow when the RSI crosses his MA line? The code below shows it
#property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_width1 2 #property indicator_width2 1 //--- externe variabelen extern int iRSI_waarde = 14; extern int iMA_RSI = 5; //--- buffers double CrossUp[]; double CrossDown[]; int init() { //---- indicators SetIndexStyle(0, DRAW_ARROW,EMPTY); SetIndexArrow(0, 233); SetIndexBuffer(0, CrossUp); SetIndexStyle(1, DRAW_ARROW, EMPTY); SetIndexArrow(1, 234); SetIndexBuffer(1, CrossDown); return(0); } int deinit() { //---- //---- return(0); } int start() { double Rsi[]; double MARsi[]; int counted_bars=IndicatorCounted(); if(counted_bars > 0) counted_bars--; int BerekenCandles = Bars - counted_bars; for(int t = BerekenCandles; t >= 0; t--) { Rsi[t] = iRSI(NULL,0,iRSI_waarde,PRICE_CLOSE,t); } for(int s = BerekenCandles - 1; s>=0; s--) { MARsi[s]=iMAOnArray(Rsi, 0, iMA_RSI, 0, MODE_EMA, s); } for(int q = BerekenCandles - 1; q>=0; q--) { double myRSInow = iRSI(NULL,0,iRSI_waarde,PRICE_CLOSE,q); double myRSI2 = iRSI(NULL,0,iRSI_waarde,PRICE_CLOSE,q+1); //RSI One bar ago if(myRSInow>50 && myRSI2<50)CrossUp[q] = Low[q+1];//RSI crosses the 50 line UP if(myRSInow<50 && myRSI2>50)CrossDown[q] = High[q+1];// RSI crosses the 50 line down } return(0); } //+------------------------------------------------------------------+
You added 2 arrays . . .
did you mean to add 2 new buffers ?
Arrays and buffers are similar . . . yet different. It is the difference that are important. You can't just have an array without telling it how big it is . . . you can with a buffer.
Thank you RaptorUK,
I changed the code and yes, it is working. Thanks
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I wrote an indicator of an RSI and an MA of that RSI. It work fine.
Now I want to change the indicator that it draws arrows when the lines crossing in the chart window.
This is the indicator that is working OK:
Now I try to modify this indicator, so I get the arrows. It is not working, please advice what is wrong