NexusFi: Find Your Edge


Home Menu

 





Rolling counter for pattern


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,961 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?
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
Iran Deal "In Review" at 87% on Deadline Day - …
Prediction Markets & Event Contracts
Post-Summit Market Verdict: ES -1%, NQ -1.5%, 10-Year Yi …
Traders Hideout
Al Arabiya: US-Iran Draft Deal Within Hours Contains Hor …
Prediction Markets & Event Contracts
Warsh Opens Today, Hormuz June 19 -- WTI Below $80, Fran …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
10 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #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,242 since Dec 2013
Thanks Given: 4,586
Thanks Received: 10,533

  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