Rolling counter for pattern - futures io
futures io

Rolling counter for pattern

Discussion in EasyLanguage Programming

    1. trending_up 516 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

Rolling counter for pattern

(login for full post details)
  #1 (permalink)
Detroit, MI
Experience: Intermediate
Platform: MultiCharts, Matlab
Posts: 11 since Mar 2010
Thanks: 22 given, 5 received


I want to code a indicator that counts x number of occurrences of a given pattern. I don't want this to be based on num bars but by the last X number of patterns, with pattern #X rolling off upon the trigger of a new pattern.

For example:

I want to count the last 15 instances where (c crosses over Bollinger Band Upper (+1)OR c crosses under Bollinger Band Lower (-1)) and where number of bars back is not a criteria. My goal is to sum the instances.

How do I code this rolling counter?

Thank you,


Started this thread Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(172 thanks from 21 posts)
looks_twoSalao's Journalby Salao
(48 thanks from 11 posts)
looks_3Deetee’s DAX Trading Journal (time based)by Deetee
(35 thanks from 18 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(15 thanks from 13 posts)
looks_5Maybe a little bit different journalby Malykubo
(14 thanks from 14 posts)
Best Threads (Most Thanked)
in the last 7 days on futures io
Big Mike in Ecuador
76 thanks
The Crude Dude Oil Trading System
57 thanks
Would You Sell Your System?
57 thanks
Help improve the FIO community
27 thanks
The New Micro Contract - MICRO BITCOIN coming May 2021
25 thanks
(login for full post details)
  #2 (permalink)
Legendary Market Wizard
Houston, TX
Experience: Advanced
Platform: Trading Technologies
Broker: Primary Advantage Futures. Also ED&F and Tradestation
Trading: Primarily Energy but also a little GE, GC, SI & Bitcoin
Posts: 4,044 since Dec 2013
Thanks: 3,345 given, 7,987 received

  1. Create indicator that has your +1,0,-1 value. Create an array of length 15. Track which element of the array you need to update next. When indicator != 0 update array. Sum of the array is the answer you want.
  2. Create indicator that has your +1,0,-1 value. Write a loop that looks backwards until it finds 15 indicator values != 0. Keep a running total as this is the answer you want.

Reply With Quote
(login for full post details)
  #3 (permalink)
Detroit, MI
Experience: Intermediate
Platform: MultiCharts, Matlab
Posts: 11 since Mar 2010
Thanks: 22 given, 5 received

I'll try these suggestions. Thank you for your help SMCJB!

Started this thread Reply With Quote

futures io Trading Community Platforms and Indicators EasyLanguage Programming > Rolling counter for pattern

Last Updated on March 27, 2021

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Journal Challenge w/$1,800 in prizes!


Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts