Klinger Oscillator conversion
- This topic has 5 replies, 5 voices, and was last updated 2 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › Klinger Oscillator conversion
Is it possible to convert this Thinkscript code to Prorealcode.
input MALength = 13;
def DM = high – low;
def Trend = if hlc3 > hlc3[1] then 1 else -1;
def CM = DM + if Trend == Trend[1] then CM[1] else DM[1];
def VForce = if CM != 0 then Trend * 100 * volume * AbsValue(2 * DM / CM – 1) else VForce[1];
plot KVOsc = ExpAverage(VForce, 34) – ExpAverage(VForce, 55);
plot TriggerLine = Average(KVOsc, MALength);
plot ZeroLine = 0;Klin
No se si estará bien, pero creo que es de la siguiente forma:
I don’t know if it’s correct, but I think it’s like this:
MALength = 13
DM = high – low
hlc3= (high + low + close)/3
if(hlc3>hlc3[1]) THEN
Trend = 1
ELSE
Trend = -1
ENDIF
CM = DM
if Trend = Trend[1] then
CM = CM[1] + DM
else
CM = DM[1]
endif
if CM <> 0 then
VForce = Trend * 100 * volume * Abs(2 * DM / CM – 1)
else
VForce = VForce[1]
endif
KVOsc = ExponentialAverage[34](VForce) – ExponentialAverage[55](VForce)
TriggerLine = Average[MALength](KVOsc)
return KVOsc as “Klinger” ,TriggerLine as “Signal”
Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums
Thanks 🙂
Here is the modified version:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
// Define input parameter MALength = 13 HLC3=(High+Low+Close)/3 // Calculate DM (Daily Movement) DM = HIGH - LOW // Determine Trend IF (HLC3 > HLC3[1]) THEN Trend = 1 ELSE Trend = -1 ENDIF // Calculate CM (Cumulative Movement) IF (Trend = Trend[1]) THEN CM = DM + CM[1] ELSE CM = DM + DM[1] ENDIF // Calculate VForce (Volume Force) IF (CM <> 0) THEN VForce = Trend * 100 * Volume * abs(2 * DM / CM - 1) ELSE VForce = VForce[1] ENDIF // Calculate KVOscillator (KVOsc) KVOsc = Average[34,1](VForce) - Average[55,1](VForce) // Calculate Trigger Line (Signal Line) TriggerLine = Average[MALength](KVOsc) // Define Zero Line ZeroLine = 0 // Plot the indicators RETURN KVOsc AS "KVOsc" Coloured("Yellow"), TriggerLine AS "TriggerLine" Coloured("Green"), ZeroLine AS "ZeroLine" |
Hi, I've coded it too, I hadn't seen the JS code and I have the same result as him.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
MaLength=13 dm=high-low hlc3=(high+low+close)/3 if hlc3 > hlc3[1] then trend=1 else trend=-1 endif if trend=trend[1] then cm=dm+cm[1] else cm=dm+dm[1] endif if cm<>0 then vForce=trend*100*volume*abs(2*dm/cm-1) else vForce=vForce[1] endif KVosc=average[34,1](vForce)-average[55,1](vForce) triggerline=average[MaLength](KVosc) zero=0 return KVosc coloured("blue"), triggerline coloured("red"), zero |
Find exclusive trading pro-tools on