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 kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    28 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    17 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    24 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    137 views
    0 likes
    Last Post SalmaTrader  
    Working...
    X