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?
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
April Jobs Beat Flips Fed Hike Odds Past 52% for First T …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 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