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

Confused

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

    Confused

    This plots

    Code:
    	if(Low[0] == Close[0] &&  High[1] == Close[1]) 
    				  Plot0.Set(0);
    but this doesn't

    Code:
    	if(High[0] <= High[1] && Low[0] >= Low[1])	//Inside Bar type
    			
    			   Plot0.Set(0);
    <== doesn't compile so I am stuck!!

    #2
    If things don't compile, please provide the error list.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      error

      invalid expression term '='

      I have tried making the condition a true/false and then only plotting when true but this compiles but no plots.

      Comment


        #4
        full code

        Code:
           protected override void Initialize()
          {
        Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Dot, "Plot0"));
        Add (new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Dot, "Plot1"));
        
        			
        		
                    CalculateOnBarClose	= true;
                    Overlay				= false;
                    PriceTypeSupported	= false;
                }
        
        
                protected override void OnBarUpdate()
                {
        			
        int insidebar = 0;
        			
        		
        
        if(High[0] <= High[1] && Low[0] >= Low[1])	//Inside Bar
        	{insidebar = 1;}
        			
        if (insidebar > 0)
        				
          {Plot0.Set(1);	}
        			
        	
        
                }
        
                #region Properties
                [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                public DataSeries Plot0
                {
                    get { return Values[0]; }
                }
                [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                public DataSeries Plot1
                {
                    get { return Values[1]; }
                }

        Comment


          #5
          Originally posted by Mindset View Post
          Code:
             protected override void Initialize()
            {
          Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Dot, "Plot0"));
          Add (new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Dot, "Plot1"));
           
           
           
                      CalculateOnBarClose    = true;
                      Overlay                = false;
                      PriceTypeSupported    = false;
                  }
           
           
                  protected override void OnBarUpdate()
                  {
           
          int insidebar = 0;
           
           
           
          if(High[0] <= High[1] && Low[0] >= Low[1])    //Inside Bar
              {insidebar = 1;}
           
          if (insidebar > 0)
           
            {Plot0.Set(1);    }
           
           
           
                  }
           
                  #region Properties
                  [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                  [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                  public DataSeries Plot0
                  {
                      get { return Values[0]; }
                  }
                  [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                  [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                  public DataSeries Plot1
                  {
                      get { return Values[1]; }
                  }

          Mindset,

          Don't feel bad. We all made this same mistake.

          I wish NT would automatically build this into every chart!!!!!

          Sigh !!!!!!

          Insert the following "if" statement where shown.

          ----------------------------------------------------------
          protected override void OnBarUpdate()

          {

          if
          ( CurrentBar < 2) return;

          -----------------------------------------------------------

          RJay
          RJay
          NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

          Comment


            #6
            Always check the LOG tab when things seem funny.
            mrlogik
            NinjaTrader Ecosystem Vendor - Purelogik Trading

            Comment


              #7
              can't believe that



              I spent an hour trying various things and that really is c# 101.
              thanks rt 6176

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by WHICKED, Today, 02:02 PM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by selu72, Today, 02:01 PM
              0 responses
              3 views
              0 likes
              Last Post selu72
              by selu72
               
              Started by f.saeidi, Today, 12:14 PM
              8 responses
              21 views
              0 likes
              Last Post f.saeidi  
              Started by Mikey_, 03-23-2024, 05:59 PM
              3 responses
              49 views
              0 likes
              Last Post Sam2515
              by Sam2515
               
              Started by Russ Moreland, Today, 12:54 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Erick  
              Working...
              X