Pine Script v5 · Strategy
Faytterro Estimator Strategy
A Pine Script v5 strategy with no technical-analysis calculation. It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss. Each trade commits 100% of equity and pays no commission. 5 settings; defaults include source hlc3, faytterro estimator lenght 10 and minumum enrty-close gap (different direction) 650.
Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.
- Does Faytterro Estimator Strategy repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 17 of 17 trades.
- How did Faytterro Estimator Strategy do on BTCUSDT 1D with default settings?
- −15.80%
- From 26 Jan 2024 to 21 Oct 2026, over 52 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- What alerts does Faytterro Estimator Strategy have?
- 1
- alertcondition.
- Does Faytterro Estimator Strategy run in Pine Script v6?
- No
- The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 52 before, 0 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
- Does Faytterro Estimator Strategy use a stop loss?
- Yes
- strategy.exit sets a stop on line 38, 41.
BTCUSDT · 1D · default settings
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −15.80%
- −$157,983.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 52
- 21 won · 31 lost
- Profitable
- 40.4%
- of closed trades
- Profit factor
- 0.78
- gross profit ÷ gross loss
- Max drawdown
- 32.02%
- −$324,516.00
One run with the author's default settings, $1,000,000 starting capital, commission as the script sets it. A long position was still open at the last bar. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.
Review
What a careful reader of this script would point out, found by checking the source and the backtest.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Check
Every trade uses all the equity
default_qty_value is 100% of equity.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| source | hlc3 | source | cr |
| faytterro estimator lenght | 10 | int · max 500 | cr buy sell line 19 |
| minumum enrty-close gap (different direction) | 650 | float | buy sell sbuy ssell |
| minumum entry-entry gap (same direction) | 650 | float | buy sell sbuy ssell |
| trailing stop loss | 5 | float · step 0.1 | exit close long exit close short |
What it calculates
No technical-analysis calculation: the script works on prices and settings directly.
Signal flow
How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open long long | (buy) | On | 37 |
| Exit close long stop | (buy) | On | 38 |
| Open short short | (sell) | On | 40 |
| Exit close short stop | (sell) | On | 41 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Alerts
| Alert | Call | Message | Line |
|---|---|---|---|
| (no title) | alertcondition | no message | 29 |
Does it repaint?
No
No repainting patterns in the source, and the live replay matched history.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
- ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.
The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.
Other markets
The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | −15.8% | +102.5% | 52 | 40% | 0.78 | 32.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −7.7% | +5.5% | 25 | 44% | 0.79 | 19.9% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −7.4% | +9.8% | 6 | 17% | 0.00 | 7.4% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
The trades
By market direction
| At entry, last 90 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 11 | 55% | $18,122.60 |
| Sideways market | 26 | 31% | −$245,563.00 |
| Falling market | 15 | 47% | $69,458.00 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
38.8%
The 95th percentile of the worst drawdown when the same 52 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 20.9% to 38.8%; the tick is what actually happened, 30.3%. Order luck alone moves it this much.
All 52 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 5 Jun 2024 70,537.80 | 12 Jun 2024 69,577.90 | 7 | $13,608.90 |
| long | 5 Jul 2024 57,050.00 | 5 Jul 2024 54,693.50 | 0 | −$41,868.30 |
| short | 26 Jul 2024 65,799.90 | 27 Jul 2024 69,012.60 | 1 | −$47,445.20 |
| short | 28 Jul 2024 67,896.50 | 29 Jul 2024 69,822.80 | 1 | −$26,223.80 |
| long | 15 Aug 2024 58,683.40 | 15 Aug 2024 56,915.20 | 0 | −$27,059.70 |
| short | 28 Aug 2024 59,415.00 | 29 Aug 2024 60,830.80 | 1 | −$20,754.60 |
| long | 13 Sep 2024 58,132.30 | 16 Sep 2024 57,718.40 | 3 | −$6,054.24 |
| short | 1 Oct 2024 63,327.60 | 7 Oct 2024 62,994.50 | 6 | $4,440.60 |
| short | 26 Oct 2024 66,698.30 | 28 Oct 2024 69,841.00 | 2 | −$39,986.10 |
| short | 29 Oct 2024 69,962.20 | 29 Oct 2024 73,258.10 | 0 | −$38,095.60 |
| short | 30 Oct 2024 72,736.40 | 5 Nov 2024 70,471.80 | 6 | $23,990.80 |
| short | 24 Nov 2024 97,672.40 | 27 Nov 2024 95,674.70 | 3 | $16,250.90 |
| short | 28 Nov 2024 95,863.10 | 4 Dec 2024 98,437.40 | 6 | −$21,773.40 |
| short | 5 Dec 2024 98,587.30 | 5 Dec 2024 103,517.00 | 0 | −$39,451.50 |
| short | 19 Dec 2024 100,204.00 | 20 Dec 2024 97,242.70 | 1 | $22,151.90 |
| short | 28 Jan 2025 102,083.00 | 30 Jan 2025 105,459.00 | 2 | −$25,525.90 |
| short | 31 Jan 2025 104,723.00 | 3 Feb 2025 101,386.00 | 3 | $23,776.30 |
| long | 14 Feb 2025 96,608.10 | 18 Feb 2025 94,020.10 | 4 | −$20,627.10 |
| long | 8 Mar 2025 86,801.70 | 9 Mar 2025 82,557.20 | 1 | −$36,643.20 |
| long | 10 Mar 2025 80,734.50 | 10 Mar 2025 80,086.70 | 0 | −$5,718.15 |
| long | 11 Mar 2025 78,595.90 | 12 Mar 2025 80,610.10 | 1 | $18,118.30 |
| long | 21 Mar 2025 84,223.40 | 28 Mar 2025 84,554.30 | 7 | $2,848.67 |
| long | 16 Apr 2025 83,644.00 | 4 May 2025 95,856.40 | 18 | $106,286.00 |
| short | 4 May 2025 95,856.40 | 8 May 2025 98,218.70 | 4 | −$20,559.10 |
| short | 20 May 2025 105,574.00 | 21 May 2025 109,527.00 | 1 | −$30,470.60 |
| short | 25 May 2025 107,762.00 | 7 Jun 2025 105,760.00 | 13 | $14,547.20 |
| short | 22 Jul 2025 117,380.00 | 9 Aug 2025 117,918.00 | 18 | −$3,652.11 |
| long | 4 Sep 2025 111,706.00 | 22 Sep 2025 115,232.00 | 18 | $25,070.20 |
| short | 22 Sep 2025 115,232.00 | 29 Sep 2025 114,382.00 | 7 | $6,046.94 |
| short | 13 Oct 2025 114,959.00 | 19 Oct 2025 109,276.00 | 6 | $40,792.60 |
| long | 25 Oct 2025 111,005.00 | 29 Oct 2025 110,850.00 | 4 | −$1,210.35 |
| long | 31 Oct 2025 108,323.00 | 3 Nov 2025 105,834.00 | 3 | −$19,871.30 |
| long | 17 Nov 2025 94,261.40 | 17 Nov 2025 91,329.90 | 0 | −$26,277.50 |
| long | 29 Nov 2025 90,890.70 | 1 Dec 2025 87,455.50 | 2 | −$30,941.50 |
| long | 25 Dec 2025 87,669.40 | 8 Jan 2026 90,405.60 | 14 | $24,584.80 |
| short | 16 Jan 2026 95,604.80 | 28 Jan 2026 90,547.50 | 12 | $42,969.70 |
| long | 16 Feb 2026 68,832.60 | 17 Feb 2026 66,685.00 | 1 | −$26,684.20 |
| long | 18 Feb 2026 67,503.50 | 23 Feb 2026 65,375.70 | 5 | −$26,119.10 |
| long | 24 Feb 2026 64,656.00 | 26 Feb 2026 66,756.00 | 2 | $26,064.20 |
| long | 2 Mar 2026 65,776.50 | 3 Mar 2026 66,807.20 | 1 | $12,982.90 |
| short | 15 Mar 2026 71,211.90 | 16 Mar 2026 74,419.40 | 1 | −$37,903.00 |
| short | 26 Mar 2026 71,336.50 | 31 Mar 2026 68,566.80 | 5 | $31,201.00 |
| long | 6 Apr 2026 69,034.20 | 19 Apr 2026 74,881.30 | 13 | $70,707.90 |
| short | 25 Apr 2026 77,437.10 | 1 May 2026 78,809.40 | 6 | −$16,046.60 |
| short | 3 May 2026 78,686.80 | 6 May 2026 82,077.10 | 3 | −$38,323.90 |
| long | 14 Jun 2026 64,458.00 | 17 Jun 2026 64,069.30 | 3 | −$5,133.49 |
| long | 19 Jun 2026 62,958.00 | 23 Jun 2026 62,474.90 | 4 | −$6,491.55 |
| short | 17 Jul 2026 63,830.20 | 20 Jul 2026 65,729.10 | 3 | −$24,974.90 |
| short | 21 Jul 2026 65,255.50 | 19 Aug 2026 65,602.80 | 29 | −$4,335.18 |
| short | 1 Sep 2026 78,581.30 | 3 Sep 2026 80,193.10 | 2 | −$16,618.20 |
| short | 4 Sep 2026 81,270.40 | 18 Sep 2026 79,031.50 | 14 | $21,862.50 |
| short | 2 Oct 2026 84,880.10 | 19 Oct 2026 82,116.00 | 17 | $26,554.90 |
Similar scripts
Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Faytterro Estimator Strategy this page | — | v5 strategy | −15.8% | 52 | 32.0% |
| Alex Days HiLo Rajib by 14rajib | highest lowest | v4 strategy | No trades on this market | ||
| Donchian Strat EXMO by pskoroplas | highest lowest | v4 strategy | +12.1% | 22 | 68.0% |
| Average Highest High and Lowest Low Swinger Strategy by exlux99 | lowest highest | v4 strategy | +6.4% | 20 | 49.6% |
| Highest High and Lowest Low Channel Strategy by ceyhun | highest lowest | v5 strategy | −3.7% | 26 | 7.9% |
| Donchian Channels System [racer8] by racer8 | highest lowest | v4 strategy | −3.2% | 36 | 43.6% |
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- 1 setting uses the untyped input() (line 5). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Same 52 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 5: input() → input.source()
⋯strategy("Faytterro Estimator Strategy v2", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)-src=input(hlc3,title="source")+src=input.source(hlc3,title="source")len=input.int(10,title="faytterro estimator lenght", maxval=500)⋯Does it run in Pine Script v6?
No
The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 52 before, 0 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © faytterro-//@version=5+//@version=6strategy("Faytterro Estimator Strategy v2", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 22 ms | Yes 1,000 bars in 157 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.
Source
Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © faytterro//@version=5strategy("Faytterro Estimator Strategy v2", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)src=input(hlc3,title="source")len=input.int(10,title="faytterro estimator lenght", maxval=500)len2=100len3=input.float(650,title="minumum enrty-close gap (different direction)")len4=input.float(650,title="minumum entry-entry gap (same direction)")cr(x, y) => z = 0.0 weight = 0.0 for i = 0 to y-1 z:=z + x[i]*((y-1)/2+1-math.abs(i-(y-1)/2)) z/(((y+1)/2)*(y+1)/2)cr= cr(src,2*len-1) dizi = array.new_float(500)var line=array.new_line()for i=0 to len*2 array.set(dizi,i,(i*(i-1)*(cr-2*cr[1]+cr[2])/2+i*(cr[1]-cr[2])+cr[2]))buy = array.get(dizi,len+1+5)>array.get(dizi,len+1+4) and array.get(dizi,len+1+5)<cr[len] sell = array.get(dizi,len+1+5)<array.get(dizi,len+1+4) and array.get(dizi,len+1+5)>cr[len]bb=buy? hlc3 : nass=sell? hlc3 : na sbuy= buy and close<(close[ta.barssince(buy or sell)])[1]-len4 and close<ta.highest(fixnan(ss),len2)-len3*3ssell= sell and close>(close[ta.barssince(buy or sell)])[1]+len4 and close>ta.lowest(fixnan(bb),len2)+len3*3buy:= buy and close<(close[ta.barssince(buy or sell)])[1]-len4 and close<ta.highest(fixnan(ss),len2)-len3 //and close>ta.highest(fixnan(ss),len2)-len3*3sell:= sell and close>(close[ta.barssince(buy or sell)])[1]+len4 and close>ta.lowest(fixnan(bb),len2)+len3 //and close<ta.lowest(fixnan(bb),len2)+len3*3alertcondition(buy or sell)sl = input.float(5, title = "trailing stop loss", step = 0.1)//if (sbuy)// strategy.entry("strong long", strategy.long,width) // strategy.exit("close long","strong long", stop = close*(100-sb)/100 )//if (ssell)// strategy.entry("strong sell", strategy.short,width)if (buy) strategy.entry("long", strategy.long) strategy.exit("close long","long", trail_price = close, trail_offset = close*sl)if (sell) strategy.entry("short", strategy.short) strategy.exit("close short","short", trail_price = close, trail_offset = close*sl)