Help with writing a backtest code with multiple RSI conditions

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #110678 quote
    assafnassafn
    Participant
    Average

    Hello everybody,

    Up until now I always used the “simplified creation”, but for this one I need your help with writing a more specific code:

    To enter a long position the conditions are –

    1. The values of RSI (21) minus RSI (7) should be less than 7

    2. RSI (21) is bigger than RSI (14)

    3. RSI (14) is bigger than RSI (7)

    Thank you

    Assaf

    #110686 quote
    NicolasNicolas
    Keymaster
    Legend

    Automated trading questions should be posted in the ProOrder forum section. Please try to write explicit title next time! Many thanks.

    The below code should be ok, I have not tested:

    rsi7=rsi[7]
    rsi21=rsi[21]
    rsi14=rsi[14]
    
    //The values of RSI (21) minus RSI (7) should be less than 7
    c1 = rsi21-rsi7<7
    //RSI (21) is bigger than RSI (14)
    c2 = rsi21>rsi14
    //RSI (14) is bigger than RSI (7)
    c3 = rsi14>rsi7
    
    if c1 and c2 and c3 and not longonmarket then 
     buy 10 contracts at market 
    endif
    #110691 quote
    assafnassafn
    Participant
    Average

    It works!

    Thank you so much!

Viewing 3 posts - 1 through 3 (of 3 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

Help with writing a backtest code with multiple RSI conditions


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
assafn @assafn Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by assafnassafn
6 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/21/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...