germanburrito
Active member
I found that by using the hurts indicators on different time frames the 5, 10, 15, 30, and hour can create walls that are difficult to break when this walls converge than the stock may become exhausted. The bigger the time frame the more difficult for the wall to move, however if the trend is strong then all walls may move at the same time, when there is a divergence then that means that the bigger time frames do not "care" about the smaller time frames. When the different time frames diverge too much, meaning the different time frames are closer to the 0 line and are at different prices than you might be in a stable, accumulation, or choppy market.
Code:
# Hurst_Oscillator
#
# www.trendxplorer.info
# [email protected]
#
# Build: July 25, 2012
# Rev 2: July 29, 2012: FlowPrice value to better reflect extremes
#
#
# --- script begin ----
#
declare lower;
input agg = AggregationPeriod.FIVE_MIN;
input price = hl2;
input length = 10;
input InnerValue = 1.6;
input OuterValue = 2.6;
input ExtremeValue = 4.2;
def displacement = (-length / 2) + 1;
def dPrice = price[displacement];
rec CMA = if !IsNaN(dPrice) then Average(dPrice, AbsValue(length)) else CMA[1] + (CMA[1] - CMA[2]);
#Rev 2: July 29, 2012: improved FlowPrice for better extremes
#def OscValue = if close > close[1] then high else if close < close[1] then low else (high + low)/2;
def OscValue =
if high(period = agg) >= high(period = agg)[1] and low(period = agg) <= low(period = agg)[1]
then
if close(period = agg) >= close(period = agg)[1] # high >= high[2]
then high(period = agg)
else low (period = agg)
else
if high(period = agg) > high(period = agg)[1]
then high (period = agg)
else
if low(period = agg) < low(period = agg)[1]
then low (period = agg)
else
if close (period = agg) > close(period = agg)[1]
then high (period = agg)
else
if close (period = agg) < close(period = agg)[1]
then low (period = agg)
else (high(period = agg) + low(period = agg)) / 2;
plot HurstOsc = (100 * OscValue / CMA) - 100;
HurstOsc.SetDefaultColor(GetColor(1));
HurstOsc.SetLineWeight(2);
input agg2 = AggregationPeriod.FIVE_MIN;
input price2 = hl2;
def displacement2 = (-length / 2) + 1;
def dPrice2 = price2[displacement2];
rec CMA2 = if !IsNaN(dPrice2) then Average(dPrice2, AbsValue(length)) else CMA2[1] + (CMA2[1] - CMA2[2]);
def OscValue2 =
if high(period = agg2) >= high(period = agg2)[1] and low(period = agg2) <= low(period = agg2)[1]
then
if close(period = agg2) >= close(period = agg2)[1] # high >= high[2]
then high(period = agg2)
else low (period = agg2)
else
if high(period = agg2) > high(period = agg2)[1]
then high (period = agg2)
else
if low(period = agg2) < low(period = agg2)[1]
then low (period = agg2)
else
if close (period = agg2) > close(period = agg2)[1]
then high (period = agg2)
else
if close (period = agg2) < close(period = agg2)[1]
then low (period = agg2)
else (high(period = agg2) + low(period = agg2)) / 2;
plot HurstOsc2 = (100 * OscValue2 / CMA2) - 100;
input agg3 = AggregationPeriod.FIVE_MIN;
input price3 = hl2;
def displacement3 = (-length / 2) + 1;
def dPrice3 = price3[displacement3];
rec CMA3 = if !IsNaN(dPrice3) then Average(dPrice3, AbsValue(length)) else CMA3[1] + (CMA3[1] - CMA3[2]);
#Rev 2: July 29, 2012: improved FlowPrice for better extremes
#def OscValue = if close > close[1] then high else if close < close[1] then low else (high + low)/2;
def OscValue3 =
if high(period = agg3) >= high(period = agg3)[1] and low(period = agg3) <= low(period = agg3)[1]
then
if close(period = agg3) >= close(period = agg3)[1] # high >= high[2]
then high(period = agg3)
else low (period = agg3)
else
if high(period = agg3) > high(period = agg3)[1]
then high (period = agg3)
else
if low(period = agg3) < low(period = agg3)[1]
then low (period = agg3)
else
if close (period = agg3) > close(period = agg3)[1]
then high (period = agg3)
else
if close (period = agg3) < close(period = agg3)[1]
then low (period = agg3)
else (high(period = agg3) + low(period = agg3)) / 2;
plot HurstOsc3 = (100 * OscValue3 / CMA3) - 100;
input agg4 = AggregationPeriod.FIVE_MIN;
input price4 = hl2;
def displacement4 = (-length / 2) + 1;
def dPrice4 = price4[displacement4];
rec CMA4 = if !IsNaN(dPrice4) then Average(dPrice4, AbsValue(length)) else CMA4[1] + (CMA4[1] - CMA4[2]);
def OscValue4 =
if high(period = agg4) >= high(period = agg4)[1] and low(period = agg4) <= low(period = agg4)[1]
then
if close(period = agg4) >= close(period = agg4)[1] # high >= high[2]
then high(period = agg4)
else low (period = agg4)
else
if high(period = agg4) > high(period = agg4)[1]
then high (period = agg4)
else
if low(period = agg4) < low(period = agg4)[1]
then low (period = agg4)
else
if close (period = agg4) > close(period = agg4)[1]
then high (period = agg4)
else
if close (period = agg4) < close(period = agg4)[1]
then low (period = agg4)
else (high(period = agg4) + low(period = agg4)) / 2;
plot HurstOsc4 = (100 * OscValue4 / CMA4) - 100;
input agg5 = AggregationPeriod.FIVE_MIN;
input price5 = hl2;
def displacement5 = (-length / 2) + 1;
def dPrice5 = price5[displacement5];
rec CMA5 = if !IsNaN(dPrice5) then Average(dPrice5, AbsValue(length)) else CMA5[1] + (CMA5[1] - CMA5[2]);
def OscValue5 =
if high(period = agg5) >= high(period = agg5)[1] and low(period = agg5) <= low(period = agg5)[1]
then
if close(period = agg5) >= close(period = agg5)[1] # high >= high[2]
then high(period = agg5)
else low (period = agg5)
else
if high(period = agg5) > high(period = agg5)[1]
then high (period = agg5)
else
if low(period = agg5) < low(period = agg5)[1]
then low (period = agg5)
else
if close (period = agg5) > close(period = agg5)[1]
then high (period = agg5)
else
if close (period = agg5) < close(period = agg5)[1]
then low (period = agg5)
else (high(period = agg5) + low(period = agg5)) / 2;
plot HurstOsc5 = (100 * OscValue5 / CMA5) - 100;
plot CenterLine = 0;
plot UpperExtremeBand = ExtremeValue;
plot LowerExtremeBand = - ExtremeValue;
plot UpperOuterBand = OuterValue;
plot LowerOuterBand = - OuterValue;
plot UpperInnerBand = InnerValue;
plot LowerInnerBand = - InnerValue;
CenterLine.SetDefaultColor(GetColor(7));
CenterLine.SetLineWeight(1);
UpperExtremeBand.SetDefaultColor(GetColor(4));
UpperExtremeBand.SetLineWeight(1);
LowerExtremeBand.SetDefaultColor(GetColor(4));
LowerExtremeBand.SetLineWeight(1);
UpperExtremeBand.Hide();
LowerExtremeBand.Hide();
UpperOuterBand.SetDefaultColor(GetColor(5));
UpperOuterBand.SetLineWeight(1);
LowerOuterBand.SetDefaultColor(GetColor(6));
LowerOuterBand.SetLineWeight(1);
UpperInnerBand.SetDefaultColor(GetColor(5));
UpperInnerBand.SetLineWeight(1);
UpperInnerBand.SetStyle(Curve.SHORT_DASH);
LowerInnerBand.SetDefaultColor(GetColor(6));
LowerInnerBand.SetLineWeight(1);
LowerInnerBand.SetStyle(Curve.SHORT_DASH);
# Turn AddClouds off by putting a #-sign at the first position of the lines
AddCloud(UpperOuterBand, UpperInnerBand, Color.RED);
AddCloud(LowerInnerBand, LowerOuterBand, Color.GREEN);
#
# --- script end ----
#