Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order opening

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

    Order opening

    Hi,

    sorry, i have a new question:
    If a strategy has already opened an order, how I can avoid it open a second order?

    Example:

    1 step) The close of a bar exceeds an moving average "X" and my strategy start a long order…OK!
    2 step) The next bar close again falls a little below the moving average "X”, but don’t take the stop.
    3 step) The third bar close again above the moving average "X", but I don’t want that the strategy again start a second long order… HOW DO?

    Thank you for your answer
    germano

    #2
    Hello,

    Take a look at the code below and add the proper criteria for you. This is very basic. There are more accurate but much more complicated ways to do it here:
    The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()



    if(time_to_trade && EMA(5)[0] > EMA(18)[0] )
    {
    EnterLong();
    time_to_trade =
    false;
    }


    if (EMA(5)[0] < EMA(18)[0] && time_to_trade == false)
    {
    ExitLong();
    time_to_trade =
    true;
    }
    DenNinjaTrader Customer Service

    Comment


      #3
      Thanks yet Ben

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      574 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X