Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

creating two bands envolving the price

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

    creating two bands envolving the price

    Hi, I'm trying to program an indicator that plots on the chart, two bands and i'm having some problems, do you see whats going wrong in this code?

    protectedoverridevoid OnBarUpdate()
    {
    double Value0 = (Low[0]*(1-2*((((High[0]-Low[0])/((High[0]+Low[0])/2))*1000)*1/1000)));
    double Value1 = (Low[0]*(1+2*((((High[0]-Low[0])/((High[0]+Low[0])/2))*1000)*1/1000)));
    double Lowerband = SMA(Value0,20)[0];
    double Higherband = SMA(Value1,20)[0];
    Bandainferior.Set(Lowerband);
    Bandasuperior.Set(Higherband);
    }

    when I try to compile it returns this code errors: CS 1502, NT1503.

    Thanks.

    #2
    Hi julen,

    One of our techs training in NinjaScript will respond later in the day. Thank you for your patience.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      Within the SMA() method your Value0 and Value1 need to be dataseries. Here is a link that will help you with SMA():


      Here is a link on how to create a DataSeries:


      As a note, you can find your error code here:
      DenNinjaTrader Customer Service

      Comment


        #4
        hi

        EMAEnvelope same as MAEnvelope but whith EMA
        hope it helps
        Attached Files

        Comment


          #5
          high-low price bands

          How would I set up a set of bands that give over the period X ,the moving average of a price high and a price low.

          say a 4 ma of one minute bar highs,and a 4 ma of one minute lows,set up over price chart as lines?

          Comment


            #6
            You could simply add two EMA's to your chart, one with the 'Price type' input set to 'High', the other with the input set to 'Low'. This should create the channel you need.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            601 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            347 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            559 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            558 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X