Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculate third of the bar?

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

    Calculate third of the bar?

    What is the suggested sysinct way to code that condition that if close[0] < then third of the body of previous bar then no trade? I know the long way but was wondering if there is a short way?
    Thank you


    Click image for larger version

Name:	image.png
Views:	121
Size:	65.0 KB
ID:	1253222

    #2
    Hello, thanks for writing in.

    Heres how you would find one third of the bar:

    1. Find the difference between the opening and closing prices of the bar. Let's call this difference "D." var D = (Open[1] - Close[1])

    2. Divide D by 3 to calculate one-third of the price range: var OneThird = D / 3.

    3. If the opening price is higher than the closing price, subtract OneThird from the closing price to find the one-third point within the bar. This represents the distance from the closing price towards the opening price.

    Example: var OneThirdPoint = Close[1] - OneThird.

    4. If the closing price is higher than the opening price, add OneThird to the closing price to find the one-third point within the bar. This represents the distance from the opening price towards the closing price.

    Example: var OneThirdPoint = Close[1] + OneThird.​

    Comment


      #3
      Originally posted by tkaboris View Post
      What is the suggested sysinct way to code that condition that if close[0] < then third of the body of previous bar then no trade? I know the long way but was wondering if there is a short way?
      Thank you


      Click image for larger version  Name:	image.png Views:	35 Size:	65.0 KB ID:	1253222
      Hello @tkaboris,
      I'm using a similar indicator showing quarter points per candle so I appreciate your question about the one-third data. Please tell us what the gold and blue indicator settings are. I'm curious why the "dogleg" occurred in the gold one. Thanks.
      Last edited by zeller4; 08-14-2023, 12:31 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      173 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      90 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      129 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      208 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      186 views
      0 likes
      Last Post CarlTrading  
      Working...
      X