Jump to content

We have moved to Discord. Please click here to join us in the Trading Terminal Discord server.



These forums are read-only.

Leaderboard


Popular Content

Showing content with the highest reputation on 07/04/2022 in Posts

  1. 1 point
    Hey - if anyone uses ToS, I adjusted to default to reflect Thor's calculations for R5, R6, S5, S6. The ToS default includes a different calculation for R5 and S5 and doesn't include R6 and S6 at all. Keep in mind, you'll still need to adjust the colors and save as default. The numbers seem accurate - please verify before using. Let me know if this helps. Here is the ThinkScript: ***** input aggregationPeriod = {default "DAY", "WEEK", "MONTH"}; input length = 25; Assert(length > 0, "'length' should be positive: " + length); def yyyymmdd = GetYYYYMMDD(); def month = GetYear() * 12 + GetMonth(); def day_number = DaysFromDate(First(yyyymmdd)) + GetDayOfWeek(First(yyyymmdd)); def period; switch (aggregationPeriod) { case DAY: period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1; case WEEK: period = Floor(day_number / 7); case MONTH: period = Floor(month - First(month)); } def count = CompoundValue(1, if period != period[1] then (count[1] + period - period[1]) % length else count[1], 0); def start = CompoundValue(1, count < count[1] + period - period[1], yes); def highValue = if start then Highest(high(period = aggregationPeriod), length)[1] else if highValue[1] != 0 then highValue[1] else Double.NaN; def lowValue = if start then Lowest(low(period = aggregationPeriod), length)[1] else if lowValue[1] != 0 then lowValue[1] else Double.NaN; def closeValue = if start then close(period = aggregationPeriod)[1] else closeValue[1]; def range = highValue - lowValue; #R6 added to default according to Thor's settings plot R6 = (highValue / lowValue) * closeValue; #R5 adjusted from ToS default according to Thor's settings plot R5 = closeValue + range * (1.1) / 2 + 1.168 * ((closeValue + range * (1.1) / 2) - (closeValue + range * (1.1) / 4)); plot R4 = closeValue + range * (1.1) / 2; plot R3 = closeValue + range * (1.1) / 4; plot R2 = closeValue + range * (1.1) / 6; plot R1 = closeValue + range * (1.1) / 12; plot S1 = closeValue - range * (1.1) / 12; plot S2 = closeValue - range * (1.1) / 6; plot S3 = closeValue - range * (1.1) / 4; plot S4 = closeValue - range * (1.1) / 2; #S5 Adjusted from ToS default According Thor's Settings plot S5 = closeValue - range * (1.1) / 2 - 1.168 * ((closeValue - range * (1.1) / 4) - (closeValue - range * (1.1) / 2)); #S6 Added According to Thor's Settings plot S6 = closeValue - ((highValue / lowValue) * closeValue - closeValue); R1.Hide(); S1.Hide(); R6.SetDefaultColor(GetColor(5)); R5.SetDefaultColor(GetColor(5)); R4.SetDefaultColor(GetColor(5)); R3.SetDefaultColor(GetColor(5)); R2.SetDefaultColor(GetColor(5)); R1.SetDefaultColor(GetColor(5)); S1.SetDefaultColor(GetColor(6)); S2.SetDefaultColor(GetColor(6)); S3.SetDefaultColor(GetColor(6)); S4.SetDefaultColor(GetColor(6)); S5.SetDefaultColor(GetColor(6)); S6.SetDefaultColor(GetColor(6)); def paintingStrategy = if aggregationPeriod == aggregationPeriod.DAY then PaintingStrategy.POINTS else if aggregationPeriod == aggregationPeriod.WEEK then PaintingStrategy.TRIANGLES else PaintingStrategy.SQUARES; R6.SetPaintingStrategy(paintingStrategy); R5.SetPaintingStrategy(paintingStrategy); R4.SetPaintingStrategy(paintingStrategy); R3.SetPaintingStrategy(paintingStrategy); R2.SetPaintingStrategy(paintingStrategy); R1.SetPaintingStrategy(paintingStrategy); S1.SetPaintingStrategy(paintingStrategy); S2.SetPaintingStrategy(paintingStrategy); S3.SetPaintingStrategy(paintingStrategy); S4.SetPaintingStrategy(paintingStrategy); S5.SetPaintingStrategy(paintingStrategy); S6.SetPaintingStrategy(paintingStrategy);
[[Template core/front/global/mobileNavigation is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.