Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What overload to use?

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

    What overload to use?

    Hi,

    I'm using a primary bar series which is a Range bar, and a secondary series which is 1 minute bars. I've added this code:

    Code:
    if(BarsInProgress == 1)
    				{
    					if(ToTime(Time[0])>=eodExitTime)
    										{
    										ExitShort();
    										ExitLong();
    										Print("forced exit on bars series 2");
    										}	
    				}
    The output window is showing the print statement, so I'm guessing there is some other overload for the ExitShort and ExitLong's; as the output window shows this:

    "5/10/2012 11:09:00 PM Entered internal PlaceOrder() method at 5/10/2012 11:09:00 PM: BarsInProgress=1 Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
    5/10/2012 11:09:00 PM Ignored PlaceOrder() method: Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' Reason='This was an exit order but no position exists to exit'"

    Yet, a position was actually held at the time.

    #2
    coolmoss,

    If you call both exit orders here it will ignore at least one of them. You could eliminate this if you check if you are in a long or short position before calling either method.

    if (Position.MarketPosition == MarketPosition.Short)
    {
    ExitShort();
    }
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Adam,

      I found out that ToTime is a bit different for multi bars scripts. I changed it to ToTime(Times[1][0]) and things seem to work now.

      Just sharing this to complete the thread if anyone else comes across this thread with similar problem.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      647 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X