Sunteți pe pagina 1din 8

BRSI Howard Wang

Based on Article, The Breakout Relative Strength Index by Howard Wang


September 2015 issue of Technical Analysis of Stocks & Commodities

Formula:

BRSI = 100-100/(1+Pavg/Navg), where


Pavg - average [p] at range from (i-Length+1) to (i),
Navg - average [n] at range from (i-Length+1) to (i),
p = Abs(BPower), if BPower[i]>BPower[i-1], else p = 0,
n = Abs(BPower), if BPower[i]<BPower[i-1], else n = 0,
BPower = BPrice*BStrength*BVolume,
BPrice[i] = (Open[i-1]+Max+Min+Close[i])/4,
BStrength[i] = (Close[i]-Open[i-1])/(Max-Min),
BVolume[i] = Volume[i]+Volume[i-1],
Max = Max(High[i], High[i-1]),
Min = Min(Low[i], Low[i-1]).

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

//| Breakout_RSI.mq4 |

//| Copyright © 2015, Gehtsoft USA LLC |

//| http://fxcodebase.com |

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

#property copyright "Copyright © 2015, Gehtsoft USA LLC"

#property link "http://fxcodebase.com"


#property indicator_separate_window

#property indicator_buffers 4

#property indicator_color1 Yellow

extern int Length=14;

extern double Overbought_Level=80.;

extern double Oversold_Level=20.;

double BRSI[];

double BPower[], n[], p[];

int init()

IndicatorShortName("Breakout RSI");

IndicatorDigits(Digits);

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,BRSI);

SetIndexStyle(1,DRAW_NONE);

SetIndexBuffer(1,BPower);

SetIndexStyle(2,DRAW_NONE);

SetIndexBuffer(2,n);

SetIndexStyle(3,DRAW_NONE);

SetIndexBuffer(3,p);

SetLevelValue(0, Overbought_Level);

SetLevelValue(1, Oversold_Level);
return(0);

int deinit()

return(0);

int start()

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

int ExtCountedBars=IndicatorCounted();

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

int limit=Bars-2;

if(ExtCountedBars>2) limit=Bars-ExtCountedBars-1;

int pos;

double Min, Max;

double BPrice, BStrength, BVolume;

pos=limit;

while(pos>=0)

Min=MathMin(Low[pos], Low[pos+1]);

Max=MathMax(High[pos], High[pos+1]);

BPrice=(Open[pos+1]+Max+Min+Close[pos])/4.;

BStrength=(Close[pos]-Open[pos+1])/(Max-Min);
BVolume=Volume[pos]+Volume[pos+1];

BPower[pos]=(BPrice*BStrength*BVolume)*Point;

if (BPower[pos]>BPower[pos+1])

p[pos]=MathAbs(BPower[pos]);

n[pos]=0.;

else

n[pos]=MathAbs(BPower[pos]);

p[pos]=0.;

pos--;

double Navg, Pavg;

pos=limit;

while(pos>=0)

Navg=iMAOnArray(n, 0, Length, 0, MODE_SMA, pos);

Pavg=iMAOnArray(p, 0, Length, 0, MODE_SMA, pos);

if (Navg!=0.)

{
BRSI[pos]=100.-100./(1.+Pavg/Navg);

else

BRSI[pos]=0.;

pos--;

return(0);

O indicador Breakout RSI é um oscillator baseado no artigo "The Breakout Relative Strength Index" por
Howard Wang na revista "Technical Analysis of Stocks & Commodities" (Setembro 2015).

O indicador possui três parâmetros de entrada:

 Period - período de cálculo


 Overbought - nível sobrecomprado
 Oversold - nível sobrevendido

BRSI = 100.0 - 100.0 / (1.0+AvgP/AvgN) ;

AvgP - SMA(P,Period)
AvgN - SMA(N,Period)

 Se BPower > PrevBPower


 P = Abs(BPower)

 Caso contrário
 P = 0

 Se BPower < PrevBPower


 N = Abs(BPower)

 Caso contrário
 N = 0


BPower = BPrice * BStrength * BVolume

BPrice = (PrevOpen+Max+Min+Close)/4.0

BStrength = (Close-PevOpen)/(Max-Min)

BVolume = Volume + PrevVolume

Max = Max(High,PrevHigh)

Min = Min(Low, PrevLow)

O indicador possui três parâmetros de entrada:

 Period - período de cálculo


 Overbought - nível sobrecomprado
 Oversold - nível sobrevendido

Calculation

BRSI = 100.0 - 100.0 / (1.0+AvgP/AvgN);


Where :

AvgP - SMA(P,Period)

AvgN - SMA(N,Period)

If BPower > PrevBPower P = Abs(BPower)

else P = 0;

If BPower < PrevBPower N = Abs(BPower)

else N = 0;

BPower = BPrice * BStrength * BVolume;

BPrice = (PrevOpen+Max+Min+Close)/4.0;

BStrength = (Close-PevOpen)/(Max-Min);

BVolume = Volume + PrevVolume;

MaxList = Max(High,PrevHigh);

MinList = Min(Low, PrevLow);

TradeStation Code DD:

Input:Length(10), OB(70), OS(30), OBColor(Green), OSColor(Red);

Var: BPrice(0),BVol(0),BStrength(0),BPower(0),P(0),N(0),BRatio(0),BRSI(0);

BPrice=(O+H+L+C/4);

BVol=Volume+Volume[1];

{BStrength= (Close-Open)/(High-Low);}

If (High-Low) <> 0 then BStrength = (Close - Open)/(High-Low) else BStrength = 1;

BPower=BPrice*BStrength*BVol;

P=0;N=0;
for value0 = 0 to Length -1 begin

if BPower[value0] > BPower[Value0+1] then P = P + absvalue(BPower[Value0]);

if BPower[value0] < BPower[Value0+1] then N = N + absvalue(BPower[Value0]);

End;

if N <> 0 then BRatio = P/N;

if 1+BRatio <> 0 then BRSI = 100-(100/(1+BRatio));

plot1(BRSI,"BRSI");

Plot2(OB,"OB");

Plot3(OS,"OS");

If BRSI > OB then SetPlotColor(1, OBColor);

If BRSI > OB then SetPlotWidth(1,3);

If BRSI < OS then SetPlotColor(1, OSColor);

If BRSI < OS then SetPlotWidth(1,3);

S-ar putea să vă placă și