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 PaulMohn, Today, 03:49 AM
        0 responses
        6 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        10 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        2 views
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Working...
        X