Hi,
I'm new to this language and I'm trying to understand what actually this code is doing:
Can any of you understand what actually at the end "H" is?
Please, any help is really appraciated
Thanks a lot,
Julian
Here is the complete code:
https://pastebin.com/a9svkFpv
I'm new to this language and I'm trying to understand what actually this code is doing:
Code:
[... code here ...]
input rollingPeriodMinutes = 60;
def factor = (SecondsFromTime(Market_Open_Time) / (60 * rollingPeriodMinutes) / 100);
def rolloverTime = if factor == Round(factor) then 1 else 0;
rec H1 = compoundValue(1, if !rolloverTime then if high > H1[1] then high else H1[1] else high, high);
rec H = compoundValue(1, if rolloverTime then H1[1] else H[1], high);
[... code here ...]
Can any of you understand what actually at the end "H" is?
Please, any help is really appraciated
Thanks a lot,
Julian
Here is the complete code:
https://pastebin.com/a9svkFpv
Code:
input showOnlyToday = YES;
def day = GetDay();
def lastDay = GetLastDay();
def isToday = If(day == lastDay, 1, 0);
def shouldPlot = If(showOnlyToday and isToday, 1, If(!showOnlyToday, 1, 0));
input Market_Open_Time = 0730;
input Market_Close_Time = 1600;
input rollingPeriodMinutes = 60;
def factor = (SecondsFromTime(Market_Open_Time) / (60 * rollingPeriodMinutes) / 100);
def rolloverTime = if factor == Round(factor) then 1 else 0;
rec H1 = compoundValue(1, if !rolloverTime then if high > H1[1] then high else H1[1] else high, high);
rec H = compoundValue(1, if rolloverTime then H1[1] else H[1], high);
rec L1 = compoundValue(1, if !rolloverTime then if low < L1[1] then low else L1[1] else low, low);
rec L = compoundValue(1, if rolloverTime then L1[1] else L[1], low);
rec C = compoundValue(1, if rolloverTime then close[1] else C[1], close);
rec O = compoundValue(1, if rolloverTime then open else O[1], open);
rec X_VAR = if C < O then (H + 2 * L + C) else if C > O then (2 * H + L + C) else (H + L + 2 * C);
rec PP_VAR;
rec R1_VAR;
rec R2_VAR;
rec R3_VAR;
rec R4_VAR;
rec S1_VAR;
rec S2_VAR;
rec S3_VAR;
rec S4_VAR;
PP_VAR = if shouldPlot then (H + L + C) / 3 else Double.NaN;
R1_VAR = if shouldPlot then PP_VAR + (H - L) / 2 else Double.NaN;
R2_VAR = if shouldPlot then PP_VAR + (H - L) * 1.272 else Double.NaN;
R3_VAR = if shouldPlot then PP_VAR + (H - L) else Double.NaN;
R4_VAR = Double.NaN;
S1_VAR = if shouldPlot then PP_VAR - (H - L) / 2 else Double.NaN;
S2_VAR = if shouldPlot then PP_VAR - (H - L) * 1.272 else Double.NaN;
S3_VAR = if shouldPlot then PP_VAR - (H - L) else Double.NaN;
S4_VAR = Double.NaN;
plot PP = PP_VAR;
plot R1 = R1_VAR;
plot R2 = R2_VAR;
plot R3 = R3_VAR;
plot R4 = R4_VAR;
plot S1 = S1_VAR;
plot S2 = S2_VAR;
plot S3 = S3_VAR;
plot S4 = S4_VAR;
PP.SetDefaultColor(Color.WHITE);
R1.SetDefaultColor(Color.RED);
R2.SetDefaultColor(Color.RED);
R3.SetDefaultColor(Color.RED);
R4.SetDefaultColor(Color.RED);
S1.SetDefaultColor(Color.GREEN);
S2.SetDefaultColor(Color.GREEN);
S3.SetDefaultColor(Color.GREEN);
S4.SetDefaultColor(Color.GREEN);
PP.SetStyle(Curve.POINTS);
R1.SetStyle(Curve.POINTS);
R2.SetStyle(Curve.POINTS);
R3.SetStyle(Curve.POINTS);
R4.SetStyle(Curve.POINTS);
S1.SetStyle(Curve.POINTS);
S2.SetStyle(Curve.POINTS);
S3.SetStyle(Curve.POINTS);
S4.SetStyle(Curve.POINTS);
Last edited by a moderator: