Buying and Selling When the 15-Minute RSI Exits a Defined Range
Execute buy and sell orders when the 15-minute RSI moves outside the specified range of values.
Buy Orders: Triggered when the RSI falls below 30, executed at the first ask price.
Sell Orders: Triggered when the RSI rises above 70, executed at the first bid price.
In this example, 15-minute candlestick data is used to calculate the average closing price
mean
([candle.
close
for candle in candles_m15])
and the RSI
rsi
(
candles
('m15', '
base
-
counter
'), period=14, column='
close
')[0]
Sell Orders:
If the RSI exceeds 70, a sell order is placed every 300 seconds (as specified by "
sleep_after_seconds
": "300"
) at the best bid price, provided it is not lower than the average closing price of the last 100 fifteen-minute candlesticks.
"
sell_orders_count
": "1 if rsi_m15 > 70 else 0"
Buy Orders:
If the RSI falls below 30, a buy order is placed every 300 seconds at the best ask price, provided it is not higher than the average closing price of the last 100 fifteen-minute candlesticks.
"
buy_orders_count
": "1 if rsi_m15 < 30 else 0"
Last updated