ThinkScript盘中ORB斐波那契指标分享

▲ 3💬 2
原帖正文
展开原帖

下面的脚本也给你们用!

这个脚本:

  • 将 ORB 高点/低点绘制为一个定义好的区间框
  • 根据 ORB 自动构建斐波那契回撤 + 延伸位
  • 根据开盘区间收盘的位置判断看涨/看跌偏向
  • 锁定当天最初的 ORB 偏向(不会重绘)
  • 显示左侧斐波那契百分比标签
  • 包含突破箭头 + 警报

还在测试中,但到目前为止,结构互动出奇地干净。我目前得到的最好建议是:如果某个时间框架看起来很乱、没有尊重这些水平位,那就试试另一个时间框架。

下面提供脚本,你可以复制/粘贴到 ThinkScript 里并自己运行。


ORB + Directional Fibonacci Levels

Native-style ORB box + left % labels + right price labels

input OR_Length = {default FiveMin, FifteenMin, ThirtyMin};

input showOnlyRTH = yes;

input showSignals = yes;

input showORBCloud = yes;

input showFibLevels = yes;

input showLeftPercentLabels = yes;

input showRightPriceLabels = yes;

input showExtensions = yes;

input show236 = yes;

input show382 = yes;

input show500 = yes;

input show618 = yes;

input show786 = yes;

def RTHopen = 0930;

def RTHclose = 1600;

def ORend =

if OR_Length == OR_Length.FiveMin then 0935

else if OR_Length == OR_Length.FifteenMin then 0945

else 1000;

def isRTH = SecondsFromTime(RTHopen) >= 0 and SecondsTillTime(RTHclose) > 0;

def inOR = SecondsFromTime(RTHopen) >= 0 and SecondsTillTime(ORend) > 0;

def afterOR = SecondsFromTime(ORend) >= 0 and SecondsTillTime(RTHclose) > 0;

def newDay = GetDay() <> GetDay()[1];

def ORHigh = CompoundValue(1,

if newDay then Double.NaN

else if inOR and IsNaN(ORHigh[1]) then high

else if inOR then Max(ORHigh[1], high)

else ORHigh[1],

Double.NaN);

def ORLow = CompoundValue(1,

if newDay then Double.NaN

else if inOR and IsNaN(ORLow[1]) then low

else if inOR then Min(ORLow[1], low)

else ORLow[1],

Double.NaN);

def ORClose = CompoundValue(1,

if newDay then Double.NaN

else if inOR then close

else ORClose[1],

Double.NaN);

def ORMid = (ORHigh + ORLow) / 2;

def ORRange = ORHigh - ORLow;

def bullishORB = ORClose >= ORMid;

def bearishORB = ORClose < ORMid;

def plotOk = if showOnlyRTH then isRTH else yes;

def orbOk = plotOk and afterOR and !IsNaN(ORHigh) and ORRange > 0;

def fibOk = orbOk and showFibLevels;

--- Directional fib logic ---

def F0 =

if bullishORB then ORLow else ORHigh;

def F236 =

if bullishORB then ORLow + ORRange 0.236

else ORHigh - ORRange 0.236;

def F382 =

if bullishORB then ORLow + ORRange 0.382

else ORHigh - ORRange 0.382;

def F500 =

if bullishORB then ORLow + ORRange 0.500

else ORHigh - ORRange 0.500;

def F618 =

if bullishORB then ORLow + ORRange 0.618

else ORHigh - ORRange 0.618;

def F786 =

if bullishORB then ORLow + ORRange 0.786

else ORHigh - ORRange 0.786;

def F100 =

if bullishORB then ORHigh else ORLow;

def F1618 =

if bullishORB then ORHigh + ORRange 0.618

else ORLow - ORRange 0.618;

def F2618 =

if bullishORB then ORHigh + ORRange 1.618

else ORLow - ORRange 1.618;

--- ORB range structure ---

plot pORHigh = if orbOk then ORHigh else Double.NaN;

plot pORLow = if orbOk then ORLow else Double.NaN;

pORHigh.SetDefaultColor(Color.CYAN);

pORLow.SetDefaultColor(Color.CYAN);

pORHigh.SetLineWeight(4);

pORLow.SetLineWeight(4);

pORHigh.HideBubble();

pORLow.HideBubble();

plot ORCloudHigh = if showORBCloud and orbOk then ORHigh else Double.NaN;

plot ORCloudLow = if showORBCloud and orbOk then ORLow else Double.NaN;

ORCloudHigh.Hide();

ORCloudLow.Hide();

AddCloud(ORCloudHigh, ORCloudLow, Color.DARK_GRAY, Color.DARK_GRAY);

--- Fib plots ---

plot p0 = if fibOk then F0 else Double.NaN;

plot p236 = if fibOk and show236 then F236 else Double.NaN;

plot p382 = if fibOk and show382 then F382 else Double.NaN;

plot p500 = if fibOk and show500 then F500 else Double.NaN;

plot p618 = if fibOk and show618 then F618 else Double.NaN;

plot p786 = if fibOk and show786 then F786 else Double.NaN;

plot p100 = if fibOk then F100 else Double.NaN;

plot p1618 = if fibOk and showExtensions then F1618 else Double.NaN;

plot p2618 = if fibOk and showExtensions then F2618 else Double.NaN;

p0.SetDefaultColor(Color.CYAN);

p236.SetDefaultColor(Color.CYAN);

p382.SetDefaultColor(Color.CYAN);

p500.SetDefaultColor(Color.CYAN);

p618.SetDefaultColor(Color.CYAN);

p786.SetDefaultColor(Color.CYAN);

p100.SetDefaultColor(Color.CYAN);

p1618.SetDefaultColor(Color.CYAN);

p2618.SetDefaultColor(Color.CYAN);

p0.SetLineWeight(2);

p100.SetLineWeight(2);

p236.SetStyle(Curve.SHORT_DASH);

p382.SetStyle(Curve.SHORT_DASH);

p500.SetStyle(Curve.SHORT_DASH);

p618.SetStyle(Curve.SHORT_DASH);

p786.SetStyle(Curve.SHORT_DASH);

p1618.SetStyle(Curve.LONG_DASH);

p2618.SetStyle(Curve.LONG_DASH);

p0.HideBubble();

p236.HideBubble();

p382.HideBubble();

p500.HideBubble();

p618.HideBubble();

p786.HideBubble();

p100.HideBubble();

p1618.HideBubble();

p2618.HideBubble();

--- Label positioning ---

def firstFibBar = afterOR and !afterOR[1];

def lastBar = BarNumber() == HighestAll(BarNumber());

Left-side percent labels

AddChartBubble(showLeftPercentLabels and fibOk and firstFibBar, F0, "0.0%", Color.CYAN, yes);

AddChartBubble(showLeftPercentLabels and fibOk and show236 and firstFibBar, F236, "23.6%", Color.CYAN, yes);

AddChartBubble(showLeftPercentLabels and fibOk and show382 and firstFibBar, F382, "38.2%", Color.CYAN, yes);

AddChartBubble(showLeftPercentLabels and fibOk and show500 and firstFibBar, F500, "50.0%", Color.CYAN, yes);

AddChartBubble(showLeftPercentLabels and fibOk and show618 and firstFibBar, F618, "61.8%", Color.CYAN, yes);

AddChartBubble(showLeftPercentLabels and fibOk and show786 and firstFibBar, F786, "78.6%", Color.CYAN, yes);

AddChartBubble(showLeftPercentLabels and fibOk and firstFibBar, F100, "100.0%", Color.CYAN, yes);

AddChartBubble(showLeftPercentLabels and fibOk and showExtensions and firstFibBar, F1618, "161.8%", Color.CYAN, yes);

AddChartBubble(showLeftPercentLabels and fibOk and showExtensions and firstFibBar, F2618, "261.8%", Color.CYAN, yes);

Right-side price labels

AddChartBubble(showRightPriceLabels and fibOk and lastBar, F0, "$" + AsText(Round(F0, 2)), Color.CYAN, no);

AddChartBubble(showRightPriceLabels and fibOk and show236 and lastBar, F236, "$" + AsText(Round(F236, 2)), Color.CYAN, no);

AddChartBubble(showRightPriceLabels and fibOk and show382 and lastBar, F382, "$" + AsText(Round(F382, 2)), Color.CYAN, no);

AddChartBubble(showRightPriceLabels and fibOk and show500 and lastBar, F500, "$" + AsText(Round(F500, 2)), Color.CYAN, no);

AddChartBubble(showRightPriceLabels and fibOk and show618 and lastBar, F618, "$" + AsText(Round(F618, 2)), Color.CYAN, no);

AddChartBubble(showRightPriceLabels and fibOk and show786 and lastBar, F786, "$" + AsText(Round(F786, 2)), Color.CYAN, no);

AddChartBubble(showRightPriceLabels and fibOk and lastBar, F100, "$" + AsText(Round(F100, 2)), Color.CYAN, no);

AddChartBubble(showRightPriceLabels and fibOk and showExtensions and lastBar, F1618, "$" + AsText(Round(F1618, 2)), Color.CYAN, no);

AddChartBubble(showRightPriceLabels and fibOk and showExtensions and lastBar, F2618, "$" + AsText(Round(F2618, 2)), Color.CYAN, no);

--- Bias / failure state ---

def bullishFailed = bullishORB and afterOR and close < ORLow;

def bearishFailed = bearishORB and afterOR and close > ORHigh;

AddLabel(afterOR,

if bullishFailed then "ORB FIB BIAS: BULLISH FAILED"

else if bearishFailed then "ORB FIB BIAS: BEARISH FAILED"

else if bullishORB then "ORB FIB BIAS: BULLISH"

else "ORB FIB BIAS: BEARISH",

if bullishFailed or bearishFailed then Color.YELLOW

else if bullishORB then Color.GREEN

else Color.RED

);

AddLabel(afterOR,

"ORB Range: $" + AsText(Round(ORLow, 2)) + " - $" + AsText(Round(ORHigh, 2)),

Color.CYAN

);

--- Breakout signals ---

def breakUp = showSignals and afterOR and close crosses above ORHigh;

def breakDn = showSignals and afterOR and close crosses below ORLow;

plot UpSignal = if breakUp then low else Double.NaN;

plot DnSignal = if breakDn then high else Double.NaN;

UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

DnSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

UpSignal.SetDefaultColor(Color.GREEN);

DnSignal.SetDefaultColor(Color.RED);

Alert(breakUp, "Opening Range Breakout UP", Alert.BAR, Sound.Ring);

Alert(breakDn, "Opening Range Breakout DOWN", Alert.BAR, Sound.Ring);

楼主分析总结

楼主分享的并不是针对某只股票的基本面或事件驱动交易观点,而是一段用于 Thinkorswim / ThinkScript 的盘中技术指标脚本,核心目标是把 Opening Range Breakout(ORB,开盘区间突破)与方向性 Fibonacci 回撤/延展位自动结合。脚本允许用户选择 5 分钟、15 分钟或 30 分钟开盘区间,默认只在美股常规交易时段 09:30 至 16:00 显示;在开盘区间结束后,系统会锁定当日 ORHigh、ORLow、ORClose,并据此绘制开盘区间上下沿、灰色区间云图、0%、23.6%、38.2%、50%、61.8%、78.6%、100%、161.8%、261.8% 等水平线。楼主称该指标会根据开盘区间收盘价相对区间中点的位置判断当日初始偏向:如果 ORClose 高于或等于 ORMid,则按 bullishORB 处理,Fibonacci 从 ORLow 向 ORHigh 及上方延展;若低于中点,则按 bearishORB 处理,Fibonacci 从 ORHigh 向 ORLow 及下方延展。脚本还设置了“bias locked for the day”的逻辑,即开盘区间形成后不随之后价格变化重新计算方向,并在价格上穿 ORHigh 或下穿 ORLow 时画箭头和触发提醒。图片附件为空,评论中 OP 只补充了一个外链示例图,但本次输入未直接附图,因此不能独立判断实际图表效果。该帖没有给出任何 ticker、仓位、目标价、胜率、回测结果或估值口径,本质上是交易工具分享而非证券推荐。所谓催化剂主要是日内价格突破开盘区间,适用对象隐含为流动性较好、盘中波动充足的标的;楼主也提醒如果某个时间框架“看起来很乱、不尊重水平位”,可以换 5/15/30 分钟中的其他区间。其隐含假设包括:开盘区间能有效概括当日早盘供需;收盘价在区间中点上方或下方足以定义方向偏向;ORB 边界与 Fibonacci 比例位会被交易者关注,从而具备支撑、阻力或目标位意义。最重要漏洞是,帖子没有提供统计验证、样本数量、不同标的和不同市场环境下的表现,也没有说明入场、止损、仓位管理、假突破过滤、滑点和手续费处理。代码层面看,ORB 高低点、方向性 Fib、突破箭头和失败状态的逻辑大体自洽,但这并不等同于策略有正期望;技术线“互动干净”更多是楼主主观观察,容易受到事后选择样本、视觉拟合和市场噪音影响。

评论区讨论

评论样本极少,只有一名用户询问如何用该指标交易 gap up。OP 回应称 gap up 更多是日线层面的交易情境,而该 ORB 指标主要用于盘中交易,因此不太适合直接用于日线 gap up,并给了一个盘中示例图链接。没有出现高赞反驳、实盘验证或风险讨论。

事实核查
supported
该帖提供的是 ThinkScript 代码,用于绘制 ORB 高低区间、Fibonacci 回撤/延展位、突破箭头和提醒。
主帖正文中代码确实包含 ORHigh/ORLow、AddCloud、多个 Fibonacci plot、crosses above/below 信号以及 Alert 语句;这是对帖子内部代码的直接核对。
supported
脚本支持 5 分钟、15 分钟和 30 分钟开盘区间。
代码中的 OR_Length 枚举为 FiveMin、FifteenMin、ThirtyMin,并分别把 ORend 设置为 09:35、09:45、10:00。
supported
脚本会根据开盘区间收盘价相对中点自动判断 bullish 或 bearish bias。
代码定义 ORMid=(ORHigh+ORLow)/2,bullishORB 为 ORClose >= ORMid,bearishORB 为 ORClose < ORMid,随后 Fibonacci 方向和标签都基于该判断。
unclear
该指标结构互动“surprisingly clean”,可用于改善日内交易判断。
这是楼主主观观察,帖子没有提供回测、样本、胜率、盈亏比或跨标的验证,无法判断其统计有效性。
supported
该 ORB 指标不太适合直接用于日线 gap up 交易,而更偏盘中使用。
这是 OP 在评论中的解释,且与脚本只使用 09:30-16:00 常规时段和开盘后 5/15/30 分钟区间的设计一致。

Loading Truth Social...

正在加载实时更新...

设置
外观
卡片风格
语言
Live 界面样式
新闻来源
AI 长文摘要
新闻过滤
重复新闻聚合
时效性
特朗普 Truth Social
关于我们
版本 2.6.1
数据来源 r/wallstreetbets
AI 引擎 ChatGPT/Gemini/Claude
MCP 服务 https://mcp.sellthenews.org/mcp
联系我们 [email protected]