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 PaulMohn, Today, 12:36 PM
    2 responses
    16 views
    0 likes
    Last Post PaulMohn  
    Started by Conceptzx, 10-11-2022, 06:38 AM
    2 responses
    53 views
    0 likes
    Last Post PhillT
    by PhillT
     
    Started by Kaledus, Today, 01:29 PM
    0 responses
    4 views
    0 likes
    Last Post Kaledus
    by Kaledus
     
    Started by yertle, Yesterday, 08:38 AM
    8 responses
    37 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Started by rdtdale, Today, 01:02 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X