How can I count the number of past signals

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #163969 quote
    rnesler
    Participant
    Average

    This may be a basic one but I could not find an answer in the forums etc:-). Any help appreciated!

    I have programmed plenty of signals for many indicators in the past two years, and show them in a separate window below the chart. So far so good, but this only shows me the signals graphically.

    What I am after for back-testing purposes/research etc, … I would like to get the exact numeric value /summation of signals during a specific time period.  To keep it simple, lets assume the signal is defined as the MA (8) crossing over the MA (34) on a 15 mins timeframe, and that happened 43 times in the past 3 years. I see of course the 43 signal bars…the issue though is that counting them manually is a rather tedious excercise…is there are way to get the count as a numeric value?

    Much obliged:-)!

    #163972 quote
    robertogozzi
    Moderator
    Master

    This one returns the number of occurrences since Jan.1st 2019 (not tested):

    Ma8      = average[8,0](close)
    Ma34     = average[34,0](close)
    CrossOver= Ma8 crosses over Ma34
    Once Tally= 0
    If Date >= 20190101 then
       If CrossOver then
          Tally = Tally + 1
       Endif
    Endif
    Return Tally as “Tally”
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

How can I count the number of past signals


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
rnesler @rnesler Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
4 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/12/2021
Status: Active
Attachments: No files
Logo Logo
Loading...