This Pine Script v6 indicator checks manually entered point prices. The defaults reproduce the example. It checks direction and the three fixed intervals, then displays the arithmetic. It does not scan swings, inspect anchor timestamps, confirm pivots, issue alerts or place orders. Confirm chronological anchors yourself before entering their prices.
Original educational arithmetic example. The result depends on entered prices, not the chart symbol or timeframe. Display rounding does not change the comparisons.pine
//@version=6
indicator("Manual OXABC ratio worksheet", overlay = true)
float o = input.float(100.0, "O price")
float x = input.float(150.0, "X price")
float a = input.float(130.0, "A price")
float b = input.float(160.0, "B price")
float c = input.float(100.0, "C price")
float xa = math.abs(x - a)
float ab = math.abs(b - a)
float ob = math.abs(b - o)
float bc = math.abs(c - b)
bool hasLengths = xa > 0 and ab > 0 and ob > 0
bool bullish = o < a and a < x and x < b and c < a
bool bearish = o > a and a > x and x > b and c > a
float bRatio = hasLengths ? ab / xa : na
float impulseRatio = hasLengths ? bc / ab : na
float completionRatio = hasLengths ? bc / ob : na
bool ratiosPass = hasLengths and bRatio >= 1.13 and bRatio <= 1.618 and impulseRatio >= 1.618 and impulseRatio <= 2.24 and completionRatio >= 0.886 and completionRatio <= 1.13
bool candidate = (bullish or bearish) and ratiosPass
var table sheet = table.new(position.top_right, 2, 5, bgcolor = color.white, border_width = 1)
if barstate.islast
table.cell(sheet, 0, 0, "Manual worksheet", text_color = color.black)
table.cell(sheet, 1, 0, "No trade signal", text_color = color.black)
table.cell(sheet, 0, 1, "AB / XA", text_color = color.black)
table.cell(sheet, 1, 1, str.tostring(bRatio, "#.######"), text_color = color.black)
table.cell(sheet, 0, 2, "BC / AB", text_color = color.black)
table.cell(sheet, 1, 2, str.tostring(impulseRatio, "#.######"), text_color = color.black)
table.cell(sheet, 0, 3, "BC / OB", text_color = color.black)
table.cell(sheet, 1, 3, str.tostring(completionRatio, "#.######"), text_color = color.black)
table.cell(sheet, 0, 4, "Fixed-rule result", text_color = color.black)
table.cell(sheet, 1, 4, candidate ? "Geometry passes" : "Geometry fails", text_color = color.black)