Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:	63
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.​
    Chris L.NinjaTrader Customer Service

    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 geddyisodin, 04-25-2024, 05:20 AM
      8 responses
      58 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      4 responses
      3,285 views
      1 like
      Last Post jgualdronc  
      Started by Option Whisperer, Today, 09:55 AM
      0 responses
      5 views
      0 likes
      Last Post Option Whisperer  
      Started by halgo_boulder, 04-20-2024, 08:44 AM
      2 responses
      22 views
      0 likes
      Last Post halgo_boulder  
      Started by mishhh, 05-25-2010, 08:54 AM
      19 responses
      6,189 views
      0 likes
      Last Post rene69851  
      Working...
      X