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 suroot, 04-10-2017, 02:18 AM
            4 responses
            3,019 views
            0 likes
            Last Post truepenny  
            Started by Stanfillirenfro, Today, 07:23 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by cmtjoancolmenero, Yesterday, 03:58 PM
            2 responses
            22 views
            0 likes
            Last Post cmtjoancolmenero  
            Started by olisav57, Yesterday, 07:39 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by cocoescala, 10-12-2018, 11:02 PM
            7 responses
            944 views
            0 likes
            Last Post Jquiroz1975  
            Working...
            X