Time and ToTime in Ninja Trader - NinjaTrader Programming | futures io social day trading
futures io futures trading


Time and ToTime in Ninja Trader
Updated: Views / Replies:669 / 6
Created: by gfullmer Attachments:3

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
 

Time and ToTime in Ninja Trader

  #1 (permalink)
Elite Member
Phoenix, AZ
 
Futures Experience: Intermediate
Platform: Nijatrader
Broker/Data: Interactive Brokers
Favorite Futures: Stocks, Options
 
gfullmer's Avatar
 
Posts: 9 since Oct 2014
Thanks: 7 given, 1 received

Time and ToTime in Ninja Trader

I am trying to code a system that is called "Filling the Gap":

Buy a stock when it opens more than 2% lower than the prior day close.
Sell at yesterday's closing price or a the close if yesterday's closing price is never hit.

Only downside to coding this is I want to Sell on the same day it is Bought. I was thinking about doing this with 5 minute bars and closing it at 3:55pm, but then I have to have the time of the Close of yesterday. I am using ToTime and Time, but not sure how to do it.

I guess I could do it daily and then close on the next day's Open.

Thanks,
Glen

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)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


Something like this?

What filters would you use to avoid shorting runaway gaps as shown on the chart?


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
Phoenix, AZ
 
Futures Experience: Intermediate
Platform: Nijatrader
Broker/Data: Interactive Brokers
Favorite Futures: Stocks, Options
 
gfullmer's Avatar
 
Posts: 9 since Oct 2014
Thanks: 7 given, 1 received

I like it

Thanks Fat Tails. Yes, that is what I was looking for. Have you back tested it? How does it look? Did you use the TIME and ToTime functions to do that or some other function?

As far as a filter, one could look at the size of the gap, but not sure if that is correlated.

Some other filters when that day before was down for the stock, or using QQQ to see if it gaped down as well, or just buying and not shorting.

Any other ideas?

Thanks,
Glen

Reply With Quote
 
  #5 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


gfullmer View Post
Thanks Fat Tails. Yes, that is what I was looking for. Have you back tested it? How does it look? Did you use the TIME and ToTime functions to do that or some other function?

As far as a filter, one could look at the size of the gap, but not sure if that is correlated.

Some other filters when that day before was down for the stock, or using QQQ to see if it gaped down as well, or just buying and not shorting.

Any other ideas?

Thanks,
Glen


I do not use the ToTime function, but usually create a TimeSpan object which holds the value of the exit time. I then compare the hour and minute of the current time stamp with the TimeSpan object.

Reply With Quote
 
  #6 (permalink)
Elite Member
Phoenix, AZ
 
Futures Experience: Intermediate
Platform: Nijatrader
Broker/Data: Interactive Brokers
Favorite Futures: Stocks, Options
 
gfullmer's Avatar
 
Posts: 9 since Oct 2014
Thanks: 7 given, 1 received

OK


Fat Tails View Post
I do not use the ToTime function, but usually create a TimeSpan object which holds the value of the exit time. I then compare the hour and minute of the current time stamp with the TimeSpan object.

I had some issues with the ToTime and Time function so I found the Bars.GetDayBar(1) to get yesterday's close and also to close on today's close to be helpful for back testing. It probably wouldn't work for trading as it trades at close.

Also, I don't want to trade all day like your system does, but only daily and then only on the long side.

I have enclosed a simple example.

Thanks,
Glen

Attached Files
Register to download File Type: zip FillingTheGap.zip (1.2 KB, 8 views)
Reply With Quote
 
  #7 (permalink)
Elite Member
Phoenix, AZ
 
Futures Experience: Intermediate
Platform: Nijatrader
Broker/Data: Interactive Brokers
Favorite Futures: Stocks, Options
 
gfullmer's Avatar
 
Posts: 9 since Oct 2014
Thanks: 7 given, 1 received

Here is an updated version to the FillTheGap strategy.

Attached Files
Register to download File Type: zip FillingTheGap2.zip (3.6 KB, 25 views)
Reply With Quote

Reply



futures io > > > > > Time and ToTime in Ninja Trader

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
IB Workstation and Ninja Trader Time issue tshunhu IB Trader Workstation 6 February 21st, 2015 12:59 PM
First Time Ninja Trader Runner4 NinjaTrader 5 August 29th, 2011 05:46 PM
Bug in Ninja Trader time and sales? Bob324 NinjaTrader 5 July 8th, 2011 11:20 AM
Multi Time Frames - Ninja Trader jdumanic NinjaTrader 9 June 17th, 2011 11:02 AM
I think Ninja trader drops ticks real time gomi NinjaTrader Programming 2 November 23rd, 2010 11:50 PM


All times are GMT -4. The time now is 05:55 PM.

Copyright © 2017 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 2017-12-12 in 0.15 seconds with 20 queries on phoenix via your IP 54.167.44.32