Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy opens a null order

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

    Strategy opens a null order

    Hi i have a strategy that opens a null limit order and i dont know how to debug it and dont understand why it is doing it.

    my Entry condition

    Code:
    if(shortPrice <= GetCurrentBid() && entryOrderS == null && profitTargetS == null && stopLossS == null)
                    {
                    entryOrderS        = placeHolderOrderS;
                    suppressOcoS    = false;
                    EnterShortStopMarket(0,true, PositionSize, shortPrice,"MyEntryShort");
                        
                    }​
    As soon as I enter I print entryOrder
    Print("entryOrder"+entryOrder);

    and iN output I get null entryorder entryOrder and order seems like staying in strategy and not taking more trades. Usually strategy takes order and prints full order details but sometimes i get this.




    #2
    Hello tkaboris,

    The code you provided does not contain a variable named entryOrder and I also don't see your print included in that code.

    To assign an order to a variable you would need to use OnOrderUpdate, you can see an example of that concept in the help guide link below.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    47 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X