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 2,044 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?
Ceasefire Collapse: Iran Fires 24 Missiles, Israel Hits …
Traders Hideout
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
Six Days to Kickoff: World Cup Prediction Markets Hit $1 …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 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