CountMatch() vs BarsTrue()

Optuma Forums Optuma Scripting CountMatch() vs BarsTrue()

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #62375
    Andrew
    • Topics: 7
    • Replies: 5
    • Posts: 12

    ISSUE:

    Need to find proper function that will count the number of consecutive days that RSI(14) is above 50. Would like to back test using all Time Data

    Functions Tested:

    COUNTMATCH(RSI(14)>50,BARS=15)

    BARSTRUE(RSI(14)>50,BARS=15)

    RESULTS:

    Not getting expected outcome. Not sure if I’m barking up the wrong tree i.e. the wrong function (wouldn’t be the first time) or if one of these is the right function and my syntax is bad. Please advise.

    T.I.A.

    #62393
    Darren
    • Topics: 71
    • Replies: 880
    • Posts: 951

    Hi Andrew,

    For timecounts use the TIMESINCESIGNAL function (click here for examples). In your case you want to count how long it has been since your condition (RSI > 50) was false. Or – to frame it another way – how long has it been since RSI was below 50? This opposite condition is what you want to use:

    In this example of the Dow 30 stocks, $WBA has had an RSI above 50 the longest at 25 days, with $KO, $IBM, and $HON crossing yesterday. Obviously, those with 0 are currently below 50. Workbook attached (green areas show where RSI>50).

    Capture

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

Pin It on Pinterest