• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Logic

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

    Indicator Logic

    Hello,

    This question is about an indicator Logic. I am new to programming. My question is, when you create an indicator and the OnBarUpdate() is executed bar after bar, does the code goes back again to the first candle to recalculate everything from the beginning on every new bar??

    Thanks

    #2
    Originally posted by MillenniumTrader View Post
    Hello,

    This question is about an indicator Logic. I am new to programming. My question is, when you create an indicator and the OnBarUpdate() is executed bar after bar, does the code goes back again to the first candle to recalculate everything from the beginning on every new bar??

    Thanks
    Not unless you ask it to. It will simply run through the code block sequentially once for each barUpdate.

    Comment


      #3
      Thanks for your response, Is there any special setting for this behavior or it has to be custom coded

      Comment


        #4
        Originally posted by MillenniumTrader View Post
        Thanks for your response, Is there any special setting for this behavior or it has to be custom coded
        What special behavior?

        Comment


          #5
          Millennium,

          Can you tell us why you need this, perhaps by giving an example? The program does keep track of the data on prior bars in order to make calculations on the current bar.

          futurestrack

          Comment


            #6
            Hello MillenniumTrader,

            Thank you for your post.

            Koganam is correct, OnBarUpdate() would process bar by bar from oldest to newest. If you want to look back over a period of time you would generally use a period to do so. A period such as the one used for the SMA sets the number of bars used for the calculation.

            And like futurestrack mentioned, if you can provide an example of what you wish to do we can provide more details.
            Patrick H.NinjaTrader Customer Service

            Comment


              #7
              Thanks for the great support, see the attached file for more explanation. The indicator is already painting the rectangles in my chart but they dont stop when price trespass thru them in the future. I don't know if I should use "DrawLine()" , "DrawRegion()" or "DrawExtendLine()" for this specific application. The problem is that the indicator will have to go back and check if previous rectangles have been COMPLETELY cut by price. See attached picture.

              Regards
              Attached Files

              Comment


                #8
                I would think you could on each bar:

                For each of the existing rectangles
                See if the price has been both below and above the rectangle since its left edge bar.
                If so then set the rectangle right edge coordinates as the current bar position.

                I think you can define some global variable arrays to keep track of all this.

                Clearly it's not an easy problem, but it can be done. (Ask yourself if it's really worth it)

                Hope this helps.

                futurestrack

                Comment


                  #9
                  Originally posted by MillenniumTrader View Post
                  Thanks for the great support, see the attached file for more explanation. The indicator is already painting the rectangles in my chart but they dont stop when price trespass thru them in the future. I don't know if I should use "DrawLine()" , "DrawRegion()" or "DrawExtendLine()" for this specific application. The problem is that the indicator will have to go back and check if previous rectangles have been COMPLETELY cut by price. See attached picture.

                  Regards
                  That is fairly obviously the "Hidden Gaps" setup. Well, there is good news and there is not so good news. It can obviously be coded because we have already coded it. That is the good news. The not so good news is that we are a commercial outfit who are selling that indicator, so I cannot give you the source code.

                  Is this not what you are talking about?
                  Attached Files

                  Comment


                    #10
                    Hello Koganam, yes it is exactly what I am trying to accomplish here. I didn't know that you have it coded already. By the way, I checked your website but I didn't see it there. Can you provide the link? I cant tell you that I will buy it because I have coded the main indicator logic with the help of many here (and without coding experience) so I will try to completed if I can. As you can see in the picture, the only missing part is stopping the rectangles. Anyways, I am really grateful for your help and others people too. the advice is not only good for this indicator but for others too.I will try to work with arrays and with the IdrawObject to see what I get.

                    Regards,
                    Attached Files

                    Comment


                      #11
                      Originally posted by MillenniumTrader View Post
                      Hello Koganam, yes it is exactly what I am trying to accomplish here. I didn't know that you have it coded already. By the way, I checked your website but I didn't see it there. Can you provide the link? I cant tell you that I will buy it because I have coded the main indicator logic with the help of many here (and without coding experience) so I will try to completed if I can. As you can see in the picture, the only missing part is stopping the rectangles. Anyways, I am really grateful for your help and others people too. the advice is not only good for this indicator but for others too.I will try to work with arrays and with the IdrawObject to see what I get.

                      Regards,
                      Send me a note from the website, or a PM. I will email you a Trial.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by pmmkm, Yesterday, 11:13 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post pmmkm
                      by pmmkm
                       
                      Started by pulpiwapi, 03-04-2019, 11:18 PM
                      11 responses
                      149 views
                      0 likes
                      Last Post music_p13  
                      Started by indy73, 06-25-2019, 10:52 PM
                      3 responses
                      20 views
                      0 likes
                      Last Post sledge
                      by sledge
                       
                      Started by priceisking, Yesterday, 12:51 PM
                      1 response
                      23 views
                      0 likes
                      Last Post NinjaTrader_PaulH  
                      Started by chartish, Yesterday, 10:33 AM
                      3 responses
                      30 views
                      0 likes
                      Last Post chartish  
                      Working...
                      X