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 Stops5 with 1 posts (1 thanks)
    1. trending_up 1,431 views
    2. thumb_up 4 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

DayOfWeek Otimization

  #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?
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
 
  #3 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 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: 650 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)
 Stops5 
Tampere/Finland
 
Experience: Beginner
Platform: Sierra Chart
Broker: Edge Clear
Trading: Futures
Posts: 91 since Mar 2011
Thanks Given: 302
Thanks Received: 93

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

Reply With Quote
Thanked by:
  #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


© 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