NexusFi: Find Your Edge


Home Menu

 





if TODAY (only)


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one SARdynamite with 13 posts (0 thanks)
    2. looks_two cory with 4 posts (1 thanks)
    3. looks_3 MXASJ with 3 posts (0 thanks)
    4. looks_4 Fat Tails with 2 posts (0 thanks)
    1. trending_up 9,741 views
    2. thumb_up 5 thanks given
    3. group 5 followers
    1. forum 23 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
 SARdynamite 
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


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Probability Collapse: Bitcoin $150k Craters from 15% to …
Prediction Markets & Event Contracts
Third Circuit Backs Kalshi in Landmark Ruling -- Predict …
Prediction Markets & Event Contracts
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
Q1 2026 Shatters All Derivatives Volume Records -- CME H …
Traders Hideout
The Ceasefire Curve: 2pct Peace by Next Week, 60pct by S …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Algo automated / semi-automated trading anyone?
6 thanks
2026 Fire Horse
5 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


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 View Post
Hey,

Is there a simple way to write this ?

if (TODAY (and not the days before))

Cheers


Reply With Quote
  #4 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801

I've become a big fan of the MSDN site:

DateTime Structure (System)


Reply With Quote
  #5 (permalink)
 SARdynamite 
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.


Started this thread Reply With Quote
  #6 (permalink)
 SARdynamite 
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..... ?


Started this thread Reply With Quote
  #7 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801

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...


Reply With Quote
  #8 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 801

and of course:

if(historical) return;

is a popular choice and will work if you are using daily bars.


Reply With Quote
  #9 (permalink)
 SARdynamite 
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"


Started this thread Reply With Quote
  #10 (permalink)
 SARdynamite 
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


Started this thread Reply With Quote




Last Updated on July 15, 2010


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts