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:	109
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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Working...
      X