Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 tkaboris, Today, 06:27 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_RyanS  
        Started by Option Whisperer, Yesterday, 07:58 PM
        5 responses
        22 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by BackToTheFutures, 08-17-2021, 03:15 PM
        9 responses
        733 views
        0 likes
        Last Post NinjaTrader_RyanS  
        Started by TheTradingMantis, 01-19-2023, 02:05 AM
        44 responses
        926 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by reynoldsn, Yesterday, 07:26 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X