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
    ChristianChristian
    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.

    For 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
    WingWing
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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.
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

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 robertogozzirobertogozzi
9 years, 1 month ago.

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