selfhigh05 23 posts msg #134580 - Ignore selfhigh05 |
2/25/2017 3:55:38 PM
Does anyone have a clue on how to calculate this in SF? I am not necessarily interested in getting the CCI coded on the OBV line I am only really interested in the OBV line and when it crosses above the EMA line.
I want to be able to search for stocks that have its OBV above the EMA line. I don't see or fully understand how he gets the EMA number relative to the OBV number. Any help would be appreciated, thanks.
//
// @author LazyBear
//
study("CCI coded OBV", shorttitle="CCIOBV_LB")
src = close
length = input(20, minval=1, title="CCI Length")
threshold=input(0, title="CCI threshold for OBV coding")
lengthema=input(13, title="EMA length")
obv(src) =>
cum(change(src) > 0 ? volume : change(src) < 0 ? -volume : 0*volume)
o=obv(src)
c=cci(src, length)
plot(o, color=c>=threshold?green:red, title="OBV_CCI coded", linewidth=2)
plot(ema(o,lengthema), color=orange, linewidth=2)
|
four 5,087 posts msg #134592 - Ignore four |
2/26/2017 1:16:16 PM
??
|
selfhigh05 23 posts msg #134596 - Ignore selfhigh05 |
2/26/2017 3:51:23 PM
too bad I cant post a pic of what it looks like but the goal of what I am trying to accomplish is capturing when the OBV crosses EMA. Thanks for the try.
|
selfhigh05 23 posts msg #134688 - Ignore selfhigh05 |
3/1/2017 6:01:22 PM
I might have figured out what I need to do just don't know how to do it. Can someone help me with getting a formula for the EMA of OBV for a six bar period?
EMA(OBV,6)
Any help will be greatly appreciated.
|
selfhigh05 23 posts msg #134689 - Ignore selfhigh05 |
3/1/2017 6:02:57 PM
Here is the manual EMA formula:
EMA [today] = (Price [today] x K) + (EMA [yesterday] x (1 – K))
Where:
K = 2 ÷(N + 1)
N = the length of the EMA
Price [today] = the current closing price
EMA [yesterday] = the previous EMA value
EMA [today] = the current EMA value
|
mahkoh 1,065 posts msg #134703 - Ignore mahkoh |
3/2/2017 12:37:11 PM
Maybe custom EMA formula?
set{emaobv, cema(obv(6),6)}
|