RSI Based Support Resistance Levels



RSI Based Support Resistance Levels
RSI Based Support Resistance Levels


//www.aflcode.com
SetChartBkColor(64);
RSIperiod = 15; // Param("RSI p",30,14,30,1);

Percent   = 5; // Param("ZIG %",8,9,15,1);
EMAperiod  = 5; //Param("EMA p",4,5,10,1);
HHVperiod  = 5; //Param("HHV p",3,5,10,1);
NumLine   = 3; //Param("Num Lines",3,1,20,1);

Base = DEMA(RSI(RSIperiod),EMAperiod);

GraphXSpace=0.5;
Plot(C,"",colorBlack,styleCandle);

for( i = 1; i <= numline; i++ )
{
ResBase = LastValue(Peak(Base,Percent,i));
SupBase = LastValue(Trough(Base,Percent,i));
//Plot(ValueWhen( ResBase==Base, HHV(H,HHVperiod) ), "Resist Level", colorRed,styleLine);
//Plot(ValueWhen( supbase==Base, LLV(L,HHVperiod) ), "Support Level", colorGreen,styleLine);
}
Title = Name() + "; " + Date() + ": Support & Resistance Levels using RSI: " +
/*EncodeColor(colorGreen)+ "Support Levels are Green; "+EncodeColor(colorRed)+
"Resistance Levels are Red: "+EncodeColor(colorBlack)+*/ "Num lines
="+WriteVal(numline,1) ; 
//=======================================================================================

TimeFrameSet(inHourly);
Baseh = DEMA(RSI(RSIperiod),EMAperiod);
for( i = 1; i <= numline; i++ )
{
ResBaseh = LastValue(Peak(Baseh,Percent,i));
SupBaseh = LastValue(Trough(Baseh,Percent,i));

TimeFrameRestore();
basehexp =TimeFrameExpand(Baseh , inHourly);
Plot(ValueWhen( ResBaseh==Basehexp, HHV(H,HHVperiod) ), "Resist Levelhrly", colorYellow,styleLine);
Plot(ValueWhen( supbaseh==Basehexp, LLV(L,HHVperiod) ), "Support Levelhrly", colorAqua,styleLine);
}
//=====================================================================================

TimeFrameSet(4*inHourly);
Base4h = DEMA(RSI(RSIperiod),EMAperiod);
for( i = 1; i <= numline; i++ )
{
ResBase4h = LastValue(Peak(Baseh,Percent,i));
SupBase4h = LastValue(Trough(Baseh,Percent,i));

TimeFrameRestore();

base4hexp =TimeFrameExpand(Base4h , 4*inHourly);
Plot(ValueWhen( ResBase4h==Base4hexp, HHV(H,HHVperiod) ), "Resist Level4hrly", colorCustom12,styleLine);
Plot(ValueWhen( supbase4h==Base4hexp, LLV(L,HHVperiod) ), "Support Level4hrly", colorBrightGreen,styleLine);
}
//=====================================================================================

TimeFrameSet(inDaily);
BaseD = DEMA(RSI(RSIperiod),EMAperiod);
for( i = 1; i <= numline; i++ )
{
ResBaseD = LastValue(Peak(BaseD,Percent,i));
SupBaseD = LastValue(Trough(BaseD,Percent,i));

TimeFrameRestore();

baseDexp =TimeFrameExpand(BaseD , inDaily);
Plot(ValueWhen( ResBaseD==BaseDexp, HHV(H,HHVperiod) ), "Resist LevelDAIly", colorOrange,styleDashed);
Plot(ValueWhen( supbaseD==BaseDexp, LLV(L,HHVperiod) ), "Support LevelDAIly", colorDarkOliveGreen,styleDashed);
}
//=====================================================================================

Previous
Next Post »