Rolling counter for pattern - futures io
futures io

Rolling counter for pattern

Discussion in EasyLanguage Programming

    1. trending_up 3,215 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 150,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: 12 since Mar 2010
Thanks: 25 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

Can you help answer these questions
from other members on futures io?
Big Mo Indicator for NT8
Multi Time Frame High/Low/Median levels
How do I create Strategy with the Second Entry indicator
in depth understanding of last, bid, and ask volume in c …
Market on Close data within IB
Platforms and Indicators
(login for full post details)
  #2 (permalink)
Legendary Market Wizard
Normally Houston TX but currently travelling a lot
Experience: Advanced
Platform: TT and Stellar
Broker: Primary Advantage Futures. Also ED&F and Tradestation
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Posts: 4,747 since Dec 2013
Thanks: 4,063 given, 9,563 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: 12 since Mar 2010
Thanks: 25 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!


Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada),
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