TimeSinceSignal formulas

Optuma Forums Optuma Scripting TimeSinceSignal formulas

This topic contains 2 replies, has 1 voice, and was last updated by Darren Darren 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #48071
    Darren
    Darren
    • Topics: 34
    • Replies: 194
    • Posts: 228

    The TimeSinceSignal function is very useful to determine how long has elapsed since a technical event (see here and here for some examples).

    Here’s a variation which counts the number of trading days since two moving averages crossed, calculating a positive number when crossing above and a negative number when crossing below. The example is for the 20EMA crossing the 50SMA:

    The script can be added to a watchlist column and also a Show View to display the results (note the Show View properties have been set to a Dot plotstyle, with a positive/negative colour scheme):

    Capture

    So NKE crossed above 105 days ago, and CVX crossed below 51 days ago.

    Also note that you can count in calendar days or weeks by changing the Units property in the TimeSinceSignal function:

    Capture

    1 user thanked author for this post.
    #48087
    Darren
    Darren
    • Topics: 34
    • Replies: 194
    • Posts: 228

    Time Since the Signal Before Last

    To calculate the time since the signal before last use the following (note: this will return calendar days), in this case RSI crossing above 70:

    Capture2

    #51863
    Darren
    Darren
    • Topics: 34
    • Replies: 194
    • Posts: 228

    Highest/Lowest close since

    To calculate the time since the current closing price was that high (in trading days):

    To calculate the time since the current closing price was that low (in calendar days):

    To show the date use the following BARDATE() function, and set the watchlist Column Type to Date:

    Capture

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close