NexusFi: Find Your Edge


Home Menu

 





Rolling counter for pattern


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,867 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?
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
Fabrication or Framework? Irans Denied MOU Explains the …
Prediction Markets & Event Contracts
Beijing Summit Closes: Xi Pledges Hormuz Help -- $1.14B …
Prediction Markets & Event Contracts
CFTC Approves First US Bitcoin Perpetual Futures -- Kals …
Traders Hideout
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 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,241 since Dec 2013
Thanks Given: 4,585
Thanks Received: 10,531

  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