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:	105
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 NullPointStrategies, Today, 05:17 AM
      0 responses
      50 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      69 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X