Time of day? - NinjaTrader | futures io social day trading
futures io futures trading


Time of day?
Updated: Views / Replies:4,328 / 20
Created: by patbateman Attachments:2

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
 2  
 
Thread Tools Search this Thread
 

Time of day?

  #1 (permalink)
Elite Member
NY, NY
 
Futures Experience: None
Platform: T4, NinjaTrader
Favorite Futures: All!
 
patbateman's Avatar
 
Posts: 235 since Mar 2012
Thanks: 113 given, 193 received

Time of day?

I noticed that when you apply a template (i.e. excluding certain times of days; CME US Index RTH, etc.) to a chart or strategy, the gap wrecks allot of indicators (example attached).

Is it possible to enter directly into a strategy's code what time of day it should execute, so the default 24/7 template may be used to avoid gaps indicators?

"A Jedi's strength flows from the force."
-Yoda
Attached Thumbnails
Time of day?-gaps.jpg  

Last edited by patbateman; April 19th, 2012 at 02:09 PM.
Reply With Quote
 
  #2 (permalink)
Elite Member
NY, NY
 
Futures Experience: None
Platform: T4, NinjaTrader
Favorite Futures: All!
 
patbateman's Avatar
 
Posts: 235 since Mar 2012
Thanks: 113 given, 193 received

Update... I added

&& ToTime(Time[0]) >= ToTime(8, 0, 0)
&& ToTime(Time[0]) <= ToTime(12, 0, 0)

But it doesn't work...

"A Jedi's strength flows from the force."
-Yoda
Reply With Quote
 
  #3 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received



patbateman View Post
Update... I added

&& ToTime(Time[0]) >= ToTime(8, 0, 0)
&& ToTime(Time[0]) <= ToTime(12, 0, 0)

But it doesn't work...

I think Time[0] yield something like a string. I think 8AM is 80000, so something like this may work (or get you close):

&& Time[0] >= 80000 && Time[0] <= 120000

I don't think they need to be strings but something along this line will work. I have it in a few indicators and will look when I get home if you still need it.

Try this if the above doesn't work:
&& Time[0] >= "080000" && Time[0] <= "120000"

Be sure to add the leading 0 on the single digit times.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization

Last edited by NJAMC; April 19th, 2012 at 06:02 PM. Reason: Added string version
Reply With Quote
The following user says Thank You to NJAMC for this post:
 
  #4 (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


patbateman View Post
I noticed that when you apply a template (i.e. excluding certain times of days; CME US Index RTH, etc.) to a chart or strategy, the gap wrecks allot of indicators (example attached).

Is it possible to enter directly into a strategy's code what time of day it should execute, so the default 24/7 template may be used to avoid gaps indicators?

Yes, it is possible. My strategies only trade during specific times of the day. For example, if you have a breakout strategy you may not want to trade the false breakouts in the early afternoon.

Best you define some TimeSpan variables for the start and end times during which you want to enter positions. Then serialize these variables to make them accessible. Code a flag to check whether your current bar is within one of those time intervals. If this is the case allow for order execution.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #5 (permalink)
Elite Member
NY, NY
 
Futures Experience: None
Platform: T4, NinjaTrader
Favorite Futures: All!
 
patbateman's Avatar
 
Posts: 235 since Mar 2012
Thanks: 113 given, 193 received


Fat Tails View Post
Yes, it is possible. My strategies only trade during specific times of the day. For example, if you have a breakout strategy you may not want to trade the false breakouts in the early afternoon.

Best you define some TimeSpan variables for the start and end times during which you want to enter positions. Then serialize these variables to make them accessible. Code a flag to check whether your current bar is within one of those time intervals. If this is the case allow for order execution.

I updated it to
 
Code
&& ToTime(Time[0]) > 02000
				&& ToTime(Time[0]) < 08000
yet still does not work... the session template works, but not the time code. Session template doesn't work for me because of price gaps leading indicators to give bad readings.

I made a thread on the NT board, and only had snide responses from the rep (Ryan). I wrote an example program that was an EMA/SMA cross, and he told me to go back and make it simpler. Obviously not even looking at what I wrote for him. Crap bugs in software are fine if you can work around them and make it better for everyone, but not idiot programmers who are as efficient as a steam engine with holes telling me yet again to look at myself so their managers won't bring the hammer down on them.

Oh well... thanks for the response ft and nj

"A Jedi's strength flows from the force."
-Yoda
Reply With Quote
 
  #6 (permalink)
Elite Member
NY, NY
 
Futures Experience: None
Platform: T4, NinjaTrader
Favorite Futures: All!
 
patbateman's Avatar
 
Posts: 235 since Mar 2012
Thanks: 113 given, 193 received

edit... regarding your suggestion, are you saying

if (ToTime xxxxxx )
{
if (strategy) { lxxx ong xxx }
}

"A Jedi's strength flows from the force."
-Yoda
Reply With Quote
 
  #7 (permalink)
Elite Member
NY, NY
 
Futures Experience: None
Platform: T4, NinjaTrader
Favorite Futures: All!
 
patbateman's Avatar
 
Posts: 235 since Mar 2012
Thanks: 113 given, 193 received

Also one quick update... to be clear, I'm trying to get the strategy to execute only during certain times of days. Maybe this function isn't what this is for...

"A Jedi's strength flows from the force."
-Yoda
Reply With Quote
 
  #8 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received


patbateman View Post
Also one quick update... to be clear, I'm trying to get the strategy to execute only during certain times of days. Maybe this function isn't what this is for...


I did implement it a little complex and not sure how this will work in the wizard, but you might be able to round off to the Hour or something to make it simpler
m_Time=Time[0].Hour.ToString("D2")+Time[0].Minute.ToString("D2")+Time[0].Second.ToString("D2");
m_InTimeWindow=Filter_TimeWindow(m_Time,m_TimeStart1,m_TimeEnd1);

Here is the function Filter_TimeWindow():

 
Code
#region Filter_TimeWindow        
        // --------------------------------------------------
        //   Filter_TimeWindow(string m_Time,string m_StartWindow,string m_StopWindow)
        //    
        //        m_Time:         Time to test against window, 24H format HHMMSS
        //        m_StartWindow:     Start of window, 24H format HHMMSS
        //        m_StopWindow:     End of window, 24H format HHMMSS
        //
        //    NOTE: window assumed to be less than 24 hours, if Start>Stop spans over midnight
        //
        //   Returns true if m_Time is within window
        //   Returns false if m_Time is outside window
        // --------------------------------------------------
        
        private bool Filter_TimeWindow(string m_Time,string m_StartWindow,string m_StopWindow)
        {
            bool m_FilterReturn=false;

            if (Convert.ToInt64(m_StartWindow) < Convert.ToInt64(m_StopWindow)) 
            {        // Within the same day since Start<Stop
                if ((Convert.ToInt64(m_StartWindow)<=Convert.ToInt64(m_Time)) &&
                    (Convert.ToInt64(m_StopWindow)>=Convert.ToInt64(m_Time)))
                         m_FilterReturn=true;
            }
            else
            {        // Wraps over midnight, window start time to Midnight and then next morning to stop
                if ((Convert.ToInt64(m_StartWindow)<=Convert.ToInt64(m_Time)) ||
                    (Convert.ToInt64(m_StopWindow)>=Convert.ToInt64(m_Time)))
                         m_FilterReturn=true;
            }
            
            return m_FilterReturn;
        }
#endregion
You might be able to use the "Time[0].Hour" which returns an Int.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
The following 2 users say Thank You to NJAMC for this post:
 
  #9 (permalink)
Elite Member
Bala, PA, USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus, IB
Favorite Futures: SPY, Oil, Euro
 
monpere's Avatar
 
Posts: 1,858 since Jul 2010
Thanks: 300 given, 3,276 received


patbateman View Post
Also one quick update... to be clear, I'm trying to get the strategy to execute only during certain times of days. Maybe this function isn't what this is for...

From TN Help manual


// Only trade between 7:45 AM and 1:45 PM
if (ToTime(Time[0]) >= 74500 && ToTime(Time[0]) <= 134500)
{
// Strategy logic goes here
}

Reply With Quote
The following 2 users say Thank You to monpere for this post:
 
  #10 (permalink)
Elite Member
Denver, CO
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: NinjaTrader Brokerage
Favorite Futures: ES
 
NinjaTrader's Avatar
 
Posts: 1,260 since May 2010
Thanks: 153 given, 1,890 received



patbateman View Post

Crap bugs in software are fine if you can work around them and make it better for everyone, but not idiot programmers who are as efficient as a steam engine with holes telling me yet again to look at myself so their managers won't bring the hammer down on them.


As it currently stands, it seems that bug is not in NinjaTrader but in your code.

Your thread here - Time of day? - NinjaTrader Support Forum

Reply With Quote

Reply



futures io > > > > Time of day?

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
passing the time of day ? profitably euroventure Trading Journals 9 March 30th, 2012 11:52 PM
This Forum's Time of Day Cashish Tech Support 6 November 10th, 2011 12:39 AM
Time of day,and possible time frame sycronization phasganon The Elite Circle 1 September 24th, 2011 12:53 AM
time of day / trend timing TomBear The Elite Circle 1 May 14th, 2010 10:57 AM
Time of day trading TomBear The Elite Circle 5 September 8th, 2009 08:16 AM


All times are GMT -4. The time now is 05:57 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.14 seconds with 20 queries on phoenix via your IP 54.167.44.32