Average number of bars in swing while in up trends

Optuma Forums Optuma Scripting Average number of bars in swing while in up trends

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #70135
    David
    • Topics: 15
    • Replies: 24
    • Posts: 39

    Hi all,

    I’m trying to work out the average number of bars in up swings while the (Gann) trend is up.

    What I’ve got so far is

    That seems to give me the average number of bars in up swings, but ignores the direction of the trend.

    gives me a way to work out the direction of the trend, but I can’t work out how to use it to filter the results of SWINGSTAT() in the above script.

    Any thoughts?

    Thanks in advance

    • This topic was modified 3 weeks ago by David.
    #70211
    David
    • Topics: 15
    • Replies: 24
    • Posts: 39

    I managed to figure out a solution in Python. This code works on the last 100 days’ data, which is fine for my purposes:

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

Pin It on Pinterest