NexusFi: Find Your Edge


Home Menu

 





Rolling counter for pattern


Discussion in EasyLanguage Programming

Updated
    1. trending_up 4,143 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 Masber2000 
Detroit, MI
 
Experience: Intermediate
Platform: MultiCharts, Matlab
Posts: 12 since Mar 2010
Thanks Given: 25
Thanks Received: 5

Hello-

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,

masber2000


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Renko can be the way.
Commodities
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
Building a free browser DOM/SMC simulator - need some ad …
Platforms and Indicators
Index roll effect in corn and wheat: gone, or moved into …
Commodities
Bitcoin’s 2022 low, 2025 high and 2026 low so far arou …
Cryptocurrency
 
  #2 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT Stellar & Tradestation
Broker: Primarily Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals, U308 and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,247 since Dec 2013
Thanks Given: 4,591
Thanks Received: 10,545

  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
  #3 (permalink)
 Masber2000 
Detroit, MI
 
Experience: Intermediate
Platform: MultiCharts, Matlab
Posts: 12 since Mar 2010
Thanks Given: 25
Thanks Received: 5


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


Started this thread Reply With Quote




Last Updated on March 27, 2021


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, 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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts