Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to account for candle open and close being equal

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

    How to account for candle open and close being equal

    Hi folks,
    I am working on an indicator that calculates wick size in relation to candle body size.

    Example is:

    top wick = 3 ticks
    candle body = 8 ticks
    bottom wick = 2 ticks

    The indicator weights the wicks against the candle averages out the top/bottom wick and plots it on a graph.

    The problem I am facing is when Open and Close are the same. Basically there is nothing for the wicks to be weighted against and the graph show is empty for that bar, even though the wicks might be quite large.

    My question is, how would I go about taking into account that a candle body may not exist (when difference between Open and Close price == 0)

    Any ideas?

    #2
    Hello Mountain_cast,

    That really depends on how you want to handle that. You could add a condition to check if the math used to get the ticks is 0 and supply a default value.
    JesseNinjaTrader Customer Service

    Comment


      #3
      You are right. Your suggestion is actually what I had in mind. I think it's because I am not well enough versed in C# to know how to do that.


      double open0 = Open[0];
      double close0 = Close[0];​
      double candleRange0 = Math.Abs(open0 - close0);

      if (candleRange0 == 0)




      AND this is where i am stuck. How do something like

      if (candleRange0 == 0)
      double candleRangeAdjusted = candleRange0 + 1;



      EDIT: I figured it out
      Last edited by Mountain_cast; 12-12-2024, 09:03 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by leunating, Today, 12:56 AM
      2 responses
      17 views
      0 likes
      Last Post leunating  
      Started by tmk-c, 07-19-2017, 11:29 PM
      6 responses
      1,687 views
      0 likes
      Last Post Brightredmegaphone  
      Started by Trader4Life, Today, 09:20 PM
      0 responses
      5 views
      0 likes
      Last Post Trader4Life  
      Started by WileCoyote, Today, 08:26 PM
      0 responses
      8 views
      0 likes
      Last Post WileCoyote  
      Started by madankumars, 11-18-2019, 11:12 AM
      10 responses
      176 views
      0 likes
      Last Post ulisesguerrero  
      Working...
      X