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

c# ERROR in cs1519 in ninjascript

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

    c# ERROR in cs1519 in ninjascript

    Hello,
    Please fba for the error
    Code:
    [CODE] public double Deviation { get; private set; }
            public double Hi /*{ get; private set; }*/ = double.MinValue;//in this case if i comment the get and set its working fine else shoing error please see on line 25,26 so on
            public double Lo { get; private set; } = double.MaxValue;
            public DateTime Begin { get; private set; } = DateTime.MaxValue;
            public DateTime End { get; private set; } = DateTime.MinValue;
            public int BeginBarIdx { get; private set; } = -1;
            public int EndBarIdx { get; private set; } = -1;
            protected Object lockObj = new object();
    [/CODE]
    Code:
    }
    
            public long GetPOCVolume() => ladder.Max(kv => kv.Value);
    
            public long GetPOCVolume(TradeSide side) => ladderBidAsk[(int)side].Max(kv => kv.Value);
    
            public long Volume() => ladder.Sum(kv => kv.Value);//here i have changed the operator also as your guide => insted >= then also class member declaratione expected and ;semicolon expected please see on line no 94-99 errors.
    
            public bool IsEmpty() => ladder.Count == 0;
    
            public void AddProfile(Profile p)
            {
                lock (lockObj)
    This is my Profile .cs file error code.
    Code:
     public ControlState ControlState /*{ get; private set; }*/ = ControlState.None;
    This line for the another file getting error =and; invalid token class struct and the interface

    Please find the attachments and revert back asap. Waitng for the reply
    Last edited by [email protected]; 05-07-2017, 06:44 AM.

    #2
    Hello [email protected],

    Thank you for your post.

    You cannot get and then "private set" and then set the value. Please use the following instead:
    Code:
    	public double Deviation;
            public double Hi = double.MinValue;
            public double Lo = double.MaxValue;
            public DateTime Begin = DateTime.MaxValue;
            public DateTime End DateTime.MinValue;
            public int BeginBarIdx = -1;
            public int EndBarIdx = -1;
            protected Object lockObj = new object();
    You are setting these as public and I assume based on the attempt at using get and set you wish to have these as user defined inputs. Please refer to the following link on how to create user defined inputs: http://ninjatrader.com/support/forum...73&postcount=2

    On the second set of code, are you trying to use Linq here? If so, I would recommend reviewing the MSDN documentation: https://msdn.microsoft.com/en-us/library/bb397933.aspx

    For the Profile/ControlState you need to look to the item I detailed on the variables in code set 1 above.

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by PaulMohn, Today, 12:36 PM
    2 responses
    16 views
    0 likes
    Last Post PaulMohn  
    Started by Conceptzx, 10-11-2022, 06:38 AM
    2 responses
    53 views
    0 likes
    Last Post PhillT
    by PhillT
     
    Started by Kaledus, Today, 01:29 PM
    0 responses
    3 views
    0 likes
    Last Post Kaledus
    by Kaledus
     
    Started by yertle, Yesterday, 08:38 AM
    8 responses
    37 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Started by rdtdale, Today, 01:02 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X