OPEN-SOURCE SCRIPT
已更新

Double Top/Bottom Screener with ATR

37
otential Issues in the Latest Script
Based on the code and your previous feedback, here are possible mistakes:

Syntax or Compilation Error:

The script might have a typo or incomplete logic, especially with the new nearestDoubleLevel and distanceNormalizedATR additions.
Check: The table definition in the if barstate.islast block has 4 columns defined but tries to access a 5th with table.cell(infoTable, 0, 4, ...), which causes an "index out of bounds" error. This is a clear mistake.


Distance or Level Calculation:

If "Dist: NaN%" or "Level: NaN" appears, it might indicate that doubleTopLevel or doubleBottomLevel isn’t being set correctly, possibly due to the tolerance or array logic.
Check: The ATR-normalized distance (distanceNormalizedATR) might fail if atr is na due to insufficient bars.


Screener Column Issue:

The new columns ("Nearest Double Level Price" and "Normalized Distance (ATR)") might not display or sort correctly in the Pine Screener due to plotting or naming conflicts.

版本注释
Save and Apply:

Click "Save" in the Pine Editor (name it "Double Top/Bottom Screener" if prompted).
Click "Add to Chart" to apply it to your current chart.


Check the Chart:

Verify that lines and levels start from 04:00 AM ET today (e.g., no lines from yesterday, September 25, 2025).
Set maxPeaks to 3 in the indicator settings and check if "Pattern: 1" triggers with 3 identical peaks.
Ensure "ATR Dist" shows a value (e.g., 0.5) when a pattern is active.


Update and Run Pine Screener:

Go to Pine Screener (Products > Screeners > Pine).
Select your watchlist, set timeframe to 1min, choose the updated indicator.
Add filter: "Pattern Signal >= 1".
Click "Scan". Check if "Nearest Double Level Price" and "Normalized Distance (ATR)" columns are populated.

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。