OPEN-SOURCE SCRIPT

DrNon Supertrend Strategy With Date Filter

How This Works
1. User Inputs for Date Range
• You specify a Start Date (Year, Month, Day) and an End Date (Year, Month, Day).
2. Create Timestamps
• startTime and endTime define the exact Unix timestamps for when you want the strategy to begin and stop taking trades.
3. Filtering Condition
• inDateRange is true only if the current bar’s time lies between startTime and endTime.
4. Conditional Trading
• The trading logic (entries) executes only if inDateRange is true.
5. Supertrend Logic
• Pine Script’s ta.supertrend() returns [value, direction].
• We monitor ta.change(direction) to detect switching signals for Long or Short.
Trend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer