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:

    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


    A sample video of this is provided below:

    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


    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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X