SAFeTRADE 646 posts msg #138644 - Ignore SAFeTRADE modified |
10/10/2017 8:01:26 AM
100 * LOG10( SUM(ATR(1), n) / ( MaxHi(n) - MinLo(n) ) ) / LOG10(n)
n = User defined period length.
LOG10(n) = base-10 LOG of n
ATR(1) = Average True Range (Period of 1)
SUM(ATR(1), n) = Sum of the Average True Range over past n bars
MaxHi(n) = The highest high over past n bars
Mathematically, log10(x) is equivalent to log(10, x) . ... The logarithm to the base 10 is defined for all complex arguments x ? 0. log10(x) rewrites logarithms to the base 10 in terms of the natural logarithm: log10(x) = ln(x)/ln(10)
Also shown as:
atr = atr(index, period);
total = sum(index, period, ATR);
lowest = lowest(index, period, LOW);
highest = highest(index, period, HIGH);
diff = highest - lowest;
temp = (total/diff);
Plot: chop = 100 * Math.log10(temp) / Math.log10(period);
Kevin I do not know about Log10. I can pretty much figure everything else. Is Log10
akin to Log only with a separate calc to arrive at Log10?
Safetrade
|
Kevin_in_GA 4,599 posts msg #138645 - Ignore Kevin_in_GA |
10/10/2017 8:44:54 AM
You already have this - the function is simply log10(insert data here). Example:
|
SAFeTRADE 646 posts msg #138648 - Ignore SAFeTRADE |
10/10/2017 8:58:10 AM
Kevin than you for quick reply. Very much appreciated.
Safetrade
|
SAFeTRADE 646 posts msg #138649 - Ignore SAFeTRADE |
10/10/2017 9:20:15 AM
set{x,10}
set{diff, high 10 day high - low 10 day low}
set{temp, atr(10) / diff}
set{a, log10(temp)}
set{b, log10(x)}
set{c, a / b}
set{chop, c * 100}
symlist(spy)
draw chop
This is what I have so far however Chop should be on a scale of 0 to 100.
It is not, can you see my error? Seems pretty straight forward.
Safetrade
|
SAFeTRADE 646 posts msg #138660 - Ignore SAFeTRADE |
10/10/2017 11:45:49 PM
My latest attempt, still don't think it is correct.
|
Kevin_in_GA 4,599 posts msg #138663 - Ignore Kevin_in_GA modified |
10/11/2017 8:06:39 AM
I'm pretty sure that the log10(x) when x = 10 is just 1 ... no real need for it here but it does give you the flexibility to look at other periods.
|
krumpnstuff 1 posts msg #158390 - Ignore krumpnstuff |
1/13/2022 10:59:04 AM
Safetrade,
dont know if youre still having issues with this (years later), but im newish to SF, and happened across this post...the reason your getting the wrong values was because you did not sum your ATR correctly. below is the working script:
set{x,10}
set{diff, high 10 day high - low 10 day low}
set{sum, sum(atr(1),10)}
set{temp, sum / diff}
set{a, log10(temp)}
set{b, log10(x)}
set{c, a / b}
set{chop, c * 100}
|