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 on Bar Close true/false (daily stock data)

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

    Calculate on Bar Close true/false (daily stock data)

    Dear NT team

    I have an end of day strategy to generate trading alerts for the next trading day. Every morning, I am downloading EOD data from Yahoo (for example) and run my strategy on this data. For example, I wanted to generate signals yesterday (=Sunday) for the close of Friday, to be entered into the market before opening today (=Monday).

    Do I understand correctly that the Bar only "closes" when the next bar opens?

    The problem that I am having is:

    1) if I use COBC == true, it will not calculate anything for the last day since there is no new bar
    2) it seems that I cannot use FirstTickofBar either since I would like to generate my signals prior to next days open.
    3) if I use COBC== false is difficult to use also and for my current strategy will not deliver any outputs. In backtesting it does, but not for the last bar. The strategy access multiple indicators.

    My questions:
    1) is there a good way to generally overcome the problem instead of using COBC==false (such as using something like "Last"Tick of Bar?)
    2) what do I have to consider if I use COBC==false: what do the accessed indicators (some are my proprietary indicators) need to have OR cannot have in order to use them (such as any COBC references within the indicators themselves)

    Thank you
    wtmnn

    #2
    Hello wtmnn,

    Yes, your understanding is correct. A bar isn't opened until the new one begins.

    Best practice is to avoid assigning COBC property in any called indicators. They will inherit the calling indicator / strategy value for this.

    You have to consider whether you're developing a strategy for real time or backtest. For a backtest, the COBC setting will always be true, and you can effectively create a strategy for backtesting against the yahoo daily data.

    You can get values and process logic for the last bar when using COBC = false but for a real time strategy, you're missing real time dynamic updating with the yahoo connection. Without this your options are limited as to what type of situations you can code for.

    If you do not have a real time data connection: Best is to practice using the provided simulated data feed or market replay connections.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Taddypole, 04-26-2024, 02:47 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Eduardo  
    Started by futtrader, 04-21-2024, 01:50 AM
    6 responses
    58 views
    0 likes
    Last Post futtrader  
    Started by sgordet, Today, 11:48 AM
    0 responses
    4 views
    0 likes
    Last Post sgordet
    by sgordet
     
    Started by Trader146, Today, 11:41 AM
    0 responses
    5 views
    0 likes
    Last Post Trader146  
    Started by jpapa, 04-23-2024, 07:22 AM
    2 responses
    19 views
    0 likes
    Last Post rene69851  
    Working...
    X