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 RubenCazorla, Today, 09:07 AM
    2 responses
    11 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by i019945nj, 12-14-2023, 06:41 AM
    7 responses
    81 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by timmbbo, 07-05-2023, 10:21 PM
    4 responses
    158 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by tkaboris, Today, 08:01 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Lumbeezl, 01-11-2022, 06:50 PM
    31 responses
    819 views
    1 like
    Last Post NinjaTrader_Adrian  
    Working...
    X