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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        35 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        12 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        18 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        20 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X