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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    105 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    53 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    35 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    38 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    74 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X