Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RMMA & ModHeikenAshi

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

    #31
    it is simple math, but in the moment (for a short look) i can not explain.
    i must understand, this for me, than i can code in c#

    for(int i=0; i<limit; i++) {

    AverageDistanceBuffer[i] = (((

    ( iMA(NULL, 0, BasePeriod + (PeriodStep * 0), 0, MODE_LWMA, PRICE_CLOSE, i) -
    iMA(NULL, 0, BasePeriod + (PeriodStep * 1), 0, MODE_LWMA, PRICE_CLOSE, i) ) +

    ( iMA(NULL, 0, BasePeriod + (PeriodStep * 1), 0, MODE_LWMA, PRICE_CLOSE, i) -
    iMA(NULL, 0, BasePeriod + (PeriodStep * 2), 0, MODE_LWMA, PRICE_CLOSE, i) ) + ...

    Comment


      #32
      double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

      Parameters:
      symbol - Symbol the data of which should be used to calculate indicator. NULL means the current symbol. timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. period - Averaging period for calculation. ma_shift - MA shift. Indicators line offset relate to the chart by timeframe. ma_method - MA method. It can be any of the Moving Average method enumeration value. applied_price - Applied price. It can be any of Applied price enumeration values. shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

      Comment


        #33
        From a quick look this just generates the multiple MA rainbow in a more efficient way because previously calculated MA values are reused...the shift paramter explains this in your second post.
        BertrandNinjaTrader Customer Service

        Comment


          #34
          Hi Gumphrie,
          Looks very good. I am interested in using the "mod HA" in my own automated system. I need to convert it to 0 and 1. Zeros being the red color in the bar, 1 the green ones. Now, what you do is to go back a number of bars, check if the current HA open and current HA close are between the min(open, close) and max(open,close) of the "n" bar back. If so, you get that color for your current bar, correct?
          It seems that later you shift the position in the "colorArr" array and save the current color at position zero. Is that the algorithm?
          I am trying that; but not working too well. Please, let me know if your algorithm is different than that.
          Thanks!

          Comment


            #35
            I am trying to use the ModHeikenAshi indicator for entry and exit in a strategy.

            Therefore I am trying to add a flag to test for the color of the bar with the following code in the indicator: "if(BarColor = barColorUp) bullIndication.Set(true); else bullIndication.Set(false);"

            However I got this error: "Cannot implicitly convert type 'System.Drawing.Color' to 'bool'"


            I tried to work around this problem by using the following code: "if(Values[3][0] > Values[0][0]) bullIndication.Set(true); else bullIndication.Set(false);" i.e. where close is higher than open, set flag to true.


            When I test it in the strategy it doesn't seem to give the correct buy/sell signal. Any idea why? I have already set
            CalculateOnBarClose =
            true;, so it shouldn't be computing before the bar finish.

            The buy/sell strategy using the following code:
            protected override void OnBarUpdate()
            {
            if (ModHeikenAshi(6).BullIndication[0]==true)
            EnterLong();
            if (ModHeikenAshi(6).BullIndication[0]==false)
            EnterShort();
            }
            The bar is green all the way, not sure why the sell short order got executed.
            Attached Files
            Last edited by tjendra; 03-23-2009, 12:01 AM.

            Comment


              #36
              if(BarColor == barColorUp)

              Comment


                #37
                Thanks, that solve the "Cannot implicitly convert type 'System.Drawing.Color' to 'bool'" error. However changing the if(BarColor == barColorUp) bullIndication.Set(true); else bullIndication.Set(false);" statement, when I test the strategy, no trades got executed. Not sure why is that so?

                Comment


                  #38
                  Please don't check directly for the barcolor to enter a trade, instead check for the chart conditions that trigger the coloring of the bars. After this change, you should see trades generated.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #39
                    I tried doing what you said by using the following code: "if(Values[3][0] > Values[0][0]) bullIndication.Set(true); else bullIndication.Set(false);" i.e. where close is higher than open, set flag to true. But it doesn't seem correct when tested out in the strategy. (Refer to my pic in the earlier post)

                    Comment


                      #40
                      tjendra,

                      You will need to post complete code for us to be able to evaluate further. Also, if you do not mind could you please open a new thread as this has become unrelated to the original thread. Thank you.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #41
                        RMMA Compilation

                        Hi Gumphrie,

                        I downloaded RMMA zip imported working fine, I tried to change color bands from band 5 to band 2 i mean looking for only band 1 and band2 , when i complied code and gave me error

                        " Indicator\RMMA.cs The type or namespace name 'RMMAAverageType' could not be found (are you missing a using directive or an assembly reference?) CS0246 - click for info 557 26"

                        Even after importing RMMA.zip file when I compiled RMMA.cs i got the same message.


                        Help will be appericiated

                        regards

                        Sukh

                        Comment


                          #42
                          #region Using declarations
                          using System;
                          using System.Diagnostics;
                          using System.Drawing;
                          using System.Drawing.Drawing2D;
                          using System.ComponentModel;
                          using System.Xml.Serialization;
                          using NinjaTrader.Data;
                          using NinjaTrader.Gui.Chart;
                          using NinjaTrader.Gui.Design;
                          #endregion
                          public enum RMMAAverageType
                          {
                          EMA,
                          SMA,
                          WMA,
                          LSMA,
                          HMA,
                          }

                          public enum RMMADrawType
                          {
                          Fill,
                          Line,
                          Both,
                          }
                          // This namespace holds all indicators and is required. Do not change it.
                          namespace NinjaTrader.Indicator
                          {
                          /// <summary>
                          ///
                          /// </summary>
                          [Description("Rainbow Multiple Moving Averages.")]
                          [Gui.Design.DisplayName("Rainbow Multiple Moving Averages")]
                          public class RMMA : Indicator
                          {

                          Comment


                            #43
                            Thanks whself beginner,

                            Got it

                            Regards

                            Sukh

                            Comment


                              #44
                              GMMA with Color Fill !!!!!!

                              HI

                              This is GMMA with color filled instead of lines!!!!

                              May be helpful for some one.


                              Sukh
                              Last edited by sukhsan; 04-11-2009, 09:34 PM.

                              Comment


                                #45
                                GMMA with Color Fill !!!!!!

                                Sorry

                                Previous file was too big for attachment here is to compare.

                                All Credit goes to Gumphrie and Whself beginner !!!!!!!!

                                Enjoy

                                Sukh
                                Last edited by sukhsan; 04-11-2009, 09:34 PM.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by FrazMann, Today, 11:21 AM
                                2 responses
                                6 views
                                0 likes
                                Last Post NinjaTrader_ChristopherJ  
                                Started by rjbtrade1, 11-30-2023, 04:38 PM
                                2 responses
                                80 views
                                0 likes
                                Last Post DavidHP
                                by DavidHP
                                 
                                Started by Spiderbird, Today, 12:15 PM
                                1 response
                                6 views
                                0 likes
                                Last Post NinjaTrader_ChristopherJ  
                                Started by lorem, Yesterday, 09:18 AM
                                5 responses
                                18 views
                                0 likes
                                Last Post NinjaTrader_ChelseaB  
                                Started by cmtjoancolmenero, Yesterday, 03:58 PM
                                12 responses
                                42 views
                                0 likes
                                Last Post NinjaTrader_ChelseaB  
                                Working...
                                X