Support n resistance -code needed in afl-basis follows

rvlv

Active Member
#12
Hi casoni

Your chart matches my description.
Thanks for posting.
regards
rvlv


-----------------------------------------------
HTML:
The code I am looking for has these unique qualities.
1.It uses higher time frame based lines or combination of LTF & HTF lines.
2.It joins the resistance -or high pivots that are very close and in a range to form a TIGHT zone of resistance or support. It looks as a high pivot and nearby Lower level high pivot are joined as a zone.

The concept is 
Step-1 we observe the first time a Zone forms & Mark it,(NO ACTION)
Step-2 the next time price revisits the zone we -measure-observe  and act with tight stop.
what are the chances ? about 65 to 70%.
why not more? 
No guarantee for anything in trading.when the smart money groups feel that all others now  know their game,they move the supply-demand zone higher or lower-in the process small fish get kicked out-the game can only be played by the smart money groups-other must be out

In fact,a high efficiency Supply or Demand zone(like the ones shown on chart posted by me) has a property that price INVARIABLY revisits that zone and we act by buying or selling on this event occurring.
what a trader need to do?
All technical analisys indicators & systems most likely bound to fail unless you apply supply-demand filter
 
Last edited:

rvlv

Active Member
#13
Hi friends
here is an old afl I got.
It looks bit complicated,can somebody siplify it please!
The code uses Graham Kavanagh,s support resistance levels formula.

it draws hourly,4 hourly,daily levels.
cheers
rvlv

HTML:
//Support and resistance levels using RSI.
//graham Kavanagh May 2003
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);
}
//=====================================================================================
 

casoni

Well-Known Member
#14
Hi casoni

Your chart matches my description.
Thanks for posting.
regards
rvlv


-----------------------------------------------
HTML:
The code I am looking for has these unique qualities.
1.It uses higher time frame based lines or combination of LTF & HTF lines.
2.It joins the resistance -or high pivots that are very close and in a range to form a TIGHT zone of resistance or support. It looks as a high pivot and nearby Lower level high pivot are joined as a zone.

The concept is 
Step-1 we observe the first time a Zone forms & Mark it,(NO ACTION)
Step-2 the next time price revisits the zone we -measure-observe  and act with tight stop.
what are the chances ? about 65 to 70%.
why not more? 
No guarantee for anything in trading.when the smart money groups feel that all others now  know their game,they move the supply-demand zone higher or lower-in the process small fish get kicked out-the game can only be played by the smart money groups-other must be out

In fact,a high efficiency Supply or Demand zone(like the ones shown on chart posted by me) has a property that price INVARIABLY revisits that zone and we act by buying or selling on this event occurring.
what a trader need to do?
All technical analisys indicators & systems most likely bound to fail unless you apply supply-demand filter
posting the code was delayed bcoz i was out of station
here the code

tf=Param("Time Frame (min)",60,1,10000,1);
tfrm=in1Minute*tf;
H1=TimeFrameGetPrice("H",TFRM);
L1=TimeFrameGetPrice("L",TFRM);

function GetXSupport(L1, Percentage, Back)
{
return ((BarCount - 1) - LastValue(TroughBars(L1, Percentage,Back)));
}
function GetYSupport(L1, Percentage, Back)
{
return (LastValue(Trough(L1, Percentage, back)));
}
function GetXResistance(H1, Percentage, Back)
{
return ((BarCount - 1) -LastValue(PeakBars(H1, Percentage, Back)));
}
function GetYResistance(H1, Percentage, Back)
{
return (LastValue(Peak(H1, Percentage, Back)));
}

Plot(C,"",3,64);
ShowSR = ParamToggle("Show Vert S/R","No|Yes", 1);
SRPer = Param("S/R Percentage", 0.3, 0.1,5,0.1);
SRBack = Param("S/R Back", 5, 1,15,1);



if(ShowSR)
{
for(i=1; i<=SRBack; i++)
{
x0 = GetXSupport(L1, SRPer, i);
x1 = BarCount-1;
y0 = GetYSupport(L1, SRPer, i);
x = LineArray(x0, y0, x1, y0, 0);
Plot(x, "", IIf(LastValue(C) > x, colorCustom12,colorCustom11),
styleLine|styleDashed|styleThick);
x0 = GetXResistance(H1, SRPer, i);
y0 = GetYResistance(H1, SRPer, i);
x = LineArray(x0, y0, x1, y0, 0);
Plot(x, "", IIf(LastValue(C) > x, colorCustom12,colorCustom11),
styleLine|styleDashed|styleThick);

}
}
Title=Name()+ " " +" Adv Sup / Res Lines @ Min " + TFRM /60;

thank you , sorry for inconvenience caused
 
#15
Hi casoni

Many thanks for this code.
This is slightly better than code posted by Hitesh on first look.
why? your code draws s/r zones where hitesh code misses them in some areas.

regards
ford
 

Similar threads