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.
        
                   [COLOR="Red"] Model2.Set(1/1+2.567^Math.Pow(Close[0]));[/COLOR]
                }
        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 Barry Milan, Yesterday, 10:35 PM
            5 responses
            16 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by DanielSanMartin, Yesterday, 02:37 PM
            2 responses
            13 views
            0 likes
            Last Post DanielSanMartin  
            Started by DJ888, 04-16-2024, 06:09 PM
            4 responses
            12 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by terofs, Today, 04:18 PM
            0 responses
            11 views
            0 likes
            Last Post terofs
            by terofs
             
            Started by nandhumca, Today, 03:41 PM
            0 responses
            8 views
            0 likes
            Last Post nandhumca  
            Working...
            X