English
Back
Download
Log in to access Online Inquiry
Back to the Top
[Survey with Rewards] Share your Algo Trading experience and win up to $100 Cash Rewards
Views 63K Contents 489

RSI

Hi,
I just want to check my RSI has increased from the previous period. How do I do so?
Currently, the comparison is based on:-
- Golden Cross
- Death Cross
- Top Divergence
- Bottom Divergence.
Is there a function for it?
Thanks!
Disclaimer: Community is offered by Moomoo Technologies Inc. and is for educational purposes only. Read more
3
Translate
Report
4167 Views
Comment
Sign in to post a comment
  • 102627090 OP : // Function to calculate RSI (implementation depends on your platform) function calculateRSI(period, data):
    // RSI calculation logic here return rsi_value

    // Main logic
    period = 14
    upper_threshold = 70
    lower_threshold = 30

    // Get the closing prices for the last 16 candles (14 + 2 extra for comparison) close_prices = getLastNClosingPrices

    // Calculate RSI for the current candle and two candles ago

    current_rsi = calculateRSI(period, close_prices
    rsi_two_candles_ago = calculateRSI(period, close_prices

    // Check if RSI has increased
    rsi_increased = current_rsi > rsi_two_candles_ago

    if rsi_increased: print("RSI has increased from two candlesticks ago")

    else: print("RSI has not increased from two candlesticks ago")

  • ssssdddd : If you look in the Algo manual (the button to the right on top of the code editor) and click Signal -> Technical Analysis -> RSI then you can see how to use the provided one.

    It may also be easier for you to track the previous RSI state in a global variable (or maybe this is just my preference). Check the global variable against the current value and then reassign the variable so that next pass it will be the previous value.

  • 102503802 : May I ask everyone, my cancellation function is not executed in algo trading, how to solve this, and how to detect pending orders?

1
Follower
16
Following
3
Visitors
Follow
Discussing
Trump 2.0 Era: How will global markets evolve?
🎙️Discussion: 1. How will tariff policies affect the movement of key assets such as U.S. stocks, gold, and Bitcoin? 2. Given this context, Show More