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

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);

    Paul H.NinjaTrader Customer Service

    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.

        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmtjoancolmenero, 04-25-2024, 03:58 PM
        23 responses
        121 views
        0 likes
        Last Post cmtjoancolmenero  
        Started by Quanto, Today, 02:17 PM
        0 responses
        2 views
        0 likes
        Last Post Quanto
        by Quanto
         
        Started by Skifree, Today, 11:21 AM
        3 responses
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by manueldecastro, Today, 01:16 PM
        3 responses
        11 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by tradingnasdaqprueba, Today, 03:42 AM
        9 responses
        35 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X