Two Independent Crossovers / Timing Check - NinjaTrader Programming | futures io social day trading
futures io futures trading

Two Independent Crossovers / Timing Check
Updated: Views / Replies:957 / 3
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 100,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

Two Independent Crossovers / Timing Check

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

Two Independent Crossovers / Timing Check

I'm attempting to identify two independent crossover events and verify if they both occur within 5 bars of each other. I've started with the following:
in Variables:
private bool crossoverEventLongA = false;
private bool crossoverEventLongB = false;
private bool crossoverLongBoth = false;
private bool crossoverEventShortA = false;
private bool crossoverEventShortB = false;
private bool crossoverShortBoth = false;
private int countDown = 0; 
in OnBarUpdate():
if (CrossAbove(PositiveHolder,EMAPositiveHolder,1)) 
 crossoverEventLongA = true; 
if (CrossAbove(NegativeHolder,EMANegativeHolder,1)) {crossoverEventLongB = true; }
if (crossoverEventLongA && crossoverEventLongB) {crossoverLongBoth = true;}
else crossoverLongBoth = false; 
what I'm not sure how to do is use countdown to prove the the EventB occurred within 6 bars of EventA.
I'm thinking I can use a countdown function somewhere to give a true/false result if the two did occur within the specified time period
 for (countdown = 6; countdown>0; countdown--)
Please help with the missing code / syntax to help me get a qualified result with the timing parameter. I've attached a screenshot to show that these cross sometimes on the same bar and sometimes not.
Thanks in advance!
Kirk (zeller4)

Attached Thumbnails
Two Independent Crossovers / Timing Check-cl-09-09-8_13_2009-4-range-.jpg  
Reply With Quote
  #2 (permalink)
Site Administrator
Manta, Ecuador
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
Big Mike's Avatar
Posts: 46,427 since Jun 2009
Thanks: 29,510 given, 84,392 received

Perhaps when EventA occurs, record that bar number. When EventB occurs, record that bar number. Then do Math.Abs() and see if within 6 bars.

int eventa_bar 0;
int eventb_bar 0;

if (eventA)
eventa_bar CurrentBar;

if (
eventb_bar CurrentBar;

int barsapart Math.Abs(eventa_bar eventb_bar);

if (
barsapart 6)

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
  #3 (permalink)
Elite Member
Futures Experience: Beginner
Platform: Multicharts, R
Favorite Futures: EUR / USD
Posts: 185 since Feb 2010
Thanks: 106 given, 98 received

Hi Mike

Why is the "Maths.Abs" needed?


Reply With Quote
  #4 (permalink)
Administrator: Retired Backtester
Rennes France
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
sam028's Avatar
Posts: 3,424 since Jun 2009
Thanks: 3,617 given, 4,093 received

diverdan View Post
Hi Mike

Why is the "Maths.Abs" needed?


Because it's better/shorter/smarter than writing:

int barsapart;
if (
eventa_bar eventb_bar) >= 0
=eventa_bar eventb_bar;
barsapart=eventb_bar eventa_bar;

if (
barsapart 6)
Remember that we don't know if event A occurs before event B or not.

Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following user says Thank You to sam028 for this post:


futures io > > > > > Two Independent Crossovers / Timing Check

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

July Journal Challenge - $500 in Amazon Gift Cards!


AXESS Trader: Powerful Cloud Based Trading Platform w/GFF Brokers

Jul 17

TBA: FuturesTrader71 w/Morad Askar

Elite only

Similar Threads
Thread Thread Starter Forum Replies Last Post
FOMC Minutes – Fed Starts Talking Exit Strategy Process, But Not Yet Timing kbit News and Current Events 0 May 18th, 2011 05:18 PM
Timing DAX Futures roll-overs ? Bramhall17 Traders Hideout 6 March 14th, 2011 01:47 PM
SWISS TIMING WITH TRIGGER CHARTS jmuser The Elite Circle 16 February 6th, 2011 12:16 PM
Check out this equity curve! MXASJ NinjaTrader Programming 5 May 29th, 2010 01:09 PM
time of day / trend timing TomBear The Elite Circle 1 May 14th, 2010 09:57 AM

All times are GMT -4. The time now is 07:19 PM. (this page content is cached, log in for real-time version)

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-07-15 in 0.10 seconds with 15 queries on phoenix