Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dynamically changing CalculateOnBarClose

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

    Dynamically changing CalculateOnBarClose

    Is it possible to dynamically change COBC in Initialize() when a strategy is refreshed? Such as,

    private OrderType oType = OrderType.Limit;

    protected void Initialize()
    {
    if(OType == OrderType.Limit)
    CalculateOnBarClose = true;
    else if(OType == OrderType.StopLimit)
    CalculateOnBarClose = false;
    }

    And if not, can it be changed in OnBarUpdate() such as:

    protected void Initialize()
    {
    CalculateOnBarClose = false;
    }

    protected void OnBarUpdate()
    {
    if(OType != OrderType.StopLimit && CalculateOnBarClose == false)
    {
    CalculateOnBarClose = true;
    return;
    }
    else if(OType == OrderType.StopLimit && CalculateOnBarClose == true)
    {
    CalculateOnBarClose = false;
    }
    Last edited by snaphook; 01-13-2009, 06:46 AM.

    #2
    Hi snaphook, unfortunately setting this dynamically is not supported. However you can for sure try calling and setting it again as you outlined in your code.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    26 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, Yesterday, 09:53 PM
    2 responses
    49 views
    0 likes
    Last Post wzgy0920  
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    192 views
    0 likes
    Last Post Hasadafa  
    Started by GussJ, 03-04-2020, 03:11 PM
    11 responses
    3,235 views
    0 likes
    Last Post xiinteractive  
    Working...
    X