RSI condition

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #34879 quote
    FredrikFredrik
    Participant
    New

    Hi guys,

    Trying to get my head round how to get a condition when RSI has been above 75 and is breaking below 70. I can create them independently but can’t see how I can get the RSI above 75 for last x candles…

    _rsi = RSI[21](close)
    c1 = (_rsi > 75)
    c2 = (_rsi CROSSES UNDER 70)

    Thanks!

    #34887 quote
    victormorkvictormork
    Participant
    Veteran

    Hi Fredrik! Maybe try with rsi open or high above 75 and then crossing under. The condition is only valid for the last candle.

    #34905 quote
    FredrikFredrik
    Participant
    New

    Hi, thanks, ok wanna guide me? šŸ™‚

    _rsi = RSI[21](close) // This is calculating the 21 last bars on the closing prise right?
    
    c1 = _rsi[3](high) // Something like this? rsi high value on the 3:rd candle back in time?
    #34910 quote
    victormorkvictormork
    Participant
    Veteran

    The number in your RSI[14] is referring to the amount of periods used to calculate the RSI value for the LATEST CLOSED candle. As far as I know you can’t useĀ the RSI value from three bars back on your latest bar. However, if you use a very short period to calculate RSI, lets say 2 periods, then you have a greater chance of having the same candle crossing through both the value 75 and 70 at the same time.

    I was thinking like this:

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM Preloadbars = 100
    //indicaator
    indicator1 = RSI[2](close)
    
    // Conditions to enter short positions
    c1 = (indicator1 CROSSES UNDER 70)
    c2 = (high > (indicator1 = 75))
    
    IF c1 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit short positions
    c2 = (indicator1 CROSSES UNDER 30)
    
    IF c2 THEN
    EXITSHORT AT MARKET
    ENDIF

    Try this code on EURUSD 1 H and you will see. OBS there isĀ noĀ stop lossĀ in place!

    Lycka till!

    Fredrik and Nicolas thanked this post
    #34923 quote
    FredrikFredrik
    Participant
    New

    Ahh, thanks alot Victor!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTimeā„¢ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

RSI condition


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Fredrik @fredrik Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by FredrikFredrik
9 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/09/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...