NT: How I got market replay to work like live - NinjaTrader Programming | futures io social day trading
futures io futures trading


NT: How I got market replay to work like live
Updated: Views / Replies:1,980 / 1
Created: by kandlekid Attachments:0

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

Reply
 
Thread Tools Search this Thread
 

NT: How I got market replay to work like live

  #1 (permalink)
Trading for Fun
College Point, NY (Queens)
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: AMP/CQG
Favorite Futures: YM
 
Posts: 63 since Nov 2009
Thanks: 5 given, 20 received

NT: How I got market replay to work like live

How I got NinjaTrader Market Replay to work live it's live ...

The Problem ... Market replay sets the state of NT based on a number of historical bars it sees prior to the start of the replay (i.e. real time bar). It will run the Initialization method, etc at the first historical bar. So to make replay work like live, we've got to get NT to ignore all the bars prior to the first real time bar (just like a live connection).

Here's how I did it ... note: assume there are several boolean states as follows ...

iAmNoPosition, iAmLong, iAmShort.

To see the difference with how market replay normally runs, I added the following code to my strategy ...

private bool iAmLong = false;
private bool iAmShort = false;
private bool iAmNoPosition = true;

private int once = 1; // Note, not static !

private int tickCnt = 1;
private int prevBar;

...

private void ClearPositions()
{
iAmLong = false;
iAmShort = false;
iAmNoPosition = true;
}

...

protected override void Initialize()
{
...

prevBar = -1;

CalculateOnBarClose = false;
}


protected override void OnBarUpdate()
{
if ( prevBar != CurrentBar ) // Historical bars and 1st tick of a real time bar.
{
prevBar = CurrentBar;
tickCnt = 1;
}
else if ( prevBar == CurrentBar ) // Real time bars only.
{
tickCnt++;
}

// Testing only - because market replay sets state prior to the
// real time date, I want to ignore that setting.
//

if ( true == IsMarketReplay && once == 1 && tickCnt > 1 )
{
ClearPositions();

Print("\n\nCleared all.\n\n");

once = 0;
}


That's it !!!!!

To see the difference between how market replay normally runs and this work-around,
change this line ...

if ( true == IsMarketReplay && once == 1 && tickCnt > 1 )

to this ...

if ( true == IsMarketReplay && once == 1 )

Cheers


Last edited by Big Mike; December 9th, 2009 at 01:29 AM. Reason: moved to Programmers Paradise
Reply With Quote
The following user says Thank You to kandlekid for this post:
 
  #2 (permalink)
Elite Member
NYC, USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: NT
Favorite Futures: ES
 
Posts: 65 since Sep 2009
Thanks: 117 given, 76 received


kandlekid View Post
How I got NinjaTrader Market Replay to work live it's live ...


I would like to try to do this, but I don't know how to add this code where I'm supposed to... if it's not too difficult to do, would someone be able to help me set this up?

thanks!!

Reply With Quote

Reply



futures io > > > > > NT: How I got market replay to work like live

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
NT 7 Market Replay Help!!! tderrick NinjaTrader 4 December 29th, 2012 08:47 PM
Script to download nt replay data vegasfoster NinjaTrader Programming 5 October 2nd, 2012 01:24 AM
Possible to backtest long periods in NT with market replay? Twiddle Traders Hideout 4 September 13th, 2012 05:28 PM
Is anyone trading live with NT 7 yet? jzbqhr Traders Hideout 4 May 31st, 2010 10:40 PM
Ninja Live/Demo vs Replay differences kandlekid NinjaTrader 2 December 2nd, 2009 02:48 AM


All times are GMT -4. The time now is 01:58 PM.

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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-24 in 0.08 seconds with 19 queries on phoenix via your IP 54.81.0.22