NexusFi: Find Your Edge


Home Menu

 





Counting Consecutive Bars


Discussion in NinjaTrader

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




 
Search this Thread

Counting Consecutive Bars

  #1 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

Hi, I would like to count the number of consecutive bars an oscillator spends in oversold before moving back to neutral. And if it has exceeded 8 bars in the oversold zone, to shade the remainder of the bars until it moves back to neutral.

could someone show me how to write the script for the above instructions?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
 
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?
22 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

what is your basis for overbought/oversold? - stochastic? or some other indicator?
and what settings?
kz

Reply With Quote
  #3 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7


Hi KZ, The basis of overbought/oversold is from an indicator known as TD Range Expansion Index, where overbought > +45 and oversold < -45. I've managed to get that bit done. What I'm trying to add to the indicator now is known as TD Price Oscillator Qualifier which assist to determine the strength of either the oversold or overbought readings.

These indicators are part of tom demark's market timing indicators.

Reply With Quote
  #4 (permalink)
 
hondo69's Avatar
 hondo69 
Austin, TX
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Currencies
Posts: 162 since Jun 2009
Thanks Given: 57
Thanks Received: 248

I think the solution lies in the CountIF statement:

From Ninja help files

if (CountIf(delegate {return Close[0] > Open[0];}, 10) > 8)
EnterLong();

What this is saying is that if the close is greater than the open on more than 8 out of the last 10 bars, enter a long position.

The condition is in blue
if (CountIf(delegate {return Close[0] > Open[0];}, 10) > 8)
EnterLong();

Reply With Quote
Thanked by:
  #5 (permalink)
kaywai
singapore
 
Posts: 131 since Nov 2009
Thanks Given: 11
Thanks Received: 7

Hi Hondo69,

I'm just trying to create the indicator at this point in time. If you see the attached chart, what I want to do is 1) to shade the respective area if the oscillator remains consecutively in oversold/overbought for more than 8 bars.

As my programming skills are almost non-existant, I appreciate all the help that I can get.

Attached Thumbnails
Click image for larger version

Name:	SGXNK 03-10  1_15_2010 (60 Min).jpg
Views:	191
Size:	61.7 KB
ID:	6845  
Reply With Quote




Last Updated on January 17, 2010


© 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