Skip to main content

RSI & moving averages

This strategy aims to use technical analysis to identify entry and exit signals for a position trading strategy. It uses two popular indicators - moving averages and the Relative Strength Index (RSI) - to generate these signals.

Moving averages are commonly used to identify trends and support/resistance levels. The strategy likely involves calculating the moving average over a certain time period and using it as a guide for determining whether the trend is bullish or bearish.

The RSI is a momentum indicator that measures the strength of price movements. It typically ranges from 0 to 100 and is used to identify oversold and overbought conditions in the market. A value above 70 is considered overbought, while a value below 30 is considered oversold.


This example strategy is machine generated using Gunbot AI. Review its behavior carefully in a simulated bot instance before using parts of this code in production.

// initialize customStratStore within pairLedger object = || {};

// forced wait time reduces risk of double orders
function checkTime() {
return ! || typeof !== "number"
? ( =, false)
: ( - > 8000);
const enoughTimePassed = checkTime();

// set timestamp for checkTime in next round
const setTimestamp = () => =;

// calculate indicators
const ema1 =;
const ema2 =;
const rsi =;

console.log(`EMA1: ${ema1}, EMA2: ${ema2}, RSI: ${rsi}`);

if (enoughTimePassed) {
// calculate buy and sell conditions
const buyConditions = ema1 > ema2 && rsi < 30 && !;
const sellConditions = ema1 < ema2 && rsi > 70 &&;

console.log(`Buy conditions: ${buyConditions}, Sell conditions: ${sellConditions}`);

// fire orders when conditions are met
if (buyConditions) {
const buyAmount = parseFloat( /;
} else if (sellConditions) {

// Code is machine generated, review it and run in simulator mode first