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

Draw Horizontal line on the hour dynamically

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

    Draw Horizontal line on the hour dynamically

    Help please!

    I would like to draw a Horizontal Line on the chart that corresponds to the current bar's Opening price + 0.0003 (for 3 pips) . The kicker is that this line must re-draw or update at the start of every hour on the hour. I am using eSignal data feed so historical data is no problem. This will be applied to a 5 min chart.

    Can someone help me please?!!

    #2
    There are various help guide tutorials on indicator development which is always a good start if you are new to this. If you prefer not to get your hands dirty, you can always consult with one of our NinjaScript consultants.

    RayNinjaTrader Customer Service

    Comment


      #3
      I am not entirely new to Ninja script coding having written a few indicators myself. I know how to code for a fixed horizontal line at whatever level I want on the chart. The challenge is making it re-draw at the start of the hour. Just throwing it out there to get a dialogue going and for someone to give me a hint. Should I be looking at Session start time for example?

      Comment


        #4
        Assuming you run it on a 5 minute chart, you would need to programatically check on each bar if 12 - 5 minute bars have passed and if yes, recalculate and draw the line at the new value.
        RayNinjaTrader Customer Service

        Comment


          #5
          Thanks. I am struggling with getting the line to draw at the open price starting on the hour. So if I put up a chart at say 09:07 I need my line to stay at the open price at 09:00 until it reaches 10:00. Can you through me a suggested line of code? Just asking for a jump start.

          Comment


            #6
            Below is my attempt at coding what I am asking for but has compilation errors. Can you help?



            {
            if (CurrentBar < 24) return;
            int H1 = 0;
            for (int barsAgo = 0; barsAgo < 24; barsAgo++)
            {
            H1 = H1 + Input[barsAgo];
            }
            if (ToTime(Time[0]) >= ToTime(H1, 00, 00))
            {
            int bartime = CurrentBar - Bars.GetBar(new DateTime(2007,1,16,H1,0,0));
            }
            DrawHorizontalLine("Hour Open",Open[bartime],Color.Blue);
            }

            Comment


              #7
              I've replied in your other post.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                dpanglin,
                Any progress with the code? I am also interested in your code so any sharing will be appreciated. Thanks,
                astra

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by alifarahani, Today, 09:40 AM
                3 responses
                15 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by RookieTrader, Today, 09:37 AM
                4 responses
                18 views
                0 likes
                Last Post RookieTrader  
                Started by PaulMohn, Today, 12:36 PM
                0 responses
                5 views
                0 likes
                Last Post PaulMohn  
                Started by love2code2trade, 04-17-2024, 01:45 PM
                4 responses
                40 views
                0 likes
                Last Post love2code2trade  
                Started by junkone, Today, 11:37 AM
                3 responses
                26 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X