Monday – Friday : 9:00 AM – 6:30 PM

Indicator Price Rsi V2 2

This Amibroker AFL, known as Indicator Price RSI V2 2, is an updated version (V2) specifically focused on the Relative Strength Index (RSI). It likely introduces refinements, enhancements, or additional features compared to its predecessor. Utilizing an Amibroker data feed, this AFL calculates RSI values based on historical price data and incorporates them into price charts. 

/_SECTION_BEGIN("Indicator price rsi  levels");
// RSI Levels - appplied to Price Chart shows how far 
// tomorrow's closing price has to move in order for  
// the RSI to cross the 70, 50 & 30 levels. 

pd = Param("Periods",6,5,144,1);
//variable = optimize("my optimization var", 9, 2, 20, 1 ); 
pd = Optimize("RSI",6,1,50,1);
pds = 2*pd-1;//     (Adjustment for Wilders MA) 
aa = Close-Ref(Close,-1); 
uu = EMA(Max(0,aa),pds); 
dd=  EMA((Max(0,0-aa)),pds); 

rf = IIf(C>2,1000,10000); 

c1 = Param("Upper Level",70,50,90,1); 
qq1 =100/(100-c1)-1; 
ff1 = qq1*dd-uu; 
ff2 = ff1/qq1; 
f1 = Max(ff1,ff2); 
UL = Close + f1*(pds-1)/2; 
UL = IIf(UL>C,floor(UL*rf),ceil(UL*rf))/rf; 

c2 = Param("Equilibrium",50,50,50,0);  

qq2 =100/(100-c2)-1;// [=1] 
ff = dd-uu; 
MM = Close + ff*(pds-1)/2; 
MM = IIf(MM>C,floor(MM*rf),ceil(MM*rf))/rf; 

c3 = Param("Lower Level",30,10,50,1); 
qq3 =100/(100-c3)-1; 
ff1 = qq3*dd-uu; 
ff2 = ff1/qq3; 
f3 = Min(ff1,ff2); 
LL = Close + f3*(pds-1)/2; 
LL = IIf(LL>C,floor(LL*rf),ceil(LL*rf))/rf; 

band = Param("band width",2.5,0,15,0.5);
band = Optimize("band width",2.5,0,15,0.5);

mmu = MM+band;
mmd = MM-band;

Cbr = IIf (Close > MMU AND Open > MMU, colorBlue, IIf(Close < MMD AND Open < MMD,colorRed,colorYellow)); 
//Cbr = IIf(ULC,colorRed,IIf(MM>C,colorPink,colorAqua))); 

Buy = Cross(Close, mmu);
Sell = Cross(mmd,Close);

Cover =Buy;
Short = Sell;
//Short = Cross(Close,mmd);
//Cover = Cross(mmd,Close);


X=Cross( C,LL);

Buy1= X ;
Sell1= Y ;


Filter=Buy1 OR Sell1 ;

Title = Name() + "  -  RSI(" + WriteVal(pd,0.0) + ")  -  Close=" +  WriteVal(Close,0.3) + "    UL=" +  WriteVal(UL,0.4) + "    MM=" +  WriteVal(MM,0.4) + "    LL=" +  WriteVal(LL,0.4); 

"plotted pivots \n
Plotted the avarage as a bars \n

//source http://www.traderji.com/amibroker/24404-help-amibroker-forumla-afl-saintjis-going-60min-flow-practice-2.html

// Written by Abhay (aad on www.traderji.com)

// Previous version 1.0 on 28.07.2008.
// Current Version 1.1 on 31.07.2008.

///// Major changes done from previous version 1.0 : //////

// The method of pivot definition is changed. 
// Now it does not use zig() or related functions anywhere.

// Stoploss line error, that it moves in both directions after a position is taken,
// is removed. Now stoploss lines are unidirectional.

// To protect profit on long positions, SELL is triggered either when trailing buy stop
// is hit OR when previous lower pivot is cracked. Fresh long position will be initiated 
// if uptrend continues after previous high pivot is cracked.   


// This is simple YET powerful pivot based trading system.
// Used only for intraday. Not suitable for EOD data.
// Designed for continuous trading. i.e. short=sell and cover=buy
// When long, watch crack of close in green line ONLY. Ignore red line.
// When short, watch crack of close in red line ONLY. Ignore green line.
// You will have to tweak the parameters as per your trading style.

// Warning : 	I have tried to develop this method from Saint's Pivot Based System (www.traderji.com) 
// 		However, it is very well possible that its performance is not as per actual system
// 		suggested by Saint due to programming errors and inadequate knowledge level at my end.
// Warning : 	Traders are advised to trade on their own, knowing very well that it is their money.

_SECTION_BEGIN("Simple Pivot based Trading System");

// User defined parameters.

GraphXSpace = 10; //defines how much extra space should be added above and below graph line (in percent).

dist = 0.25*ATR(10); 
Capital=Param("Total capital",100000,10000,1000000,1000);
drawdown=Param("Max. loss per trade as % of Capital", 1.0,0.5,25.0,0.1);
room=Param("Room for S/L as % of Pivot value",0.0005,0,0.02,0.0001);

// Now calculate pivots. Method courtesy : Kenneth (www.traderji.com)

PH= ValueWhen(
(Ref(H,-2) > Ref(H, -4)) AND
(Ref(H,-2) > Ref(H, -3)) AND
(Ref(H,-2) > Ref(H, -1)) AND
(Ref(H,-2) > H), Ref(H,-2));

PL= ValueWhen(
(Ref(L,-2) <= Ref(L, -4)) AND
(Ref(L,-2) <= Ref(L, -3)) AND
(Ref(L,-2) <= Ref(L, -1)) AND
(Ref(L,-2) <= L), Ref(L,-2));

// filter lines


//Uncomment following code if you wish to see the pivot lines.
Plot(Ref(PH,2), "UpPivot", ParamColor("UpPivot Color",colorRed), styleDashed+styleNoLabel);
Plot(Ref(PL,2), "DownPivot",ParamColor("DownPivot Color",colorGreen), styleDashed+styleNoLabel);

Plot(Ref(Phfilter,2), "Upfilter", ParamColor("upfilter Color",colorRed), styleLine);
Plot(Ref(Plfilter,2), "Downfilter",ParamColor("dnfilter Color",colorGreen), styleLine);

//Plot(Ref(UpFractal,2), "Up Fractal", ParamColor("Up Fractal Color",colorRed),8);
//Plot(Ref(DownFractal,2), "Down Fractal",ParamColor("Down Fractal Color",colorGreen),8);

/*for (a=4;a= H[a-4]) AND
(H[a-2] >= H[a-3]) AND
(H[a-2] >= H[a-1]) AND
(H[a-2] >= H[a]))
PlotText("PH", a-2, H[a-2], colorGreen);

if ((L[a-2] <= L[a-4]) AND
(L[a-2] <= L[a-3]) AND
(L[a-2] <= L[a-1]) AND
(L[a-2] <= L[a]))
PlotText("PL", a-2, L[a-2]-dist[a-2], colorRed);

//Condition for buy : Enter when Close crosses latest pivot high.
//Buy = C> (PH+(room*PH));




//Condition for sell : Exit when previous pivot low is cracked.
//Sell = C< (PL-(room*PL));

//Buy = ExRem(Buy,Sell);
//Sell= ExRem(Sell,Buy);

//Short = Sell;
//Cover = Buy;


//shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
//PlotShapes( shape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) );


Open chat
Hi, how can I help you?