OPEN-SOURCE SCRIPT
HalfTrend SNIPERMONKEY

The HalfTrend algorithm identifies trend direction by tracking swing highs and lows over a configurable amplitude period. It uses ATR-based channel bands to confirm trend transitions and generates buy/sell signals only when a genuine trend flip occurs — filtering out a large portion of noise compared to a standard moving average crossover.
Strategy Features
🕘 Session-Based Entry Window (9:20 AM – 3:20 PM IST)
Entries are restricted to market hours. No new positions are opened outside this window.
⏩ Pre-Session Signal Carry-Forward
If a HalfTrend signal fires before 9:20 AM (e.g., on pre-market or overnight bars), it is latched and executed automatically at the session open — so you never miss a signal that formed while the market was closed.
🔁 Automatic Position Flip
When the trend reverses mid-session, the strategy closes the existing position and enters in the opposite direction in a single step.
🔔 EOD Square-Off at 3:20 PM
All open positions are forcibly closed at 3:20 PM IST to avoid carrying trades into close — aligned with SEBI intraday margin norms.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。