Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DayOfWeek.Monday gives Failure Code: CS0117 ?

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

    DayOfWeek.Monday gives Failure Code: CS0117 ?

    Hi
    I implmented this strategy before. It was working fine but it is giving me the following failure now(do not compile). That is very strange. Because DayOfWeek seems to exist in System names space. What is the reason?




    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Indicator;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Strategy;
    #endregion

    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    /// <summary>
    /// Weekend Effect:The weekend effect describes the tendency of stock prices to decrease on Mondays, meaning that closing prices on Monday are lower than closing prices on the previous Friday. For some unknown reason, returns on Mondays have been consistently lower than every other day of the week. In fact, Monday is the only weekday with a negative average rate of return. http://www.investopedia.com/articles...ent-market.asp
    /// </summary>
    [Description("Weekend Effect:The weekend effect describes the tendency of stock prices to decrease on Mondays, meaning that closing prices on Monday are lower than closing prices on the previous Friday. For some unknown reason, returns on Mondays have been consistently lower than every other day of the week. In fact, Monday is the only weekday with a negative average rate of return. http://www.investopedia.com/articles/stocks/08/market-anomaly-efficient-market.asp")]
    public class WeekendEffectStrategy : Strategy
    {
    #region Variables
    // Wizard generated variables
    private int myInput0 = 1; // Default setting for MyInput0
    // User defined variables (add any user defined variables below)
    #endregion

    /// <summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    /// </summary>
    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // If its Monday...do not trade
    if (Time[0].DayOfWeek == DayOfWeek.Monday && Close[0]<Close[1])
    {
    DrawDot("Stop" + CurrentBar, 0, High[0], Color.Red);
    Print("-");
    }
    if (Time[0].DayOfWeek == DayOfWeek.Monday && Close[0]>Close[1])
    {
    DrawDot("Stop" + CurrentBar, 0, Low[0], Color.Green);
    Print("+");
    }
    if (Time[0].DayOfWeek == DayOfWeek.Monday && Close[0]==Close[1])
    {
    DrawDot("Stop" + CurrentBar, 0, Low[0], Color.Black);
    Print("0");
    }
    }

    #region Properties
    [Description("")]
    [Category("Parameters")]
    public int MyInput0
    {
    get { return myInput0; }
    set { myInput0 = Math.Max(1, value); }
    }
    #endregion
    }
    }

    #2
    kguclu,

    Please provide the exact error message and line it was hit on. Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      thanks i just found the failure. I created another indicator which is called DayOfWeek That was my failure I renamed it to MondayFriday. It is ok now. thanks a lot

      Comment


        #4
        Glad you got it resolved.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        637 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        571 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X