Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Double EMA needs a price option (OHLC)for each EMA

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

    Double EMA needs a price option (OHLC)for each EMA

    I downloaded something from the forum, originally written by Rollins who doesnt allow contacts. I 'd like each EMA to have whether it's based on OHLC as an input for each. Changing Price Type Supported to 'True' gives the option but applies the same one to both.
    It plots a single line that changes color and an arrow marking it.
    The code was too long for HTML or PHP so I am attaching the zip file I downloaded.
    Attached Files
    Last edited by simpletrades; 08-29-2009, 11:35 PM.

    #2
    simpletrades, that is expected behavior when Price Type Supported = true. You can set in the code what input you'd like:
    Code:
    // to use Highs in the calculations:
    double currentEMA = EMA(High, 14)[0];
    // to use Lows
    double currentEMA = EMA(Low, 14)[0];
    AustinNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Austin View Post
      simpletrades, that is expected behavior when Price Type Supported = true. You can set in the code what input you'd like:
      Code:
      // to use Highs in the calculations:
      double currentEMA = EMA(High, 14)[0];
      // to use Lows
      double currentEMA = EMA(Low, 14)[0];
      you misunderstand. That still sets them both the same.
      i want one of them set for Close, the other set for Open, not both EMA's for close or both for open.

      Comment


        #4
        Originally posted by simpletrades View Post
        i want one of them set for Close, the other set for Open
        Then you can do this:
        Code:
        double closeEMA = EMA(Close, 14)[0];
        double openEMA = EMA(Open, 14)[0];
        AustinNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Austin View Post
          Then you can do this:
          Code:
          double closeEMA = EMA(Close, 14)[0];
          double openEMA = EMA(Open, 14)[0];
          Now the indicator window still reads listing both EMAs but only one price type--Close

          Do I have it in the wrong spot?
          I have it under in this section as the very first instruction:
          protectedoverridevoid OnBarUpdate()
          Last edited by simpletrades; 08-30-2009, 03:42 PM.

          Comment


            #6
            You will probably have to turn that option off for the indicator control panel and set up enums for both EMA's so you can set variables to open or close.
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              Originally posted by eDanny View Post
              You will probably have to turn that option off for the indicator control panel and set up enums for both EMA's so you can set variables to open or close.
              what option and where do i get a choice to indicate?
              also, what's an enum?
              do they speak english in rochester?

              Comment


                #8
                simpletrades,

                You can try running a google search on enums. It is a general programming concept that you can use in this context.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Josh View Post
                  simpletrades,

                  You can try running a google search on enums. It is a general programming concept that you can use in this context.
                  ok, by turn the option off in the indicator panel, do you mean set price type to false?

                  Comment


                    #10
                    Include this line in your Initialize() section:

                    PriceTypeSupported = false;
                    eDanny
                    NinjaTrader Ecosystem Vendor - Integrity Traders

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    597 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    343 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    103 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    556 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    555 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X