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 6,877 views
    2. thumb_up 5 thanks given
    3. group 5 followers
    1. forum 23 posts
    2. attach_file 1 attachments




 
Search this Thread

if TODAY (only)

  #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?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
What broker to use for trading palladium futures
Commodities
Quantum physics & Trading dynamics
The Elite Circle
Better Renko Gaps
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Funded Trader platforms
66 thanks
GFIs1 1 DAX trade per day journal
15 thanks
Trading with Intuition
15 thanks
Self sabotage reframed
15 thanks
Just another trading journal: PA, Wyckoff & Trends
13 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Legendary 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,103


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: 800

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

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

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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts