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

HeikenAshi Question

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

    HeikenAshi Question

    If I am running a strategy and want to go long when the HeikenAshi is a green candle, why doesn't this open a position.........

    // Condition set 1
    if (Position.MarketPosition == MarketPosition.Flat
    && BarColor == Color.Green)

    {
    EnterLong("");
    }
    Last edited by edgeliner; 05-04-2011, 10:52 AM.

    #2
    Hi EdgeLiner,

    Unfortunately there is no support for accessing the color values of bar series or indicators programatically. The BarColor property is for assignment only - can't read from it. You have to identify the conditions that cause a color change.

    In a standard bar, this is simply Close[0] > Open[0]. HeikenAshi uses a different implementation, but you can check source code for it by clicking Tools > Edit NinjaScript > Indicator > Select HeikenAshi and Open.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Yea Ryan.....that's what I figured and is exactly what I did....thanks for the confirmation.......

      Comment


        #4
        Ryan.......

        I have tried various codes to do this to no avail. Any chance you could show me how it would look?

        Comment


          #5
          Ryan......

          Simply put, I am trying to do this........

          if HeikenAshi().HAClose[0] > HeikenAshi().HAOpen[0]
          {
          EnterLong();
          }

          Comment


            #6
            That looks OK. Did you notice any issues using it? Only thing I see is you need parentheses. ( )

            if (HeikenAshi().HAClose[0] > HeikenAshi().HAOpen[0])
            {
            EnterLong();
            }
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              You know what Ryan.....you are right......it does work! Sorry!

              Comment


                #8
                Glad to hear. Thanks for following up!
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by edgeliner View Post
                  Ryan......

                  Simply put, I am trying to do this........

                  if HeikenAshi().HAClose[0] > HeikenAshi().HAOpen[0]
                  {
                  EnterLong();
                  }
                  Hello everyone,
                  Does this code work for renko ?

                  i use NT8

                  Thanks

                  Comment


                    #10
                    Hello aemaem,

                    The HeikenAshi indicator can be applied to a chart with Renko bars. Calling the indicator in a script would be the same.
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by GLFX005, Today, 03:23 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post GLFX005
                    by GLFX005
                     
                    Started by XXtrader, Yesterday, 11:30 PM
                    2 responses
                    11 views
                    0 likes
                    Last Post XXtrader  
                    Started by Waxavi, Today, 02:10 AM
                    0 responses
                    7 views
                    0 likes
                    Last Post Waxavi
                    by Waxavi
                     
                    Started by TradeForge, Today, 02:09 AM
                    0 responses
                    14 views
                    0 likes
                    Last Post TradeForge  
                    Started by Waxavi, Today, 02:00 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post Waxavi
                    by Waxavi
                     
                    Working...
                    X