• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DayofWeek example from NT Help does not compile

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    DayofWeek example from NT Help does not compile

    I put the following example found in nt help in my ninjascript onbarupdate() section

    // If it's Monday, do not trade.
    if (Time[0].DayOfWeek == DayOfWeek.Monday)
    return;


    and I get the following compilation error

    'int' does not contain a definition for 'Monday' and no extension method 'Monday' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?)


    basically I don't want to execute my system if it's monday.

    any suggestions?
    Last edited by Kel108; 05-20-2012, 01:43 PM.

    #2
    Kel108,

    Could you post more of your code? I suspect there is something wrong elsewhere.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Turns out I needed to include the (int) type conversion which support provided me in another forum post.

      This now works:

      if ((int)Time[0].DayOfWeek == dayOfWeek)return;


      I specify the dayOfWeek as a private integer variable
      Thanks so much!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by iq200, 11-09-2019, 08:26 AM
      5 responses
      56 views
      0 likes
      Last Post koganam
      by koganam
       
      Started by johng964, Today, 02:57 PM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_RyanS  
      Started by spamula, Today, 03:00 PM
      2 responses
      16 views
      0 likes
      Last Post spamula
      by spamula
       
      Started by MARTIN MARTIN, Today, 01:01 PM
      0 responses
      16 views
      0 likes
      Last Post MARTIN MARTIN  
      Started by bouncetherubble, Today, 10:21 AM
      2 responses
      21 views
      1 like
      Last Post bouncetherubble  
      Working...
      X