Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop strategy from running

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

    Stop strategy from running

    The coding belows works just fine to have a strategy close positions and stop running, but it still shows as an active strategy under the Strategies Tab.
    Shouldn't it drop out of there?
    Jim

    // This will exit the strategy immediately after 12:00PM EST

    if (ToTime(Time[0]) > ToTime(12,00,00)&& ToTime(Time[0]) < ToTime(8,00,00 ))
    {
    ExitLong(
    "lg8AM3");
    ExitShort(
    "sht8AM3");
    }

    }

    privatevoid StopStrategy()
    {


    // If we have a position we will need to close the position
    if (Position.MarketPosition == MarketPosition.Long)
    ExitLong(
    "lg8AM3");
    elseif (Position.MarketPosition == MarketPosition.Short)
    ExitShort(
    "sht8AM3");
    }

    #2
    No since the strategy is still active.
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    62 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    33 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    44 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    58 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    47 views
    0 likes
    Last Post CarlTrading  
    Working...
    X