Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged Order Exit Question

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

    Unmanaged Order Exit Question

    Can someone tell me why this line of codewith the specific line of CurrentBar >myentrybar + 15 is causing no exits?

    All of the code is located within BarsInProgress =0; , Primary chart data is 1 minute

    Code:
    if (Position.MarketPosition == MarketPosition.Long && entryOrder != null && entryOrder.Token != null && entryOrder.OrderState == OrderState.Filled && CurrentBar > myentrybar+15 && trailx == null && yox == null && profitx == null)
    				{
    					trailx = SubmitOrder(1,	OrderAction.Sell,	OrderType.Limit,	entryOrder.Quantity  , myhigh1[0] - trailvar2,0,	"2",	"TRAIL Long"	);	 	
    					//yox =	 SubmitOrder(0,	OrderAction.Sell, 	OrderType.Stop,		entryOrder.Quantity, 0, yostop,		"2",	"Yo Long");  
    					//profitx =	SubmitOrder(0,OrderAction.Sell,OrderType.Limit,Position.Quantity  	,entryOrder.AvgFillPrice+profitvar2,0,"2", "PROFIT Long "); 				
    				}
    I am trying to delay the exits by one, fifteen minute bar, or in other words 15 one min bars.

    #2
    neb1998, it would cause the absense of exits when the condition to do so is not triggering as you expect - are the involving variables print as you imagine?

    Also, on NT7 you would not need to use the token anymore, you can compare the IOrders directly now for equality.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    475 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    316 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    253 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    340 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    305 views
    0 likes
    Last Post CarlTrading  
    Working...
    X