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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      59 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X