NexusFi: Find Your Edge


Home Menu

 





DayOfWeek Otimization


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one gregid with 2 posts (3 thanks)
    2. looks_two ural01 with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 FastAsk17 with 1 posts (1 thanks)
    1. trending_up 1,928 views
    2. thumb_up 4 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
ural01's Avatar
 ural01 
Colorado Springs, CO
 
Experience: Master
Platform: NinjaTrader
Broker: GAIN CAPITAL
Trading: Currency Futures
Posts: 24 since Mar 2010
Thanks Given: 9
Thanks Received: 0

Hello Every One,
Wood some one please recommend how to optimize DayOfWeek
in integer format
me be something
if ((Time[0].DayOfWeek == DayOfWeek. day number ?)


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NYSE Owner ICE Invests in Crypto Exchange OKX at $25 Bil …
Cryptocurrency
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 649 since Aug 2009
Thanks Given: 320
Thanks Received: 623



ural01 View Post
Hello Every One,
Wood some one please recommend how to optimize DayOfWeek
in integer format
me be something
if ((Time[0].DayOfWeek == DayOfWeek. day number ?)

It is an enum so use it like this:
 
Code
if(Time[0].DayOfWeek == DayOfWeek.Friday)


Reply With Quote
Thanked by:
  #4 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 649 since Aug 2009
Thanks Given: 320
Thanks Received: 623

Alternatively you should be able to get an int value from the enum and test it like this:
 
Code
if((int)Time[0].DayOfWeek == 5)
This will test for Friday, the numbers start from Sunday == 0 to Saturday == 6.


Reply With Quote
Thanked by:
  #5 (permalink)
 FastAsk17 
 
Posts: 91 since Mar 2011

 
Code
if (Bars.GetTradingDayFromLocal(Time[0]).DayOfWeek == DayOfWeek.Monday)
And days based on exchange, not your system time.


Reply With Quote
  #6 (permalink)
 
ural01's Avatar
 ural01 
Colorado Springs, CO
 
Experience: Master
Platform: NinjaTrader
Broker: GAIN CAPITAL
Trading: Currency Futures
Posts: 24 since Mar 2010
Thanks Given: 9
Thanks Received: 0

Hello !!! thank you very match,
if((int)Time[0].DayOfWeek == 5)
works fine for me


Started this thread Reply With Quote




Last Updated on March 23, 2015


© 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