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

Indicator that plots Hourly Object on 5min chart??

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

    Indicator that plots Hourly Object on 5min chart??

    Any idea how I can get something such as ATR from Hourly Chart, but have it draw the Ranges on 5min chart.

    It doesn't have to be ATR, I'm just using that as an example.

    I want to be able to Plot something every Hour from a 60 min chart. How would I

    1. Plot or Draw something Hourly?
    2. Use the 60min Object in order to do it.


    I already know that I can
    Code:
    Add(PeriodType.Minute, 60);
    So how do I use that to take Hourly ATR and Draw it on 5min chart "EVERY START OF EVERY HOUR"

    #2
    Hello Ginx10k,

    Thank you for your post.

    You would want to use the overload of BarsArray[ ] when calling the ATR indicator.
    Now that you have added the 60 min, you have added another data series to the BarsArray Index
    Code:
    ATR(BarsArray[1])]0]
    BarsArray

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Okay. First want to say Thanks for that. but NOw to my other question.

      HOW DO I DRAW or Do Something at the Beginning of Every HOUR????


      Example lets say I want to draw a Rectangle that Begins at Every Hour and Ends at the Hour using the ATR. any ideas?

      This Code draws Rectangle from the ATR of 10 bars ago. Fine.

      Code:
      DrawRectangle("ATR", false, 10, ATR(BarsArray[1])]10] - TickSize, 5, High[5] + TickSize, Color.PaleGreen, Color.PaleGreen, 2);
      Last edited by ginx10k; 07-29-2014, 09:23 AM.

      Comment


        #4
        Originally posted by ginx10k View Post
        Okay. First want to say Thanks for that. but NOw to my other question.

        HOW DO I DRAW or Do Something at the Beginning of Every HOUR????


        Example lets say I want to draw a Rectangle that Begins at Every Hour and Ends at the Hour using the ATR. any ideas?

        This Code draws Rectangle from the ATR of 10 bars ago. Fine.

        Code:
        DrawRectangle("ATR", false, 10, ATR(BarsArray[1])]10] - TickSize, 5, High[5] + TickSize, Color.PaleGreen, Color.PaleGreen, 2);
        Code:
        if (ToTime(Times[1][0]) % 10000 == 0)
        {
        //this is a candle that closed on an hour delimiter
        //do as thou wilt.
        }
        Last edited by koganam; 07-29-2014, 12:47 PM. Reason: Corrected code to refer to correct Time series.

        Comment


          #5
          Ginx10k,

          You would need to create some calculation logic to work for your primary bars.
          You would only be able to draw to the primary bars and not apply this to the bars ago for the 60M data series.

          Essentially, you can take the PeriodTypeValue and figure out how many bars are going to be in a 60M bar.

          Example -
          Code:
          if(BarsInProgress == 1)
          			{
          				TimeSpan barsAgo = DateTime.Now - Time[0].AddHours(-1);
          				
          				DrawRectangle("myTangle",true, Time[0], Lows[1][0], DateTime.Now.Subtract(barsAgo), Lows[1][1], Color.Blue, Color.Blue, 5);
          			}
          This will work for the last hour, if you want the most current hour set the COBC to false.
          Cal H.NinjaTrader Customer Service

          Comment


            #6
            Trying to Get RANGEs

            Okay thanks for that Cal. and Koganam.

            This is driving me nuts. I attached a small indicator. I want it to give me the Range from High to Low when Price touches the Top of Channel, up Trade either Expires or Price Touches channel again.

            I thought I wanted Average True Range, but that deals with the previous Close. I only want the indicator to give me values for right when Price signals a Touch.

            Im trying to measure HOW far Price MOVES after it Touches Channel. Can anyone Help me with This.

            This is the Output I get now: http://screencast.com/t/ctStsaLV

            I want it to basically just want to get a Plot of the Movement after a Signal.
            Attached Files

            Comment


              #7
              Hello Gin10x,

              It looks like the lowest low or highest high is not getting reset as needed. If you change the signalRange variable to use High[0] - Low[0], I think you'll get the expected results that you are looking for.
              Cal H.NinjaTrader Customer Service

              Comment


                #8
                Still Can't Get Time to work.

                Okay. Thanks for showing me the Rectangle thing with the Time. Now I can draw it ahead or behind by what ever time I want. Also the Range did work with the High[0] - Close[0].

                However, I'm still trying to figure Out this Time Thing and its killing me. I want to be able that when I get a Signal, the Signal Has an expiration that matches what ever time I want. So my final attempt at this was: I attempted that When Current Time Matches anything Close to the End of the Next 30 minutes, 'to do somethng.....'

                Code:
                if(BarsInProgress == 1)
                			{
                				TimeSpan expiryBars = DateTime.Now - Time[0].AddSeconds(+60);
                				
                				TimeSpan barsAgo = DateTime.Now - Time[0].AddMinutes(-30);
                				
                				TimeSpan barsFromNow = DateTime.Now - Time[0].AddMinutes(+30);
                				
                
                				
                				 DrawRectangle("myTangle",true, DateTime.Now.Subtract(barsFromNow), Lows[1][0], Time[0], Lows[1][1], Color.Blue, Color.Blue, 5);
                
                			
                //This was my Attempt at Saying that If the Current TIme is Equal to 30 Minutes from Now, '...do something'
                				if(expiryBars == barsFromNow)
                				{	
                					DrawArrowDown("My down arrow" + CurrentBar, false, 0, High[0] + 10 * TickSize, Color.Red); 
                					
                				}
                			}

                My Attempts have NOT worked. Can you or anyone please show a Simple way to do this.

                1. Signal Fires Off.
                2. What ever the Time the Signal Fires, it Expires at least 30 min (or any User defined time ) after that.

                Comment


                  #9
                  Main GOAL is

                  The main goal is that When a Signal is Given. That I can write a COndition to check How LONG it took for that Signal to reach it's Goal.

                  Second goal is to make the Signal automatically LOSE and restart once a Certain amount of Time has Elapsed.

                  For Example:
                  Code:
                  if(High[0] == EMA(200); 
                  { sellSignal = True; 
                  //Now If Signal was given at 9:20am,  and it hasn't reached it's goal by 10:00am, this is a Loser.
                  I want Indicator to Have the Exact time of Signal and once Current Time (From signal) till Expiration, for it to DO something

                  PLEASE HELP. I just can't get it.
                  Last edited by ginx10k; 07-30-2014, 04:21 PM.

                  Comment


                    #10
                    ??????

                    Any help please.

                    Comment


                      #11
                      Ginx10k,

                      Is this just not plotting the DrawObjects?
                      Cal H.NinjaTrader Customer Service

                      Comment


                        #12
                        It plots the objects. but please read this Post:. It explains in detail what I was looking to do. I appreciate your help.

                        Originally posted by ginx10k View Post
                        The main goal is that When a Signal is Given. That I can write a COndition to check How LONG it took for that Signal to reach it's Goal.

                        Second goal is to make the Signal automatically LOSE and restart once a Certain amount of Time has Elapsed.

                        For Example:
                        Code:
                        if(High[0] == EMA(200); 
                        { sellSignal = True; 
                        //Now If Signal was given at 9:20am,  and it hasn't reached it's goal by 10:00am, this is a Loser.
                        I want Indicator to Have the Exact time of Signal and once Current Time (From signal) till Expiration, for it to DO something

                        PLEASE HELP. I just can't get it.

                        Comment


                          #13
                          Maybe a Timer

                          Is there perhaps a way to make some kind of Timer that Lets say
                          1. Signal Fires off (Price touches EMA or whatever....) at 7:25am
                          2. Expiration is for 8:00am
                          3. Indicator Begins Counting Down so that when Time reaches 8:00am, Signal Expires.


                          How would I accomplish this. I'm just throwing out some ideas. I'm really Not sure how to do Time at all. the last Post shows my attempts at this.

                          Comment


                            #14
                            Ginx10k,

                            Thank for the info.

                            What you would want to do is create a IDrawObject that will store these values and then you can use the properties fo the IDrawObject to determine when the last object was drawn and obtain that info for DateTime Calculations.

                            Here is a link on how to use the IArrowUp for your script -
                            http://www.ninjatrader.com/support/h...l?iarrowup.htm
                            Cal H.NinjaTrader Customer Service

                            Comment


                              #15
                              I understand what you mean. but your still not showing the Date Time functions. I read the MSDN site and ninjascript support. I Just need someone to Help me Piece it together.

                              Telling me that I have to use the Drawobject with Date and Time. I already knew that part. Please some examples or some kind little Snippets putting the Date and Time together to accomplish these things.

                              I hope you understand what I was looking for. and believe me I totally appreciate your help on this.

                              I just Don't get how to put the Date Time objects together.
                              Last edited by ginx10k; 07-31-2014, 10:14 AM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by jclose, Today, 09:37 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post jclose
                              by jclose
                               
                              Started by WeyldFalcon, 08-07-2020, 06:13 AM
                              10 responses
                              1,413 views
                              0 likes
                              Last Post Traderontheroad  
                              Started by firefoxforum12, Today, 08:53 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post firefoxforum12  
                              Started by stafe, Today, 08:34 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post stafe
                              by stafe
                               
                              Started by sastrades, 01-31-2024, 10:19 PM
                              11 responses
                              169 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Working...
                              X