OPEN-SOURCE SCRIPT
LW Outside Day Strategy[SpeculationLab]

This strategy is based on the concept of the Outside Day Pattern described by Larry Williams in his book “Long-Term Secrets to Short-Term Trading”.
The Outside Day is a classic price action pattern often seen during market reversals or acceleration phases.
Strategy Logic
Outside Bar Detection
Current day’s high is higher than the previous high, and the low is lower than the previous low.
A body-size filter is applied: only bars with significantly larger bodies than the previous bar are considered valid.
Directional Confirmation
Close below the previous day’s low → Buy signal.
Close above the previous day’s high → Sell signal.
Stop Loss Options
Prev Low/High: Uses the previous swing low/high with buffer adjustment.
ATR: Stop loss based on volatility (ATR).
Fixed Pips: Uses a fixed pip distance defined by the user.
Take Profit Options
Prev High/Low (PHL): Targets the previous swing high/low.
Risk-Reward (RR): Targets based on user-defined risk-to-reward ratio.
Following Price Open (FPO): Exits at the next day’s open if price opens in profit.
Signal Markers
Buy/Sell signals are plotted on the chart (triangles).
Stop loss and target reference lines are drawn automatically.
Usage Notes
Timeframe: Best suited for Daily charts.
Markets: Works across stocks, forex, and crypto markets.
Disclaimer: This strategy is for educational and research purposes only. It does not guarantee profits and should not be considered financial advice. Please manage your own risk responsibly.
本策略基于美国著名交易大师 Larry Williams 在其著作《Long-Term Secrets to Short-Term Trading(短线交易的长线秘诀)》中提出的 Outside Day(外包线形态)。外包线是一种典型的价格行为形态,常出现在趋势反转或加速阶段。
策略逻辑
外包线识别
当日最高价高于前一日最高价,且当日最低价低于前一日最低价,即形成外包线。
同时过滤掉较小实体的 K 线,仅保留实体显著大于前一根的形态。
方向过滤
收盘价低于前一日最低价 → 视为买入信号。
收盘价高于前一日最高价 → 视为卖出信号。
止损设置(可选参数)
前低/高止损:以形态前低/前高为止损,带有缓冲倍数。
ATR 止损:根据平均波动率(ATR)动态调整。
固定点数止损:按照用户设定的点数作为止损范围。
止盈设置(可选参数)
前高/低止盈(PHL):以前高/前低为目标。
固定盈亏比(RR):根据用户设定的风险回报比自动计算。
隔夜开盘(FPO):若次日开盘价高于进场价(多单)或低于进场价(空单),则平仓。
信号标记
在图表中标注买入/卖出信号(三角形标记)。
绘制止损与目标位参考线。
使用说明
适用周期:建议用于 日线图(Daily)。
适用市场:股票、外汇、加密货币等各类市场均可。
提示:此策略为历史研究与学习用途,不构成投资建议。实际交易请结合自身风险管理。
The Outside Day is a classic price action pattern often seen during market reversals or acceleration phases.
Strategy Logic
Outside Bar Detection
Current day’s high is higher than the previous high, and the low is lower than the previous low.
A body-size filter is applied: only bars with significantly larger bodies than the previous bar are considered valid.
Directional Confirmation
Close below the previous day’s low → Buy signal.
Close above the previous day’s high → Sell signal.
Stop Loss Options
Prev Low/High: Uses the previous swing low/high with buffer adjustment.
ATR: Stop loss based on volatility (ATR).
Fixed Pips: Uses a fixed pip distance defined by the user.
Take Profit Options
Prev High/Low (PHL): Targets the previous swing high/low.
Risk-Reward (RR): Targets based on user-defined risk-to-reward ratio.
Following Price Open (FPO): Exits at the next day’s open if price opens in profit.
Signal Markers
Buy/Sell signals are plotted on the chart (triangles).
Stop loss and target reference lines are drawn automatically.
Usage Notes
Timeframe: Best suited for Daily charts.
Markets: Works across stocks, forex, and crypto markets.
Disclaimer: This strategy is for educational and research purposes only. It does not guarantee profits and should not be considered financial advice. Please manage your own risk responsibly.
本策略基于美国著名交易大师 Larry Williams 在其著作《Long-Term Secrets to Short-Term Trading(短线交易的长线秘诀)》中提出的 Outside Day(外包线形态)。外包线是一种典型的价格行为形态,常出现在趋势反转或加速阶段。
策略逻辑
外包线识别
当日最高价高于前一日最高价,且当日最低价低于前一日最低价,即形成外包线。
同时过滤掉较小实体的 K 线,仅保留实体显著大于前一根的形态。
方向过滤
收盘价低于前一日最低价 → 视为买入信号。
收盘价高于前一日最高价 → 视为卖出信号。
止损设置(可选参数)
前低/高止损:以形态前低/前高为止损,带有缓冲倍数。
ATR 止损:根据平均波动率(ATR)动态调整。
固定点数止损:按照用户设定的点数作为止损范围。
止盈设置(可选参数)
前高/低止盈(PHL):以前高/前低为目标。
固定盈亏比(RR):根据用户设定的风险回报比自动计算。
隔夜开盘(FPO):若次日开盘价高于进场价(多单)或低于进场价(空单),则平仓。
信号标记
在图表中标注买入/卖出信号(三角形标记)。
绘制止损与目标位参考线。
使用说明
适用周期:建议用于 日线图(Daily)。
适用市场:股票、外汇、加密货币等各类市场均可。
提示:此策略为历史研究与学习用途,不构成投资建议。实际交易请结合自身风险管理。
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน