Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategy ignore entershortlimitorder when im in long

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

    strategy ignore entershortlimitorder when im in long

    Hello I hope you doing well
    when im in longtrade i want to exit trade and make a limit order
    the strategy ignore limit order

    here is the code


    else if(((ab.ShortSignal[0] == 1 ) ) && !sell1 && BarsInProgress == 0 && Short && Position.MarketPosition != MarketPosition.Short){



    ExitLong("Buy1");

    ExitLong("Buy2");






    if(true ){

    if(GetCurrentBid() > c1[0]){



    // Stop Loss

    SetStopLoss("Sell1", CalculationMode.Price, GetCurrentBid() + isl*TickSize, false);

    SetStopLoss("Sell2", CalculationMode.Price, GetCurrentBid() + isl*TickSize, false);



    // Profit Target:


    SetProfitTarget("Sell1", CalculationMode.Price, GetCurrentBid() - tp1*TickSize);

    SetProfitTarget("Sell2", CalculationMode.Price, GetCurrentBid() - tp2*TickSize);


    EnterShort(q1,"Sell1");

    EnterShort(q2,"Sell2");

    }

    else{

    SetStopLoss("Sell1", CalculationMode.Price, c1[0] + isl*TickSize, false);

    SetStopLoss("Sell2", CalculationMode.Price, c1[0] + isl*TickSize, false);


    // Profit Target:

    SetProfitTarget("Sell1", CalculationMode.Price, c1[0] - tp1*TickSize);

    SetProfitTarget("Sell2", CalculationMode.Price, c1[0] - tp2*TickSize);



    EnterShortLimit(0, true, q1, c1[0], "Sell1");

    EnterShortLimit(0, true, q2, c1[0], "Sell2");

    }










    #2
    Hello ajgauss13,

    To understand why an order is ignored, enable TraceOrders and view the output in the output window.


    It does take time for orders to fill and for the position to change.
    If you would like to submit an exit and then submit a new entry, you will need to wait for the order to fill in OnExecutionUpdate() and send the new order from there.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    20 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    119 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X