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 vivek.n, Yesterday, 03:19 AM
            2 responses
            32 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Started by Angus7, Yesterday, 02:03 PM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Started by powerlobster, Yesterday, 01:39 PM
            0 responses
            15 views
            0 likes
            Last Post powerlobster  
            Started by butt_toast, Yesterday, 01:16 PM
            0 responses
            12 views
            0 likes
            Last Post butt_toast  
            Started by joaquinbaricco, Yesterday, 07:39 AM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Working...
            X