Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error after compiling indicator tutorial.

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

    Error after compiling indicator tutorial.

    Hi,
    Thanks in advance as all help is much appreciated.

    I am not new to NT8, but have started on the long journey of trying to code my strategies, and started with the indicator tutorial from NT7.

    I am aware there may be compatability issues b/w NT7 and NT8.

    I have run into trouble with an error code, and don't know how to solve. it. Error CS0118.
    The error message is: 'NinjaTrader.Gui.Plot' is a 'type' but is used like a variable.

    This was the code section that I ran.


    protected override void OnBarUpdate()
    {
    //Set the Value (Add your custom indicator logic here).
    Plot0.Set(Open[0] == Close[0] ? 1 : 0);
    }

    Any suggestions on how I can resolve this would be much appreciated.

    My apologies if this question has been raised and answered before in the forums, I did search for it, but could not find an answer.

    Cheers

    Michael



    #2
    Hello Mike001!

    Thanks for your 1st post in the NinjaTrader forums!

    In NinjaTrader8, when you assign a value to a plot, you no longer need to use .Set() as was the case in NinjaTrader7.

    You would instead use the name of the plot and the barsago index, like this:

    Plot0[0] = (Open[0] == Close[0] ? 1 : 0);

    Comment


      #3
      Thank you Paul, but no luck yet!

      I made the changes, but it still doesn't work.


      I get the error message, 'the name 'Plot0' does not exist in the current context' CS0103


      This is the code I entered:

      protected override void OnBarUpdate()
      {
      //Set the Value (Add your custom indicator logic here).
      Plot0[0] = (Open[0] == Close[0] ? 1 : 0);
      }

      Your help is still appreciated.
      cheers
      Michael

      Comment


        #4
        Hello Mike001!,

        Thanks for your reply.

        Forum member memonolog (thank-you) has provided further information.

        In Post #4, that code would need to be placed outside of the OnBarUpdate() typically denoted as #region Properties.

        If these don't resolve your questions, please feel free to post further.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        580 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        335 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        102 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X