Pine Script v5 · Strategy
Kitchen [ilovealgotrading]
A Pine Script v5 strategy built on Supertrend (3, 10), RSI (close, 14) and SMA or Stoch (3). 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 is one contract and pays no commission. 19 settings; defaults include ATR Length 10, Factor 3 and Short Time Period 07 1h.
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 Kitchen [ilovealgotrading] repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Kitchen [ilovealgotrading] 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 code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
- Does Kitchen [ilovealgotrading] 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 Kitchen [ilovealgotrading] use a stop loss?
- Yes
- strategy.exit sets a stop on line 114, 116.
- Does Kitchen [ilovealgotrading] run in Zeal Terminal?
- Yes
- It compiles in 32 ms and runs 1,000 bars in 121 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
Needs BINANCE:BTCUSDT 240 data, not available: a lower timeframe than the chart; the engine does not evaluate intrabar data Needs BINANCE:BTCUSDT 60 data, not available: a lower timeframe than the chart; the engine does not evaluate intrabar data 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, $1,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 commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
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 |
|---|---|---|---|
| BACKTEST DATE | |||
| Start_Time | timestamp('01 January 2017 13:30 +0000') | time | Time_interval |
| End_Time | timestamp('30 April 2024 19:30 +0000') | time | Time_interval |
| Supertrend | |||
| ATR Length | 10 | int | supertrend2 direction2 supertrend1 direction1 |
| Factor | 3 | int | supertrend2 direction2 supertrend1 direction1 |
| Short Time Periodthis timeframe is the value of our short-time supertrend indicator | 07 1h | string · options ['01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ] | supertrend1 direction1 |
| Long Time Periodthis timeframe is the value of our long-time supertrend indicator | 10 4h | string · options [ '01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ] | supertrend2 direction2 |
| Stoch RSI | |||
| Stoch Rsi Low Limitwhen Stock rsi value crossover Low Limit value we get Long | 15 | float · step 0.5 | line 87 |
| Stoch Rsi Up Limitwhen Stock rsi value crossunder Up Limit value we get Short | 85 | float · step 0.5 | line 90 |
| Stoch Rsi retroactive lengthHow many candles are left behind, even if there is a buy or sell signal, it will be valid now | 20 | int · min 1 | line 86 |
| Stochastic RSI K | 3 | int · min 1 | k |
| RSI Length | 14 | int · min 1 | rsi1 |
| Stochastic Length | 14 | int · min 1 | k |
| RSI Source | close | source | rsi1 |
| Strategy Settings | |||
| Dollar Cost Per Position | 1000 | float | entry Long_Open entry Short_Open |
| Trade_direction | BOTH | string · options ['LONG', 'SHORT', 'BOTH'] | entry Long_Open entry Short_Open line 108 line 110 |
| Long Open Messageif you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Open Message | Long Open | string | entry Long_Open |
| Short Open Messageif you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Open Message | Short Open | string | entry Short_Open |
| Long Close Messageif you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Close Message | Long Close | string | exit Long_Close |
| Short Close Messageif you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Close Message | Short Close | string | exit Short_Close |
What it calculates
- SupertrendFactor (3), ATR Length (10) · chosen by Long Time Period
supertrend2 · line 56 - SupertrendFactor (3), ATR Length (10) · chosen by Long Time Period
direction2 · line 56 - SupertrendFactor (3), ATR Length (10) · chosen by Short Time Period
supertrend1 · line 61 - SupertrendFactor (3), ATR Length (10) · chosen by Short Time Period
direction1 · line 61 - RSIRSI Source (close), RSI Length (14)
rsi1 · line 73 - SMA / Stochta.stoch(rsi1, rsi1, rsi1, lengthStoch), Stochastic RSI K (3)
k · line 74
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_Open long | strategy.opentrades == 0 and Time_interval and buy_signal and ( trade_direction == 'LONG' or trade_direction == 'BOTH') | On | 109 |
| Open Short_Open short | strategy.opentrades == 0 and Time_interval and sell_signal and ( trade_direction == 'SHORT' or trade_direction == 'BOTH') | On | 111 |
| Exit Long_Close stop | close < supertrend1 and strategy.position_size > 0 | On | 114 |
| Exit Short_Close stop | close > supertrend1 and strategy.position_size < 0 | On | 116 |
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 data4 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 BINANCE:BTCUSDT 240, BINANCE:BTCUSDT 60, and that data is not available here (a lower timeframe than the chart; the engine does not evaluate intrabar data; a lower timeframe than the chart; the engine does not evaluate intrabar data). 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 |
|---|---|---|---|---|---|
| Kitchen [ilovealgotrading] this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| CCI Level Zone by Naruephat | sma rsi stoch | v5 strategy | No trades on this market | ||
| AVWAP Strategy by asfbhero | rsi stoch sma | v5 strategy | does not run in Zeal Terminal | ||
| SRJ RSI Outperformer Strategy by Sapt_Jash | rsi sma | v5 strategy | +0.6% | 8 | 2.4% |
| RSI SMA Crossover Strategy by reees | rsi sma | v5 strategy | +39.8% | 42 | 30.8% |
| Short In Downtrend Below MA100 (Coinrule) by Coinrule | sma rsi | v4 strategy | −34.5% | 99 | 45.4% |
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.
- 7 settings use the untyped input() (line 9, 10, 72, 78, 79, 80, 81). 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.
Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 9: input() → input.int()
- Line 10: input() → input.int()
- Line 72: input() → input.source()
- Line 78: input() → input.string()
- Line 79: input() → input.string()
- Line 80: input() → input.string()
- Line 81: input() → input.string()
⋯// supertrend -atrPeriod = input(10, 'ATR Length', group = " ################# Supertrend ################ ")+atrPeriod = input.int(10, 'ATR Length', group = " ################# Supertrend ################ ")-factor = input(3, 'Factor', group = " ################# Supertrend ################ ")+factor = input.int(3, 'Factor', group = " ################# Supertrend ################ ")time1 = input.string(title='Short Time Period', defval='07 1h', options=['01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our short-time supertrend indicator")⋯lengthStoch = input.int(14, 'Stochastic Length', minval=1, group = " ################# Stoch RSI ################ ")-src_rsi = input(close, title='RSI Source', group = " ################# Stoch RSI ################ ")+src_rsi = input.source(close, title='RSI Source', group = " ################# Stoch RSI ################ ")rsi1 = request.security(syminfo.tickerid, '240', ta.rsi(src_rsi, lengthRSI))⋯trade_direction = input.string(title='Trade_direction', group = " ################# Strategy Settings ################ ", options=['LONG', 'SHORT', 'BOTH'], defval='BOTH')-Long_message_open = input('Long Open', title = "Long Open Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Open Message ")+Long_message_open = input.string('Long Open', title = "Long Open Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Open Message ")-Short_message_open = input('Short Open', title = "Short Open Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Open Message ")+Short_message_open = input.string('Short Open', title = "Short Open Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Open Message ")-Long_message_close = input('Long Close', title = "Long Close Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Close Message ")+Long_message_close = input.string('Long Close', title = "Long Close Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Close Message ")-Short_message_close = input('Short Close', title = "Short Close Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Close Message ")+Short_message_close = input.string('Short Close', title = "Short Close Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Close Message ")Time_interval = time > Start_Time and time < End_Time⋯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.
⋯// © Baby_whale_to_moon-//@version=5+//@version=6strategy('Kitchen [ilovealgotrading]', overlay=true, format=format.price, initial_capital = 1000)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 32 ms | With a workaround 1,000 bars in 121 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/// © Baby_whale_to_moon//@version=5strategy('Kitchen [ilovealgotrading]', overlay=true, format=format.price, initial_capital = 1000)// BACKTEST DATEStart_Time = input.time(defval=timestamp('01 January 2017 13:30 +0000'), title='Start_Time', group = " ################# BACKTEST DATE ################ " )End_Time = input.time(defval=timestamp('30 April 2024 19:30 +0000'), title='End_Time', group = " ################# BACKTEST DATE ################ " )// supertrend atrPeriod = input(10, 'ATR Length', group = " ################# Supertrend ################ ")factor = input(3, 'Factor', group = " ################# Supertrend ################ ")time1 = input.string(title='Short Time Period', defval='07 1h', options=['01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our short-time supertrend indicator")time2 = input.string(title='Long Time Period', defval='10 4h', options=[ '01 1m','02 3m','03 5m', '04 15m', '05 30m', '06 45m', '07 1h', '08 2h', '09 3h', '10 4h', '11 1D', '12 1W' ], group = " ################# Supertrend ################ ",tooltip = "this timeframe is the value of our long-time supertrend indicator")res(Resolution) => if Resolution == '00 Current' timeframe.period else if Resolution == '01 1m' '1' else if Resolution == '02 3m' '3' else if Resolution == '03 5m' '5' else if Resolution == '04 15m' '15' else if Resolution == '05 30m' '30' else if Resolution == '06 45m' '45' else if Resolution == '07 1h' '60' else if Resolution == '08 2h' '120' else if Resolution == '09 3h' '180' else if Resolution == '10 4h' '240' else if Resolution == '11 1D' '1D' else if Resolution == '12 1W' '1W' else if Resolution == '13 1M' '1M'// supertrend Long time period [supertrend2, direction2] = request.security(syminfo.tickerid, res(time2), ta.supertrend(factor, atrPeriod))bodyMiddle4 = plot((open + close) / 2, display=display.none)upTrend2 = plot(direction2 < 0 ? supertrend2 : na, 'Up Trend', color=color.new(color.green, 0), style=plot.style_linebr, linewidth=2)downTrend2 = plot(direction2 < 0 ? na : supertrend2, 'Down Trend', color=color.new(color.red, 0), style=plot.style_linebr, linewidth=2)// supertrend short time period [supertrend1, direction1] = request.security(syminfo.tickerid, res(time1), ta.supertrend(factor, atrPeriod))bodyMiddle = plot((open + close) / 2, display=display.none)upTrend = plot(direction1 < 0 ? supertrend1 : na, 'Up Trend', color=color.new(color.yellow, 0), style=plot.style_linebr)downTrend = plot(direction1 < 0 ? na : supertrend1, 'Down Trend', color=color.new(color.orange, 0), style=plot.style_linebr)// Stochastic RSIlow_limit_stoch_rsi = input.float(title = 'Stoch Rsi Low Limit', step=0.5, defval=15, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossover Low Limit value we get Long")up_limit_stoch_rsi = input.float(title = 'Stoch Rsi Up Limit', step=0.5, defval=85, group = " ################# Stoch RSI ################ ", tooltip = "when Stock rsi value crossunder Up Limit value we get Short")stocrsi_back_length = input.int(20, 'Stoch Rsi retroactive length', minval=1, group = " ################# Stoch RSI ################ ", tooltip = "How many candles are left behind, even if there is a buy or sell signal, it will be valid now")smoothK = input.int(3, 'Stochastic RSI K', minval=1, group = " ################# Stoch RSI ################ ")lengthRSI = input.int(14, 'RSI Length', minval=1, group = " ################# Stoch RSI ################ ")lengthStoch = input.int(14, 'Stochastic Length', minval=1, group = " ################# Stoch RSI ################ ")src_rsi = input(close, title='RSI Source', group = " ################# Stoch RSI ################ ")rsi1 = request.security(syminfo.tickerid, '240', ta.rsi(src_rsi, lengthRSI))k = request.security(syminfo.tickerid, '240', ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK))// Strategy settings dollar = input.float(title='Dollar Cost Per Position ', defval=1000, group = " ################# Strategy Settings ################ ")trade_direction = input.string(title='Trade_direction', group = " ################# Strategy Settings ################ ", options=['LONG', 'SHORT', 'BOTH'], defval='BOTH')Long_message_open = input('Long Open', title = "Long Open Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Open Message ")Short_message_open = input('Short Open', title = "Short Open Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Open Message ")Long_message_close = input('Long Close', title = "Long Close Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Long Close Message ")Short_message_close = input('Short Close', title = "Short Close Message", group = " ################# Strategy Settings ################ ", tooltip = "if you write your alert window this code {{strategy.order.alert_message}} .When trigger Long signal you will get dynamically what you pasted here for Short Close Message ")Time_interval = time > Start_Time and time < End_Timebgcolor(Time_interval ? color.rgb(255, 235, 59, 95) : na)back_long = 0back_short = 0for i = 1 to stocrsi_back_length by 1 if ta.crossover(k, low_limit_stoch_rsi)[i] == true back_long += i back_long if ta.crossunder(k, up_limit_stoch_rsi)[i] == true back_short += i back_short// bgcolor(back_long>0?color.rgb(153, 246, 164, 54):na)// bgcolor(back_short>0?color.rgb(246, 153, 153, 54):na)buy_signal = falsesell_signal = falseif direction2 < 0 and direction1 < 0 and back_long > 0 buy_signal := true buy_signalif direction2 > 0 and direction1 > 0 and back_short > 0 sell_signal := true sell_signal//bgcolor(buy_signal ? color.new(color.lime,90) : na ,title="BUY bgcolor")plotshape( buy_signal[1] == false and strategy.opentrades == 0 and Time_interval and buy_signal ? supertrend2 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white)//bgcolor(sell_signal ? color.new(color.red,90) : na ,title="SELL bgcolor")plotshape(sell_signal[1] == false and strategy.opentrades == 0 and Time_interval and sell_signal ? supertrend2 : na , title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white)// Strategy entries if strategy.opentrades == 0 and Time_interval and buy_signal and ( trade_direction == 'LONG' or trade_direction == 'BOTH') strategy.entry('Long_Open', strategy.long, qty=dollar / close, alert_message=Long_message_open)if strategy.opentrades == 0 and Time_interval and sell_signal and ( trade_direction == 'SHORT' or trade_direction == 'BOTH') strategy.entry('Short_Open', strategy.short, qty=dollar / close, alert_message=Short_message_open)// Strategy Closeif close < supertrend1 and strategy.position_size > 0 strategy.exit('Long_Close',from_entry = "Long_Open", stop=close, qty_percent=100, alert_message=Long_message_close)if close > supertrend1 and strategy.position_size < 0 strategy.exit('Short_Close',from_entry = "Short_Open", stop=close, qty_percent=100, alert_message=Short_message_close)