news filter code question - NinjaTrader Programming | futures io social day trading
futures io futures trading


news filter code question
Updated: Views / Replies:694 / 6
Created: by ceramictilepro 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
 

news filter code question

  #1 (permalink)
Elite Member
Roseville CA
 
Futures Experience: Advanced
Platform: N7
Broker/Data: Amp Futures/CQG
Favorite Futures: ES
 
Posts: 124 since Jun 2009
Thanks: 32 given, 19 received

news filter code question

Hello,

I have an indicator not working correctly and am looking for help.

Looking to draw backcolor when the filter is in play.

example: news is at 1000, draw backcolor 950-1010

here is the code that starts drawing at 1000 (not 950) and stops at 1010

 
Code
if (ToTime(Time[0]) < (news +10) * 100 && ToTime(Time[0]) > (news -10) * 100)
any help would be appreciated.

thank you

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)
Market Wizard
virginia
 
Futures Experience: Intermediate
Platform: ninja
Favorite Futures: ES
 
cory's Avatar
 
Posts: 5,220 since Jun 2009
Thanks: 628 given, 6,318 received
Forum Reputation: Legendary



ceramictilepro View Post
Hello,

I have an indicator not working correctly and am looking for help.

Looking to draw backcolor when the filter is in play.

example: news is at 1000, draw backcolor 950-1010

here is the code that starts drawing at 1000 (not 950) and stops at 1010

 
Code
if (ToTime(Time[0]) < (news +10) * 100 && ToTime(Time[0]) > (news -10) * 100)
any help would be appreciated.

thank you

Variables
.....
private DateTime beforeNews;
private DateTime afterNews;

....
protected override void OnBarUpdate()
.....

beforeNews = ToTime(news);
beforeNews = beforeNews.AddMinutes(-10); // decrease by 10m
afterNews = ToTime(news);
afterNews = afterNews.AddMinutes(10); // increase by 10m

if (ToTime(Time[0]) < afterNews && ToTime(Time[0]) > beforeNews)

Reply With Quote
The following 2 users say Thank You to cory for this post:
 
  #4 (permalink)
Elite Member
Roseville CA
 
Futures Experience: Advanced
Platform: N7
Broker/Data: Amp Futures/CQG
Favorite Futures: ES
 
Posts: 124 since Jun 2009
Thanks: 32 given, 19 received

thanks cory,

i was trying to be able and use just one private and have the code bracket the time.




cory View Post
Variables
.....
private DateTime beforeNews;
private DateTime afterNews;

....
protected override void OnBarUpdate()
.....

beforeNews = ToTime(news);
beforeNews = beforeNews.AddMinutes(-10); // decrease by 10m
afterNews = ToTime(news);
afterNews = afterNews.AddMinutes(10); // increase by 10m

if (ToTime(Time[0]) < afterNews && ToTime(Time[0]) > beforeNews)


Reply With Quote
 
  #5 (permalink)
Elite Member
Roseville CA
 
Futures Experience: Advanced
Platform: N7
Broker/Data: Amp Futures/CQG
Favorite Futures: ES
 
Posts: 124 since Jun 2009
Thanks: 32 given, 19 received


ceramictilepro View Post
thanks cory,

i was trying to be able and use just one private and have the code bracket the time.

here is what i have and it is not working, any ideas?

thank you

 
Code
 #region Variables
            //private int news = 07,00,00; // Default setting for BeginTime
		    //private DateTime news = 07,00,00;
		    private news 07,00,00;
		    private DateTime beforeNews;
            private DateTime afterNews;


        #endregion
		DataSeries _timeToTrade;
        protected override void Initialize()
        {
			_timeToTrade = new DataSeries(this);
            Overlay				= true;
			CalculateOnBarClose = false;
        }
        protected override void OnBarUpdate()
        {
		    
           beforeNews = ToTime(news);
            beforeNews = beforeNews.AddMinutes(-10); // decrease by 10m
            afterNews = ToTime(news);
            afterNews = afterNews.AddMinutes(10); // increase by 10m
			
			if (ToTime(Time[0]) < afterNews && ToTime(Time[0]) > beforeNews) 


            {
				_timeToTrade.Set(1);
				BackColor = Color.IndianRed;
			}
			else
				_timeToTrade.Set(0);
        }
        #region Properties
        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries TimeToTrade
        {
            get { return _timeToTrade; }
        }
        [Description("Example 650 = 6:50 am  1 = No News")]
        [GridCategory("Don't Trade News 10 min Before or After")]
        public int News
        {
            get { return news; }
            set { news = Math.Max(1, value); }
        }

Reply With Quote
 
  #6 (permalink)
Market Wizard
virginia
 
Futures Experience: Intermediate
Platform: ninja
Favorite Futures: ES
 
cory's Avatar
 
Posts: 5,220 since Jun 2009
Thanks: 628 given, 6,318 received
Forum Reputation: Legendary

the devil is in the details;
 
Code
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    [Description("Enter the description of your new custom indicator here")]
    public class newscolor : Indicator
    {
        #region Variables
    //private int news = 07,00,00; // Default setting for BeginTime
		    //private DateTime news = 07,00,00;
		    // private news 07,00,00;
		    private DateTime news;
		    private DateTime beforeNews;
            private DateTime afterNews;
		    DataSeries _timeToTrade;
        #endregion
	//	DataSeries _timeToTrade;
        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            _timeToTrade = new DataSeries(this);
            Overlay				= true;
			CalculateOnBarClose = false;
			
			news = news.AddHours(7);  // initialize to 7AM
            beforeNews = news.AddMinutes(-10); // decrease by 10m;
            afterNews = news.AddMinutes(10); // increase by 10m
			
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        { 	
			if (ToTime(Time[0]) < ToTime(afterNews) && ToTime(Time[0]) > ToTime(beforeNews)) 
            {
				_timeToTrade.Set(1);
				BackColor = Color.IndianRed;
			}
			else
				_timeToTrade.Set(0);
		//	Print(CurrentBar+ " time to trade "+_timeToTrade[0]);	
        }

        #region Properties

        #endregion
    }
}

Reply With Quote
The following 3 users say Thank You to cory for this post:
 
  #7 (permalink)
Elite Member
Roseville CA
 
Futures Experience: Advanced
Platform: N7
Broker/Data: Amp Futures/CQG
Favorite Futures: ES
 
Posts: 124 since Jun 2009
Thanks: 32 given, 19 received

lol, thanks buddy


cory View Post
the devil is in the details;
 
Code
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    [Description("Enter the description of your new custom indicator here")]
    public class newscolor : Indicator
    {
        #region Variables
    //private int news = 07,00,00; // Default setting for BeginTime
		    //private DateTime news = 07,00,00;
		    // private news 07,00,00;
		    private DateTime news;
		    private DateTime beforeNews;
            private DateTime afterNews;
		    DataSeries _timeToTrade;
        #endregion
	//	DataSeries _timeToTrade;
        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            _timeToTrade = new DataSeries(this);
            Overlay				= true;
			CalculateOnBarClose = false;
			
			news = news.AddHours(7);  // initialize to 7AM
            beforeNews = news.AddMinutes(-10); // decrease by 10m;
            afterNews = news.AddMinutes(10); // increase by 10m
			
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        { 	
			if (ToTime(Time[0]) < ToTime(afterNews) && ToTime(Time[0]) > ToTime(beforeNews)) 
            {
				_timeToTrade.Set(1);
				BackColor = Color.IndianRed;
			}
			else
				_timeToTrade.Set(0);
		//	Print(CurrentBar+ " time to trade "+_timeToTrade[0]);	
        }

        #region Properties

        #endregion
    }
}


Reply With Quote

Reply



futures io > > > > > news filter code question

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Real-time market/economic news feeds question martifc Traders Hideout 5 May 28th, 2014 04:48 AM
Point Filter peonia trader NinjaTrader 1 July 17th, 2012 04:35 PM
Easy Language code question quantismo EasyLanguage Programming 3 April 3rd, 2012 09:36 PM
Three Way Filter with Boolean Setup zeller4 NinjaTrader Programming 3 July 19th, 2011 09:19 PM
Just a little code assist needed for entry filter Trader.Jon NinjaTrader Programming 2 October 27th, 2010 02:25 PM


All times are GMT -4. The time now is 11:39 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-17 in 0.11 seconds with 19 queries on phoenix via your IP 54.221.73.186