Pine Script v5 · Strategy
I11L Long Put-Call Ratio Inversion
A Pine Script v5 strategy built on SMA ("USI:PCC","D",close, 20), Stdev (ratio_sma, 30) and Crossunder (ratio_sma, upperDeviation). It has 4 order rules, 1 entry among them, and trades long only with the default settings. Exits use a profit target and no stop loss. Each trade commits 10000 in cash and pays no commission. 5 settings; defaults include SL 0.01, CRV 3 and Lookback period in Days 30.
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 I11L Long Put-Call Ratio Inversion repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did I11L Long Put-Call Ratio Inversion do on BTCUSDT 1D with default settings?
- Not measured
- It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its entry conditions never all held on this data. It closed no trades on the other markets either. A backtest, not investment advice.
- Does I11L Long Put-Call Ratio Inversion run in Pine Script v6?
- Not tested
- Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download.
- Does I11L Long Put-Call Ratio Inversion use a stop loss?
- No
- Its exits set a profit target but no stop.
- Does I11L Long Put-Call Ratio Inversion run in Zeal Terminal?
- Yes
- It compiles in 18 ms and runs 1,000 bars in 34 ms, in the browser.
BTCUSDT · 1D · default settings
- SMA
- SMA
- Stdev
- Crossunder
- Crossover
- Winning trade
- Losing trade
- Equity
- Buy and hold
Needs USI:PCC D data, not available: not a Binance spot market Values that depend on it are empty on this chart.
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
One run with the author's default settings, $10,000 starting capital, commission as the script sets it. 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 stop loss
strategy.exit is used without a stop, loss or trailing stop.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
3 settings have no label
In the settings dialog SL (line 5), CRV (line 6), ratio_sma_lookback_len (line 9) show an empty name. The labels on this page come from the variable names.
-
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 |
|---|---|---|---|
| SL (no label in the script) | 0.01 | float · step 0.01 | TP isSL |
| CRV (no label in the script) | 3 | float | TP |
| Lookback period in Days | 30 | int · step 10 | median standartDeviation |
| Ratio sma lookback len (no label in the script) | 20 | int · step 10 | ratio_sma |
| Standard Deviation Multiple | 1.5 | float | upperDeviation lowerDeviation |
What it calculates
- SMArequest.security("USI:PCC","D",close), Ratio sma lookback len (20)
ratio_sma · line 11 - SMAratio_sma, Lookback period in Days (30)
median · line 12 - Stdevratio_sma, Lookback period in Days (30)
standartDeviation · line 13 - Crossunderratio_sma, upperDeviation
isBuy · line 16 - Crossoverratio_sma, lowerDeviation
isSell · line 19
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 | (isBuy) | On | 22 |
| Exit Close Short limit | (isCloseShort) | On | 24 |
| Exit SL limit | (isSL) | On | 26 |
| Exit TP limit | (isTP) | On | 28 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
No
No repainting patterns in the source.
- ClearHigher-timeframe data1 request.security call(s), none with lookahead on.
- 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
Not run on other markets: the script requests USI:PCC D, and that data is not available here (not a Binance spot market). Its results would rest on empty values.
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 |
|---|---|---|---|---|---|
| I11L Long Put-Call Ratio Inversion this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| Double Bollinger Binary Options by Trade_by_DB | sma stdev | v5 strategy | No trades on this market | ||
| Improved Bollinger Swing Strategy Stock Nasdaq by exlux99 | sma stdev | v4 strategy | −20.4% | 7 | 22.3% |
| P-Signal Strategy by Kharevsky | stdev sma | v4 strategy | −9.7% | 29 | 34.6% |
| P-Signal Strategy & Alert by Kharevsky | stdev sma | v4 strategy | −9.7% | 29 | 34.6% |
| Bollinger Stop Strategy by ROBO_Trading | sma stdev | v5 strategy | −32.0% | 41 | 61.5% |
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.
- No v6-only features. v6 is not needed to run this script.
Clean v5
VerifiedNothing to change.
Does it run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © I11L-//@version=5+//@version=6strategy("I11L Long Put/Call Ratio Inversion", overlay=false, pyramiding=1, default_qty_value=10000, initial_capital=10000, default_qty_type=strategy.cash)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 18 ms | With a workaround 1,000 bars in 34 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
“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/// © I11L//@version=5strategy("I11L Long Put/Call Ratio Inversion", overlay=false, pyramiding=1, default_qty_value=10000, initial_capital=10000, default_qty_type=strategy.cash)SL = input.float(0.01,step=0.01)CRV = input.float(3)TP = SL * CRVlen = input.int(30,"Lookback period in Days",step=10)ratio_sma_lookback_len = input.int(20,step=10)mult = input.float(1.5,"Standard Deviation Multiple")ratio_sma = ta.sma(request.security("USI:PCC","D",close),ratio_sma_lookback_len)median = ta.sma(ratio_sma,len)standartDeviation = ta.stdev(ratio_sma,len)upperDeviation = median + mult*standartDeviationlowerDeviation = median - mult*standartDeviationisBuy = ta.crossunder(ratio_sma, upperDeviation)// and close < buyZoneisCloseShort = (ratio_sma > median and strategy.position_size < 0)isSL = (strategy.position_avg_price * (1.0 - SL) > low and strategy.position_size > 0) or (strategy.position_avg_price * (1.0 + SL) < high and strategy.position_size < 0)isSell = ta.crossover(ratio_sma,lowerDeviation) isTP = strategy.position_avg_price * (1 + TP) < highif(isBuy) strategy.entry("Long", strategy.long)if(isCloseShort) strategy.exit("Close Short",limit=close)if(isSL) strategy.exit("SL",limit=close)if(isTP) strategy.exit("TP",limit=close) plot(ratio_sma,color=color.white)plot(median,color=color.gray)plot(upperDeviation,color=color.rgb(0,255,0,0))plot(lowerDeviation,color=color.rgb(255,0,0,0))bgcolor(isBuy?color.rgb(0,255,0,90):na)bgcolor(isSell?color.rgb(255,0,0,90):na)