Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy for exits only not working

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

    Strategy for exits only not working

    I manually enter trades and created a strategy that helps me automatically exit them.

    My code is fairly simple but nothing happens even if the conditions are met
    Code:
    double level0;
    double level1;
    
    if ((level0 < level1)
    && (Close[0] < Close[1])
    )
    {
    
    ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
    }
    )

    I printed out the level0 & level1 to verify and the data all looks correct.
    I checked the Output window and didnt see any exits being sent.
    The strategy runs in Volumetric chart if it matters and I have already set the bar type as Volumetric
    Code:
     NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = Bars.BarsSeries.BarsType as
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
    
    if (barsType == null)
    return;
    Any ideas on what I can do?

    #2
    Hi Ousher, thanks for writing in. Use print within the condition block to see if the Exit order is being hit:


    if ((level0 < level1) && (Close[0] < Close[1]) )
    {
    Print("Processing Exit");
    ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
    }

    If you do see this and there is no exit then turn on Trace Orders in State.SetDefaults and look to the output window again after the exit order gets hit. It will show you any information about ignored orders.

    Kind regards,
    -ChrisL

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hi Ousher, thanks for writing in. Use print within the condition block to see if the Exit order is being hit:


      if ((level0 < level1) && (Close[0] < Close[1]) )
      {
      Print("Processing Exit");
      ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
      }

      If you do see this and there is no exit then turn on Trace Orders in State.SetDefaults and look to the output window again after the exit order gets hit. It will show you any information about ignored orders.

      Kind regards,
      -ChrisL
      Hi,

      i added the print line but the output is not showing any ignored orders being sent, anything else I can try?

      Comment


        #4
        Hi Ousher, thanks for your reply. Do you see the print right next to the exit order or do you not see the print? I mentioned two things in my first reply. 1. Adding a print right next to the exit order and seeing if it prints out and 2. If you do see the print and the exit did not work, turn on Trace Orders. The Trace Orders will display ignored orders. See here for a list of reasons why an order might be ignored and see if your strategy is hitting one of these rules:


        Kind regards,
        -ChrisL

        Comment

        Latest Posts

        Collapse

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