Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
if TODAY (only)
Updated July 15, 2010
Top Posters
looks_one
SARdynamite
with 13 posts (0 thanks)
looks_two
cory
with 4 posts (1 thanks)
looks_3
MXASJ
with 3 posts (0 thanks)
looks_4
Fat Tails
with 2 posts (0 thanks)
trending_up
6,698 views
thumb_up
5 thanks given
group
5 followers
forum
23 posts
attach_file
1 attachments
if TODAY (only)
July 13th, 2010, 07:08 PM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
Hey,
Is there a simple way to write this ?
if (TODAY (and not the days before))
Cheers
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
July 13th, 2010, 08:17 PM
Berlin, Europe
Market Wizard
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102
If you have defined a DateTime object myDateTime you can check whether its date falls on today via
Code
if ( myDateTime . Date == DateTime . Now . Date )
SARdynamite
Hey,
Is there a simple way to write this ?
if (TODAY (and not the days before))
Cheers
July 13th, 2010, 09:04 PM
Asia
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800
I've become a big fan of the MSDN site:
DateTime Structure (System)
July 13th, 2010, 10:06 PM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
Perfect guys. Thanks a bunch.
July 14th, 2010, 02:42 AM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
Hello,
I tried this
Variables
Code
private DateTime myDateTime;
OnBarUpdate
Code
if (myDateTime.Date==DateTime.Now.Date
and it does not seem to work..... ?
July 14th, 2010, 03:07 AM
Asia
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800
You need to assign a value to MyDateTime before you can compare it I believe.
In variables:
private DateTime myDateTime;
In Init or OnStartUp:
myDateTime = (something to make it today);
In OnBarUpdate:
if(myDateTime.Date == DateTime.Now.Date) DoSomething;
if(myDateTime.Date != DateTime.Now.Date) DoSomethingElse;
Just a guess and I haven't tried it but there you go...
July 14th, 2010, 03:10 AM
Asia
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800
and of course:
if(historical) return;
is a popular choice and will work if you are using daily bars.
July 14th, 2010, 04:45 AM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
"something to make it today" ? :-)
thank you... I'll try "historical"
July 14th, 2010, 04:07 PM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
sorry to bother you. those fields are new to me
I tried if(Historical) on daily charts and it would set my plot to N/A to the whole database, is that right ? what purpose ?
about the myDateTime, what to write in Initialize chapter ? I guess I did not understand the concept of Objects yet
thanks for your help
Last Updated on July 15, 2010