Practice 01 RSI
Python strategy by 3028165668.
The original spec has no written description. Read the source below.
Source Python
def RSI():
ticker = exchange.GetTicker()
account = exchange.GetAccount()
r = exchange.GetRecords(PERIOD_H1 * 4)
rsi = TA.RSI(r, 14)
is_buy = False
is_sell = False
if rsi[-1] > 70 and account["Stocks"] > 0:
id = exchange.Sell(ticker["Buy"], account["Stocks"] * 0.01)
is_buy = True
elif rsi[-1] < 30 and account["Balance"] > 0:
id = exchange.Buy(ticker["Sell"], account["Balance"] / ticker["Sell"] * 0.01)
is_sell = True
if is_buy or is_sell:
Sleep(1000 * 60 * 4)
# if rsi[-1] < 40 and account["Balance"] > 0:
# id = exchange.Buy(ticker["Buy"], account["Balance"] / ticker["Sell"] * 0.0005)
# if rsi[-1] > 60 and account["Stocks"] > 0:
# id = exchange.Sell(ticker["Sell"], account["Stocks"] * 0.0005)
# if rsi[-1] < 40 and account["Balance"] > 0:
# id = exchange.Buy(ticker["Buy"], account["Balance"] / ticker["Sell"] * 0.05)
return
def main():
Log("Strategy Start !")
i = 0
while True: #Loop
RSI() #Execute main strategy function
i = i + 1
if i % 50 == 0:
account = exchange.GetAccount()
Log(account["Balance"], account["Stocks"])
'''
def main():
Log("Strategy Start !")
ticker = exchange.GetTicker()
account = exchange.GetAccount()
id = exchange.Buy(ticker["Buy"], 0.01)
Log(account["Balance"])
Log(id)
Sleep(60 * 1000)
'''
Published by 3028165668 on the FMZ strategy square · last modified 2021-06-09. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Practice-01-RSI.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.