Registered User Joined: 3/10/2012 Posts: 465
|
hi Bruce
I use this in TOS and was wondering if you can please make this indicator(oscillator) for TC V16 so i can use in Scans
here is the formula for RSI and Fractal energy they are two seperate oscillators
Both Fractal Energy and RSI are plotted. RSI in cyan and FE in yellow. Look for trend exhaustion in the FE and a reversal of RSI or Price compression in FE and an RSI reversal.
declare lower;
#Inputs:
input nFE = 13;#hint nFE: length for Fractal Energy calculation.
# Variables:
def o;
def h;
def l;
def c;
def CU1;
def CU2;
def CU;
def CD1;
def CD2;
def CD;
def L0;
def L1;
def L2;
def L3;
plot RSI;
plot OS;
plot OB;
# Calculations
o = (open + close[1]) / 2;
h = Max(high, close[1]);
l = Min(low, close[1]);
c = (o + h + l + close) / 4;
plot gamma = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE) /
(Highest(high, nFE) - Lowest(low, nFE)))
/ Log(nFE);
gamma.SetDefaultColor(Color.Yellow);
L0 = (1 - gamma) * c + gamma * L0[1];
L1 = -gamma * L0 + L0[1] + gamma * L1[1];
L2 = -gamma * L1 + L1[1] + gamma * L2[1];
L3 = -gamma * L2 + L2[1] + gamma * L3[1];
if L0 >= L1
then {
CU1 = L0 - L1;
CD1 = 0;
} else {
CD1 = L1 - L0;
CU1 = 0;
}
if L1 >= L2
then {
CU2 = CU1 + L1 - L2;
CD2 = CD1;
} else {
CD2 = CD1 + L2 - L1;
CU2 = CU1;
}
if L2 >= L3
then {
CU = CU2 + L2 - L3;
CD = CD2;
} else {
CU = CU2;
CD = CD2 + L3 - L2;
}
RSI = if CU + CD <> 0 then CU / (CU + CD) else 0;
RSI.SetDefaultColor(Color.Cyan);
OS = if IsNaN(close) then Double.NaN else 0.2;
OS.SetDefaultColor(Color.Gray);
OS.HideBubble();
OS.HideTitle();
OB = if IsNaN(close) then Double.NaN else 0.8;
OB.SetDefaultColor(Color.Gray);
OB.HideBubble();
OB.HideTitle();
plot FEh = if isNaN(close) then double.nan else .618;
FEh.SetStyle(Curve.Long_Dash);
FEh.HideBubble();
FEh.SetDefaultColor(Color.Dark_Gray);
FEh.HideTitle();
plot FEl = if isNaN(close) then double.nan else .382;
FEl.SetStyle(Curve.Long_Dash);
FEl.SetDefaultColor(Color.Dark_Gray);
FEl.HideBubble();
FEl.HideTitle();
AddCloud(0, OS, Color.Green, Color.Green);
AddCloud(OB, 1, Color.Red, Color.Red);
Alert(RSI crosses below .9, "", Alert.BAR, Sound.Bell);
Alert(RSI crosses above .1, "", Alert.BAR, Sound.Bell);
# End Code RSI_Laguerre Self Adjusting with Fractal Energy
Thanks a lot
Dhiren
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I cannot do it. The best I can do is what has already been done in the Custom Indicator topic.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 3/10/2012 Posts: 465
|
Ok Thanks Bruce
while going through that link u gave , the 0.9 gamma seems to be close proximity but still not the best,
can i please get 0.1 and 0.2 gamma pcf as i could not figure how to do that... so that i can compare with TOS RSI formula as above
Cheers
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The closest we could really get using the technique in the referenced topic would be a gamma of .3333333 as this would be an exponential moving average of 2 (because (2-1) / (2+1)) = 1 / 3.
(ABS(C >= XAVGC2.1) * (XAVGC2 - XAVGC2.1) + ABS(C1 >= XAVGC2.2) * (XAVGC2.1 - XAVGC2.2) + ABS(C2 >= XAVGC2.3) * (XAVGC2.2 - XAVGC2.3))/ (ABS(XAVGC2 - XAVGC2.1) + ABS(XAVGC2.1 - XAVGC2.2) + ABS(XAVGC2.2 - XAVGC2.3) + .0000001)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 3/10/2012 Posts: 465
|
Yea that's what i figured.. i did do the same using your formula but i guess so there is no way to work around on that...with smaller number
No worries Bruce there are many interesting thing you have managed to code which helped to make good money
Thanks A lot for everything you do,
Cheers
Dhiren
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
We would need to expand all of the moving averages, but the fact that the periods are so short might mean the formulas don't end up being too long. I won't know for sure until I've done the expansions.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The .2 gamma version is short enough.
(ABS(C >= .80025608 * (C1 + .2 * (C2 + .2 * (C3 + .2 * (C4 + .2 * C5))))) * (C - .80025608 * (C1 + .2 * (C2 + .2 * (C3 + .2 * (C4 + .2 * C5))))) + ABS(C1 >= .80025608 * (C2 + .2 * (C3 + .2 * (C4 + .2 * (C5 + .2 * C6))))) * (C1 - .80025608 * (C2 + .2 * (C3 + .2 * (C4 + .2 * (C5 + .2 * C6))))) + ABS(C2 >= .80025608 * (C3 + .2 * (C4 + .2 * (C5 + .2 * (C6 + .2 * C7))))) * (C2 - .80025608 * (C3 + .2 * (C4 + .2 * (C5 + .2 * (C6 + .2 * C7)))))) / (ABS(C - .80025608 * (C1 + .2 * (C2 + .2 * (C3 + .2 * (C4 + .2 * C5))))) + ABS(C1 - .80025608 * (C2 + .2 * (C3 + .2 * (C4 + .2 * (C5 + .2 * C6))))) + ABS(C2 - .80025608 * (C3 + .2 * (C4 + .2 * (C5 + .2 * (C6 + .2 * C7))))) + .0000001)
And the .1 gamma version is even shorter.
(ABS(C >= .9009009 * (C1 + .1 * (C2 + .1 * C3))) * (C - .9009009 * (C1 + .1 * (C2 + .1 * C3))) + ABS(C1 >= .9009009 * (C2 + .1 * (C3 + .1 * C4))) * (C1 - .9009009 * (C2 + .1 * (C3 + .1 * C4))) + ABS(C2 >= .9009009 * (C3 + .1 * (C4 + .1 * C5))) * (C2 - .9009009 * (C3 + .1 * (C4 + .1 * C5)))) / (ABS(C - .9009009 * (C1 + .1 * (C2 + .1 * C3))) + ABS(C1 - .9009009 * (C2 + .1 * (C3 + .1 * C4))) + ABS(C2 - .9009009 * (C3 + .1 * (C4 + .1 * C5))) + .0000001)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|