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

Tagging the current day h/l

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

    Tagging the current day h/l

    Hello,
    I'm trying to draw a dot at the current High/Low but dot not drawing. Here is my code:
    if (Close[0] == CurrentDayOHL().CurrentHigh[1])
    {
    DrawDot("High" + CurrentBar, true, 0, High[0] + 2, Color.Green);
    }
    if (Close[0] == CurrentDayOHL().CurrentLow[1])
    {
    DrawDot("Low" + CurrentBar, true, 0, Low[0] - 2, Color.Red);
    }
    Any suggestions why this dot won't draw? Thanks

    #2
    Hello CaptainAmericaXX,

    CurrentDayOHL() is only available for the current day and does not use [1] indexing. If you are looking for prior session bars, there are methods:
    PriorDayOHLC()
    GetDayBar()

    What are you trying to express with your code? It looks like it may "Draw Dot when close price equals yesterdays High / Low". Use PriorDayOHLC() for this.
    Last edited by NinjaTrader_RyanM1; 05-16-2011, 02:24 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for reply.
      I'm trying to tag an instance of the current day high/low and take a reverse trade off that high or low. I was simply drawing a dot to make sure I was tagging the instance properly. So far the dot won't draw at the highs or lows.

      Comment


        #4
        I think you're close to this - change the brackets from 0 to 1. You may also want to check Highs and Lows rather than close. It should then indicate when the bar you're looking at made a new high/ low for the day.

        Code:
        if (High[0] == CurrentDayOHL().CurrentHigh[0])
        {
        DrawDot("High" + CurrentBar, true, 0, High[0] + 2, Color.Green); 
        }
        if (Low[0] == CurrentDayOHL().CurrentLow[0])
        {
        DrawDot("Low" + CurrentBar, true, 0, Low[0] - 2, Color.Red); 
        }
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          That did it. Thanks again Ryan!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          26 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, Yesterday, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          192 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,234 views
          0 likes
          Last Post xiinteractive  
          Working...
          X