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”
@cjr30
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 🙂
JSParticipant
Senior
Here is the modified version:
// 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"
Thanks for your try cjr30.
If I compare both codes with same timeframe there is huge difference (yes it could be data).
Can someone else give it a try?
Hi, I've coded it too, I hadn't seen the JS code and I have the same result as him.
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