NexusFi: Find Your Edge


Home Menu

 





Rolling counter for pattern


Discussion in EasyLanguage Programming

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




 
Search this Thread

Rolling counter for pattern

  #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?
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #2 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT and Stellar
Broker: Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,049 since Dec 2013
Thanks Given: 4,386
Thanks Received: 10,206

  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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts