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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        65 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        35 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        59 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        51 views
        0 likes
        Last Post CarlTrading  
        Working...
        X