for(i=limit-1; i>=0; i--)
{
RSIbuffer[i] = iRSI(NULL,0,period,PRICE_CLOSE,i);
}
for(i=limit-1; i>=0; i--)
{
if (RSIbuffer[i+1] < 50 && RSIbuffer[i] > 50 ) draw green line
if (RSIbuffer[i+1] > 50 && RSIbuffer[i] < 50 ) draw red line
}
phy:
phy! its too easy! thanks. how come i couldnot think of it
for(i=limit-1; i>=0; i--)
{
RSIbuffer[i] = iRSI(NULL,0,period,PRICE_CLOSE,i);
}
for(i=limit-1; i>=0; i--)
{
if (RSIbuffer[i+1] < 50 && RSIbuffer[i] > 50 ) draw green line
if (RSIbuffer[i+1] > 50 && RSIbuffer[i] < 50 ) draw red line
}
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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.
i want to make a red vertical line when e.g. RSI goes down below
level 50 and a green line when its goes up above 50 level. but the problem is,
next bar can be its RSI still be below 50.
so i dont want the indicator to create many red vertical lines
every time RSI is below 50.
my code is like this
static int prevline=0;
// prevline=-1 <-- red line
// prevline=1 <-- green line
blabla...
{
for(i=limit-1; i>=0; i--)
{
RSIbuffer[i] = iRSI(NULL,0,period,PRICE_CLOSE,i);
if( RSIbuffer[i] < 50)
{
prevline=-1;
draw_redline();
}
if( RSIbuffer[i] > 50 )
{
prevline=1;
draw_greenline();
}
}
the code is not complete. my brain got stuck there. anyone please help me