Nested Loop - NinjaTrader Programming | futures io social day trading
futures io futures trading

Nested Loop
Updated: Views / Replies:528 / 2
Created: by zeller4 Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Thread Tools Search this Thread

Nested Loop

  #1 (permalink)
Elite Member
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
Posts: 456 since Jun 2009
Thanks: 1,360 given, 383 received

Nested Loop

Hello All,

I'm trying to identify some line touches that don't always occur simultaneously.

The attached screenshot shows three touches on the Swing indicator.
I've attempted to use a nested for loop with BoolSeries but I'm not sure I'm doing the indexing correctly to identify which bar touched and then how to proceed to touch#2 and touch #3. Also, not sure if making them false within the loops is correct or only when the SwingDots shift.
Also, if there's some obvious ways to do the BackColorSeries[i] or [0] better , I'd appreciate your thoughts.

for (int i = 0; i <= 2; i++){
				double high = High[i];
				if(high == SwingHighPlot[i]){
					for (int j = 0; j <= 5; j++){
						if (BoolPush1Up[j+i+1]==false){
						if (BoolPush1Up[j+i+1]) BoolPush1Up.Set((j+i),true);
						if (BoolPush1Up[j+i+1]==true){// && BoolPush2Up[i+j+0] == false){
							if (BoolPush2Up[j+i+1] == false){
						if (BoolPush1Up[j+i+1]==true && BoolPush2Up[i+j+0] == true){
							if (BoolPush3Up[j+i+1]){
				//else BoolPush1Up.Set(i,false);
				if (BoolPush1Up[0]) BackColorSeries[0]=Color.Yellow;
				if (BoolPush2Up[0]) BackColorSeries[0]=Color.Green;
				if (BoolPush3Up[0]) BackColorSeries[0]=Color.Red;
Hope this makes sense. Thanks in advance for any help you can offer.

Attached Thumbnails
Nested Loop-nested_loop_for_identifying_swing_touches.png  

Last edited by zeller4; May 28th, 2014 at 04:11 PM.
Reply With Quote
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

  #3 (permalink)
OC, California, USA
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
shodson's Avatar
Posts: 1,868 since Jun 2009
Thanks: 484 given, 3,282 received

I'm not sure if what you're doing will work or not. I'd approach it more simply: just use a

int counter = 0;
and ever time a top is touched

until the swing high changes, then

counter = 0;
Otherwise, while the swing high has not changed, and

if (counter == 3)
then do whatever it is you plan to do on the 3rd touch.

Seems simpler, and will perform better too (no extra series collections to maintain and traverse on every bar).

Reply With Quote
The following 3 users say Thank You to shodson for this post:


futures io > > > > > Nested Loop

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

Wyckoff Hunting for Great Risk/Reward Ratio w/Gary Fullett

Elite only

Digging into the Details of iSystems w/Stage 5 & iSystems

Jun 5

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rationality And Trading Found In Nested Knot ratfink Psychology and Money Management 1 March 18th, 2014 03:43 AM
Conditional Nested Boolean Statements serac NinjaTrader Programming 4 November 27th, 2011 06:44 PM
OODA Loop and Trading...... tradersam Psychology and Money Management 1 May 18th, 2011 02:36 PM
foreach loop problem gomad NinjaTrader Programming 14 May 17th, 2011 07:40 PM
Complete noob programming MTF and nested indicator nirajkrishna Traders Hideout 2 March 26th, 2011 07:17 AM

All times are GMT -4. The time now is 07:22 AM.

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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.
no new posts
Page generated 2018-05-21 in 0.08 seconds with 20 queries on phoenix via your IP