• 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

  • MillenniumTrader
    started a topic Indicator Logic

    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

  • koganam
    replied
    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.

    Leave a comment:


  • MillenniumTrader
    replied
    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

    Leave a comment:


  • koganam
    replied
    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

    Leave a comment:


  • futurestrack
    replied
    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

    Leave a comment:


  • MillenniumTrader
    replied
    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

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    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.

    Leave a comment:


  • futurestrack
    replied
    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

    Leave a comment:


  • koganam
    replied
    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?

    Leave a comment:


  • MillenniumTrader
    replied
    Thanks for your response, Is there any special setting for this behavior or it has to be custom coded

    Leave a comment:


  • koganam
    replied
    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.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by BrandonT1292, 06-17-2019, 03:03 PM
2 responses
22 views
0 likes
Last Post thinarthrill  
Started by cbentrikin, Yesterday, 07:46 PM
1 response
7 views
0 likes
Last Post NinjaTrader_Marco  
Started by dr0832, 01-04-2019, 10:34 AM
7 responses
143 views
0 likes
Last Post Lancer
by Lancer
 
Started by RedDuke, Yesterday, 06:14 PM
0 responses
5 views
0 likes
Last Post RedDuke
by RedDuke
 
Started by DariusDeck, Yesterday, 04:22 PM
1 response
14 views
0 likes
Last Post NinjaTrader_Marco  
Working...
X