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 josh18955, 03-25-2023, 11:16 AM
            6 responses
            436 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            5 views
            0 likes
            Last Post FAQtrader  
            Started by rocketman7, Today, 09:41 AM
            5 responses
            18 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by frslvr, 04-11-2024, 07:26 AM
            9 responses
            127 views
            1 like
            Last Post caryc123  
            Started by selu72, Today, 02:01 PM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Working...
            X