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

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.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by algospoke, Today, 06:40 PM
            0 responses
            10 views
            0 likes
            Last Post algospoke  
            Started by maybeimnotrader, Today, 05:46 PM
            0 responses
            7 views
            0 likes
            Last Post maybeimnotrader  
            Started by quantismo, Today, 05:13 PM
            0 responses
            7 views
            0 likes
            Last Post quantismo  
            Started by AttiM, 02-14-2024, 05:20 PM
            8 responses
            168 views
            0 likes
            Last Post jeronymite  
            Started by cre8able, Today, 04:22 PM
            0 responses
            10 views
            0 likes
            Last Post cre8able  
            Working...
            X