RSI 21, 8 and 4 alltogether below/above the 50 level.

To add comments, please log in or register
MadaForex
121
MadaForex  

Hello Everyone,

For my own way of trading, i am modifying this indicator.

The problem is when the RSI 21, 8 and 4 alltogether below/above the 50 level, there is an arrow (in fact dot) on all candles.

I want it to be just on the 1st candle.

I need help here as i got nothing anywhere else.

PLUS : If possible i'd like to have an alert for a new signal.

Thank you very much for your help.

Regards.

//+------------------------------------------------------------------+

//| rsi extreme.mq4 |

//| Original Author: LordoftheMoney |

//| Expert advisor is in the codebase |

//| (Easiest RSI) |

//| Modified by MadaForex |

//+------------------------------------------------------------------+

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_width1 0

#property indicator_width2 0

#property indicator_color1 White

#property indicator_color2 Black

extern int rsiperiod = 21;

extern int rsiperiod2 = 8;

extern int rsiperiod3 = 4;

double buffy1[];

double buffy2[];

int cb=0;

int bar;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

int draw;

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,159);

SetIndexStyle(1,DRAW_ARROW);

SetIndexArrow(1,159);

SetIndexEmptyValue(0,0.0);

SetIndexLabel(0,"buy");

SetIndexLabel(1,"sell");

SetIndexDrawBegin(0,draw);

SetIndexDrawBegin(1,draw);

SetIndexBuffer(0,buffy1);

SetIndexBuffer(1,buffy2);

return(0);

}

//+------------------------------------------------------------------+

int deinit()

{

ObjectsDeleteAll(0,OBJ_ARROW);

return(0);

}

//+------------------------------------------------------------------+

int start()

{

if (bar==Time[0]) return(0);

int cb=IndicatorCounted();

int x;

if(Bars<=100) return(0);

if (cb<0) return(-1);

if (cb>0) cb--;

x=Bars-cb;

for(int i=0; i<x; i++)

{

double r1a = iRSI(NULL,0,rsiperiod,PRICE_WEIGHTED,i);

double r1b = iRSI(NULL,0,rsiperiod,PRICE_WEIGHTED,i+1);

double r2a = iRSI(NULL,0,rsiperiod2,PRICE_WEIGHTED,i);

double r2b = iRSI(NULL,0,rsiperiod2,PRICE_WEIGHTED,i+1);

double r3a = iRSI(NULL,0,rsiperiod3,PRICE_WEIGHTED,i);

double r3b = iRSI(NULL,0,rsiperiod3,PRICE_WEIGHTED,i+1);

if (r1a>50 && r2a>50 && r3a>50)

buffy1 = Low-15*Point;

bar=Time[0];

if (r1a<50 && r2a<50 && r3a<50)

buffy2 = High+15*Point;

bar=Time[0];

}

return(0);

}

//+------------------------------------------------------------------+

MadaForex
121
MadaForex  

Problem solved.

Regards.

To add comments, please log in or register