
Kitchen is a strategy that aims to trade in the direction of the trend by using supertrend and stochRsi data by calculating at different time values.
Click here to add indicator tradingview
First of all, let's understand the supertrend and stocrsi indicators.
How do you read and use Super Trend for trading ?
The price is often going upwards when it breaks the super trend line while keeping its position above the indication level.
When the market is in a bullish trend, the indicator becomes green. The indicator level will act as trendline support in such a scenario. The color of the indicator changes to red to indicate a negative trend once the price crosses the support line. The price uses the super trend level as a trendline resistance during a bearish move.
In our strategy, if our 1-hour and 4-hour supertrend lines show the up or down train in the same direction at the same time, we can assume that a train is forming here.
Why do I use the time of 1 hour and 4 hours ?
When I did a backtest from the past to the present, I discovered that the most accurate and consistent time zones are the 1 hour and 4 hour time zones.
· By the way we can change our short term timeframe(1H) and long term timeframe(4H) from settings panel
How do you read and use the Stoch-RSI Indicator?
This indicator analyzes price dynamics automatically to detect overbought and oversold locations.
The indicator includes:
-The primary line, which typically has values between 0 and 100;
-Two dynamic levels for overbought and oversold conditions.
IF our stoch-rsi indicator value has fallen below our lower boundary line, the oversold event has been observed in the price, if our stoch-rsi value breaks up our bottom line after becoming oversold, we think that the price will start the recovery phase.(The case is also true for the opposite.)
However, this does not always apply and we need additional approvals, Therefore, our 1H and 4H supertrrend indicator provides us with additional confirmation.
Buy Conditions:
Our 1H(short term) and 4H(long term) supertrrend indicator, has given the buy signal(green line and yellow line), and if our stochrsi indicator has broken our oversold line up on the past 15 bars, the buy signal is formed here.
Sell Conditions:
Our 1H(short term) and 4H(long term) supertrrend indicator, has given the sell signal(red line and orange line), and if our stochrsi indicator has broken our overbuy line down on the past 15 bars, the sell signal is formed here.
Stop Loss or Take Profit Conditions:
Exit Long Senerio:
All conditions are completed, the buy signal has arrived and we have entered a LONG trade, the 1-hour supertrend line follows the price rise(yellow line), if the price breaks below the 1-hour super trend line and a sell condition occurs for 1H timeframe for supertrend indcator, LONG trade will exit here.
Exit Short Senerio:
All conditions are completed, the Sell signal has arrived and we have entered a SHORT trade, the 1-hour supertrend line follows the price down(orange line), if the price breaks up the 1-hour super trend line and a buy condition occurs for 1H timeframe for supertrend indcator, SHORT trade will exit here.
What can you change in the settings panel?
1-We can set Start and End date for backtest and future alarms
2-We can set ATR length and Factor for supertrend indicator
3-We can set our short term and long term timeframe value
4-We can set StochRsi Up and Low limit to confirm buy and sell conditions
5-We can set stochrsi retroactive approval length
6-We can set stochrsi values or the length
7-We can set Dollar cost for per position
8- We can choose the direction of our positions, we can set only LONG, only SHORT or both directions.
9-IF you want to place automatic buy and sell orders with this strategy, you can paste your codes into the Long open-close or Short open-close message sections.
- If you want to place automatic buy and sell orders with this strategy, you can paste your codes into the Long, Short message sections.
You can paste your code here for algo trading, for example you created bot from 3commas site you got some code for open and close trades you just paste these codes here and set alarm but DONT FORGET !! write this code when you set alarm {{strategy.order.alert_message}}
>You can set alarm like that

I recommend using this bot in a 1 hour time frame.
The results of the strategy(BTCUSDT - 4H - Spot Market)

Pine script Codes:
(Dont forget copy //@version=5 code)
// 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=5
strategy('Kitchen [ilovealgotrading]', overlay=true, format=format.price, initial_capital = 1000)
// BACKTEST DATE
Start_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 RSI
low_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_Time
bgcolor(Time_interval ? color.rgb(255, 235, 59, 95) : na)
back_long = 0
back_short = 0
for 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 = false
sell_signal = false
if direction2 < 0 and direction1 < 0 and back_long > 0
buy_signal := true
buy_signal
if 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 Close
if 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)
If you have any problem send message from Telegram