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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        58 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        133 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X