Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetState(State.Terminated) does not disable the strategy on the Strategies window

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

    SetState(State.Terminated) does not disable the strategy on the Strategies window

    I am using NT 8 beta 11. I have code to disable the strategy if certain conditions are not met.

    The sample code are as followed:

    protected override void OnBarUpdate()
    {
    if (State == State.Historical)
    return;

    if (entryOrder == null && ToTime(Time[0]) >= 90000)
    {
    if (GetCurrentBid() > 50
    && GetCurrentBid() <51
    && longEnabled == true)
    { // Go Long
    entryOrder = EnterLong (1,Name);

    //Print("JQ OnBarUpdate entryOrder = " + entryOrder);
    }
    else
    if (GetCurrentAsk() < ShortMaxEntry
    && GetCurrentAsk() > ShortMinEntry
    && shortEnabled == true)
    // Go Short
    entryOrder = EnterShort (1,Name);
    else
    {
    SetState(State.Terminated);
    Print("Condition not met. Disabling " + Name + " Strategy" + " " + State + " " + ToTime(Time[0]));
    }

    }

    The SetState code does fires and the "Enabled" checkbox does get unchecked, however, when I go to edit the strategy, I get the following message:

    Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


    A sample video of this is provided below:

    Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


    Can someone let me know if this is a bug in NT 8 beta 11 or is my code incorrect to disable the strategy?

    #2
    Hello hotsalami,

    Thank you for writing in.

    I was able to reproduce this on my end and will be submitting this as a bug report to our development team. Thank you very much for catching this!

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by zstheorist, Today, 07:52 PM
    0 responses
    3 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    149 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Working...
    X