Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Assigning a variable

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

    Assigning a variable

    I am stuck on what looks to be a straight forward variable assignment. Here is the code:
    #region Variables
    private double wmR = -50.0; // WilliamsM
    private int WMRvar = 14; // WilliamsM var
    #endregion

    /// <summary>
    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    }

    /// <summary>
    protected override void OnBarUpdate()
    {
    PrintWithTimeStamp("wmR: " + wmR);

    The output window shows:
    4/9/2009 1:00:00 PM wmR: 1

    I have been recompiling and reloading Ninjascript in the chart to test.

    WTF

    #2
    Two thoughts.

    1. Is this an input? If so, are you using something like Math.Max(value,1) on the input assignment?
    2. Its good practice to do wmR.ToString() when printing a variable string.

    hope this helps.
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    Comment


      #3
      Thanks mrlogik,

      I tried wmR.ToString(), with no change. This is an input so I tried changing the max value to -100, and that worked.

      set { wmR = Math.Max(-100, value); }

      Thanks again.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X