Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Heiken Ashi Smoothed

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

    Heiken Ashi Smoothed

    Hello , I am developing a simple strategy that buys or sells when, after a series
    of Heiken Ashi bars with the same color it appears a bar with the opposite color. To identify the up and down bars in Heiken Ashi it is very simple:
    -up bars
    HeikenAshi().HAOpen[
    0] <= HeikenAshi().HAClose[0]
    -down bars
    HeikenAshi().HAOpen[0] >= HeikenAshi().HAClose[0]

    the problem it is that this strategy it works better with the indicator Heiken Ashi Smoothed than with Heiken Ashi and I don´t know how to identify the up and down bars with the indicator Heiken Ashi Smoothed

    Any help to identify this up and down bars?

    Thanks
    Attached Files

    #2
    Hello ALBER,
    Thanks for your note.

    Please try using the below code to compare the values.
    Code:
    if (this.HeikenAshiSmoothed(.7, HAMA.SMA, HAMA.SMMA, 1, 2).HAOpen[0] > this.HeikenAshiSmoothed(.7, HAMA.SMA, HAMA.SMMA, 1, 2).HAClose[0])
    {
      //do something
    }
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hi Joydeep ,

      it works perfectly,

      Many Thanks

      Comment


        #4
        Hi Support,

        Is there a way to sync the HASmoothed indicator with another indicator and not with the price?It happens so,when i try to smooth Heiken Ashi indicator the other indicators comply with the price,and the HA becomes out of sync.Can somen please help me with that one?

        Thanks

        Comment


          #5
          Hello SnakeEye,

          Thank you for your post.

          Are you looking to use another indicator as the input for the HeikenAshiSmoothed or HeikenAshi indicator?

          Can you provide a screenshot of the HeikenAshi getting out of sync?

          I look forward to your response.

          Comment


            #6
            Originally posted by NinjaTrader_PatrickH View Post
            Hello SnakeEye,

            Thank you for your post.

            Are you looking to use another indicator as the input for the HeikenAshiSmoothed or HeikenAshi indicator?

            Can you provide a screenshot of the HeikenAshi getting out of sync?

            I look forward to your response.
            Hi Patrick,correct,i want the indicator(see the attached) get the alerts from HeikenAshiSmoothed indicator,not from the price.Seems like some of other indicators work well,but the one i want,doesnt.
            Attached Files

            Comment


              #7
              Originally posted by SnakeEYE View Post
              Hi Patrick,correct,i want the indicator(see the attached) get the alerts from HeikenAshiSmoothed indicator,not from the price.Seems like some of other indicators work well,but the one i want,doesnt.
              You just need to make substitutions, whether by first assigning HA values to variables or directly.

              Where you have Open[0], you substitute HeikenAshiSmoothed(.7, HAMA.SMA, HAMA.SMMA, 1, 2).HAOpen[0]

              and so on for High[0], Close[0]. Low[0].

              If you prefer, assign those HA values to other variables, then use the variables for the substitution, as that is often easier to read later. So, for example.

              Code:
              double open = HeikenAshiSmoothed(.7, HAMA.SMA, HAMA.SMMA, 1, 2).HAOpen[0];
              Then wherever in the code there is Open[0], you use open instead.

              Comment


                #8
                Originally posted by koganam View Post
                You just need to make substitutions, whether by first assigning HA values to variables or directly.

                Where you have Open[0], you substitute HeikenAshiSmoothed(.7, HAMA.SMA, HAMA.SMMA, 1, 2).HAOpen[0]

                and so on for High[0], Close[0]. Low[0].

                If you prefer, assign those HA values to other variables, then use the variables for the substitution, as that is often easier to read later. So, for example.

                Code:
                double open = HeikenAshiSmoothed(.7, HAMA.SMA, HAMA.SMMA, 1, 2).HAOpen[0];
                Then wherever in the code there is Open[0], you use open instead.
                Hi koganam,i triedbut didn`t seem to make it workable.I get the same result.

                Comment


                  #9
                  Originally posted by SnakeEYE View Post
                  Hi koganam,i triedbut didn`t seem to make it workable.I get the same result.
                  Do you care to post your current file?

                  Comment


                    #10
                    Originally posted by koganam View Post
                    Do you care to post your current file?
                    ====This one====
                    Attached Files

                    Comment


                      #11
                      Originally posted by SnakeEYE View Post
                      ====This one====
                      You said:
                      Hi Patrick,correct,i want the indicator(see the attached) get the alerts from HeikenAshiSmoothed indicator,not from the price.Seems like some of other indicators work well,but the one i want,doesnt.
                      The indicator that you attached was called ShortTermSwings.cs, so I would assume that you are trying to drive this indicator from the HA indicator. Did I misunderstand that?

                      If I understood that correctly, I should think that makes it rather obvious that the indicator you need to edit is the target indicator, not the source. If I misunderstood, then I apologize for misleading you, and I cannot think of a simple solution.

                      Comment


                        #12
                        Originally posted by koganam View Post
                        You said:


                        The indicator that you attached was called ShortTermSwings.cs, so I would assume that you are trying to drive this indicator from the HA indicator. Did I misunderstand that?

                        If I understood that correctly, I should think that makes it rather obvious that the indicator you need to edit is the target indicator, not the source. If I misunderstood, then I apologize for misleading you, and I cannot think of a simple solution.
                        You are correct.I want the ShortTermSwing indicator to derive the alert signals from the HeikenAshiSmoothed indicator.It doesnt work by simply putting it via Input Series.It becomes totaly out of whack.

                        Comment


                          #13
                          Originally posted by SnakeEYE View Post
                          You are correct.I want the ShortTermSwing indicator to derive the alert signals from the HeikenAshiSmoothed indicator.It doesnt work by simply putting it via Input Series.It becomes totaly out of whack.
                          Then edit the correct indicator, ShortTermSwing, to take its input from the HA, as per the instructions that I already posted.

                          Comment


                            #14
                            With regard to the "ShortTermSwings.cs" code of the Post #6, could someone please show me which terms must be compared to see when the up-line becomes a down-line or viceversa ?

                            I tried with ShortTermSwings().Trend[0], namely
                            • if (ShortTermSwings().Trend[0] < 0)

                            to look for the down-line, and
                            • if (ShortTermSwings().Trend[0] > 0)

                            for the up-line, but this doesn't work.

                            Thanks in advance

                            Comment


                              #15
                              Smooth Heiken Crossover.

                              Hello, I am trying to create a simple strategy w/ the wizard using a crossover of the linear regression and the smoothed Heiken Ashi indicator. For some reason, the Heiken Ashi also appears to be out of whack when I plot it in the backtester chart. I may not understand the inputs for the calculation of the Smooth Heiken Ashi indicator. Any help would be appreciated.

                              Thanks.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by aussugardefender, Today, 01:07 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post aussugardefender  
                              Started by pvincent, 06-23-2022, 12:53 PM
                              14 responses
                              238 views
                              0 likes
                              Last Post Nyman
                              by Nyman
                               
                              Started by TraderG23, 12-08-2023, 07:56 AM
                              9 responses
                              384 views
                              1 like
                              Last Post Gavini
                              by Gavini
                               
                              Started by oviejo, Today, 12:28 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post oviejo
                              by oviejo
                               
                              Started by pechtri, 06-22-2023, 02:31 AM
                              10 responses
                              125 views
                              0 likes
                              Last Post Leeroy_Jenkins  
                              Working...
                              X