Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

in 2 equal IF() did't run second action

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

    in 2 equal IF() did't run second action

    Good day.
    Give advice, please.
    I have code with 2 equal IF() and different action.
    Second action never runs.
    What can I do?

    Code:
    //8.30 - 13.30 LONG
    if (numberOfBars > 14 && 
    Position.MarketPosition == MarketPosition.Flat &&
    ToTime(Time[0]) >= 083000  && 
    ToTime(Time[0]) <= 133000) 			
    { 
        SetProfitTarget("", CalculationMode.Ticks, PT);
        SetStopLoss("", CalculationMode.Ticks, SL, false);
        EnterLongStop(N, V_line+3*TickSize, "");
    }	
    		
    //8.30 - 13.30 SHORT
    if (numberOfBars > 14 && 
    Position.MarketPosition == MarketPosition.Flat &&
    ToTime(Time[0]) >= 083000  && 
    ToTime(Time[0]) <= 133000)	
    { 
        SetProfitTarget("", CalculationMode.Ticks, PT);
        SetStopLoss("", CalculationMode.Ticks, SL, false);
        EnterShortStop(N, N_line-3*TickSize, "");
    }

    #2
    Same thing if to code like this:

    Code:
    if (numberOfBars > 14 && 
    Position.MarketPosition == MarketPosition.Flat &&
    ToTime(Time[0]) >= 083000  && 
    ToTime(Time[0]) <= 133000) 			
    { 
        SetProfitTarget("", CalculationMode.Ticks, PT);
        SetStopLoss("", CalculationMode.Ticks, SL, false);
        EnterLongStop(N, V_line+3*TickSize, "");
        EnterShortStop(N, N_line-3*TickSize, "");

    Comment


      #3
      Hello,
      Due to the Order Handling Rules for Managed Approached orders this is expected as you would not be able to submit an EnterLongStop() and EnterShortStop() at the same time.For more information on the Order Handling Rules for Managead orders please see the following link: http://ninjatrader.com/support/helpG...d_approach.htm To achieve what you are wanting to do you would need to use Unmanaged orders. For information on using Unmaganed Orders please see the following link: http://ninjatrader.com/support/helpG...d_approach.htm
      Cody B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      56 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X