comparing indicators from different periods

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #86852 quote
    simeong
    Participant
    Average

    Hi,

     

    I was looking through the forums and had a query in regard to comparing indicators in different time periods. Say  I wanted to compare an RSI from 6 candles ago to a current close[0]. How would I go about doing this for example could I do the following;

    rsi_level= rsi[14]
    
    if rsi_level[6]>rsi_level[0] then
    
    ///do somthing
    
    endif

     

    Also if certain conditions are met would it be possible to record a value inside pro real time.

     

    if rsi_level>70 and daytrend>3 and roc_level>3 then
    
    SELL SHORT 3 PER POINT AT MARKET
    
    //What would be the code to record stochastic
    
    sto=stochastic[0]
    
    endif
    
    

     

    Really appreciate the feedback and support provided

     

    Kind Regards,

    #86853 quote
    Vonasi
    Moderator
    Master

    The documentation found under help can be very useful when you don’t know the format for a bit of code:

    Stochastic

    Your RSI code looks fine but bear in mind that the current candle is 0 so six candles including the current candle is candle 5.

    simeong thanked this post
    #86858 quote
    simeong
    Participant
    Average

    Hi That’s great thanks for that in regard to the second question is it possible to record a variable ?

     

     

    record_rsi= 0
    my_rsi=rsi[14]
    
    if roc>14 then
    
      //record variable
       record_rsi=my_rsi[0]
    
    endif
    

    Really Appreciate  the input

    Kind Regards,

    #86860 quote
    Vonasi
    Moderator
    Master

    is it possible to record a variable ?

    Yes of course it is. Just save a value as any variable name just as you have done and that variable will keep that value until you give an instruction to change it.

    So for example you could even save the last five values:

    if ROC > 14 then
    rsivalue5 = rsivalue4
    rsivalue4 = rsivalue3
    rsivalue3 = rsivalue2
    rsivalue1 = rsi[14]
    endif
    simeong thanked this post
    #86862 quote
    robertogozzi
    Moderator
    Master

    Between lines 4 and 5 this one is missing:

    rsivalue2 = rsivalue1
    Vonasi and simeong thanked this post
    #86863 quote
    Vonasi
    Moderator
    Master

    Well spotted Roberto – that’s what happens if you try to cook dinner and reply on a forum at the same time!

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

comparing indicators from different periods


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
simeong @simeong Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by Vonasi
7 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/11/2018
Status: Active
Attachments: No files
Logo Logo
Loading...