Coding issue – indicator has been under a certain value a certain days in a row

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #44397 quote
    Christian
    Participant
    New

    Hello.

    I have problems to find and write the correct function in my new indicator. I want it to give me a signal when an indicator has been under a certain value a certain days in a row.

    F
    or example:
    When RSI[4] has been < 20 the last four days. Is this possible to do? I would be very glad if there is someone here that could help me.

    Thanks a lot!

    /Christian

    #44400 quote
    Wing
    Participant
    Veteran

    If you are using for example the daily timeframe:

    MyInd=rsi[4](close)
    
    if MyInd[0]<20 and MyInd[1]<20 and MyInd[2]<20 and MyInd[3]<20 then
    ....
    endif
    #44402 quote
    robertogozzi
    Moderator
    Master

    I suggest a different approach:

    MyInd=rsi[4](close)
     
    if summation[10](MyInd < 20) = 10 then
    ....
    endif

    In this case 10 periods are scanned and tested if they are consecutive (10 periods aginst constant 10).

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

Coding issue – indicator has been under a certain value a certain days in a row


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Christian @otzin Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/22/2017
Status: Active
Attachments: No files
Logo Logo
Loading...