This is my first pine script and is (probably) of no practical value whatsoever; however, it is interesting. The idea was to apply Newton's 2nd Law of motion (force = mass x acceleration) to the market and see what pops up. To do this, I applied Ohm's Law, the electrical version of Newton's 2nd, in the following manner; Voltage (V), or potential, is defined as the delta of the high and low (or open and close) of a bar. Amperage (I), or current, is defined as the volume of trades within the bar. Resistance (R) is then calculated using the Ohm's Law formula of R=V/I, and Power (P) is then defined as P=V*I. The plotted values are normalized EMA of the RSI of these series.
The implication is that Resistance (R) *should* be the price, and you can see how when using a "voltage" of open/close (vs. low/high), the R line always moves in the opposite directions of the price. When using low/high, it tends to move in the same direction as the price.
proc(_src,len) => a=rsi(_src, len) a:=ema(a,len) // the EMA is taken 3 times here because three EMAs of 4 is a lot smoother and tighter than one EMA of 16 a:=ema(a,len) a:=ema(a,len)
// ————— len = input(title="EMA and RSI Length", type=input.integer, defval=5) showBlu_V= input(title="Show V (blue - hi/lo delta)?", type=input.bool, defval=true) showRed_I= input(title="Show I (red - volume)?", type=input.bool, defval=true) showGre_R= input(title="Show R (green - balanced price)?", type=input.bool, defval=true) showYel_P= input(title="Show P (yellow - 'power')?", type=input.bool, defval=true) showClose= input(title="RSI/EMA of close?", type=input.bool, defval=false) hloc= input(title="Use High/Low (vs Open/Close)?", type=input.bool, defval=true)
// using hi-lo vs. close-open has a significent effect pole1 = low pole2 = high
if hloc pole1 := open pole2 := close
V=pole2-pole1 // Price range defines the range and equates to Voltage, or potential (which equates to FORCE) I=volume // Volume defines the movement and equates to Amperage, or current (which equates to ACCELERATION) R=V/I // Price defines the agreement between two opposing forces and equates to Resistance (which equates to MASS) P=V*I // In the electrical world, this is POWER... no idea what is means here C=close
mV=proc(V,len) mI=proc(I,len) mR=proc(R,len) mP=proc(P,len) mC=proc(C,len) // Don't know why this has a differenmt scale than the others
spacer =" " // I don't know how to set the x position to teh right of the last bar :/ sadd=" " V_lbl := label.new(bar_index, high, text = spacer+"V", style = label.style_none, size = size.normal) label.set_xy(V_lbl, bar_index, mV) label.set_textcolor(id=V_lbl, textcolor=color.blue)