Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculate

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

    Calculate

    I was hoping you could expand a bit on the Caluclate. I just want to make sure I am understanding this correctly.

    In the NT8 Help Guide it states under tips it states

    3.Embedded scripts within a calling parent script should not use a different Calculate property since it is already utilizing the Calculate property of the parent script (i.e. the strategy your indicator is called from).
    4. Scripts that require Calculate to be set by the developer must set this property in State.Historical in its OnStateChange() in order to ensure that if this script is a child (hosted) that the parent.Calculate property which is adopted by the child is overridden again.
    So essentially, when an indicator is called from a strategy, it by default will use the Calculate.XXXX setting that the strategy is using (regardless of how the indicator is programmed), unless you specifically program in the indicator to Calculate differently on the State.Historical.

    If you have a strategy that does not run on historical data (example, you are using ATM Strategies. And you program your strategy like so.
    PHP Code:
    else if(State == State.Historical)
    {
    return

    Does the indicator/child script still run the (State == State.Historical) so it can set a different Calculate.XXXX setting or must you set the the Calculate.XXXX setting on (State == State.Realtime)

    #2
    Hello cutzpr,

    It is always recommended that the hosted child script should have the same Calculate setting as the host parent script.

    This is correct that NinjaTrader will override this if set in OnStateChange when the State is SetDefaults or Configure.

    Setting this when the State is Historical would allow the hosted script to have an independent calculate setting.


    Returning in OnBarUpdate would not affect the Calculate setting.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rocketman7, Today, 01:00 AM
    0 responses
    1 view
    0 likes
    Last Post rocketman7  
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    27 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 04-23-2024, 09:53 PM
    2 responses
    74 views
    0 likes
    Last Post wzgy0920  
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    193 views
    0 likes
    Last Post Hasadafa  
    Working...
    X