• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Raise to power X^2

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

    Raise to power X^2

    I am working on a indicators and i am trying to make it look like this

    [1 / (1+2.718^Close]

    However, I keep getting an error saying that ^ cannot be applied how to i fix this issue.

    #2
    This is what i have so far
    Code:
    Plot0.Set(1/1+2.178^High[0]);

    Comment


      #3
      wallstreetking, there's no direct power operation, you would have to use Math.Pow for this scenario - http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Hey guys i am not sure if i am doing this correct. C# beginner

        this is what I have right now
        Code:
        /// <summary>
            /// Enter the description of your new custom indicator here
            /// </summary>
            [Description("Enter the description of your new custom indicator here")]
            public class ResearchModel2 : Indicator
            {
                #region Variables
                // Wizard generated variables
                    private int myInput0 = 1; // Default setting for MyInput0
                // User defined variables (add any user defined variables below)
                #endregion
        
                /// <summary>
                /// This method is used to configure the indicator and is called once before any bar data is loaded.
                /// </summary>
                protected override void Initialize()
                {
                    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Model2"));
                    Overlay				= false;
                }
        
                /// <summary>
                /// Called on each bar update event (incoming tick)
                /// </summary>
                protected override void OnBarUpdate()
                {			
                    // Use this method for calculating your indicator values. Assign a value to each
                    // plot below by replacing 'Close[0]' with your own formula.
        
                    Model2.Set(1/1+2.567^Math.Pow(Close[0]));
                }
        I get an error "no overload for method "POW" takes 1 arguments

        Comment


          #5
          Try this:

          Something like Math.Pow(Close[0], 2)
          The "2" is the power to raise your double number to.

          Dan
          eDanny
          NinjaTrader Ecosystem Vendor - Integrity Traders

          Comment


            #6
            Thank you eDanny

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Tradarr, Today, 06:25 PM
            2 responses
            13 views
            0 likes
            Last Post Tradarr
            by Tradarr
             
            Started by cocopod, Today, 04:47 PM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_JoshG  
            Started by digibob, Today, 02:47 AM
            2 responses
            14 views
            0 likes
            Last Post NinjaTrader_Kate  
            Started by mntemel, Today, 03:31 PM
            4 responses
            23 views
            0 likes
            Last Post mntemel
            by mntemel
             
            Started by mrlucky1x, Today, 03:14 PM
            2 responses
            7 views
            0 likes
            Last Post mrlucky1x  
            Working...
            X