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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    47 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X