Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

managing the order in backtest

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

    managing the order in backtest

    Hello
    newbie so please forgive for my obivious question.

    I am trying to back test a strategy.

    To place the order i am using the following command
    EnterLong(vNbContrat,type);
    ExitLongStop(vNbContrat,vStop, "stop initial", type);
    ExitLongLimit(vNbContrat/3, vObj1, "Objectif 1", type);

    the first line if ok but for the second and Third lines I am getting an error message
    " Ignored PlaceOrder() method: Action=BuyToCover OrderType=Stop Quantity=6 LimitPrice=0 StopPrice=3719,5 SignalName='stop intitial' FromEntrySignal='123R Baissier' Reason='This was an exit order but no position exists to exit'"

    In addition how can we modifiy an order (move the stop to the average price)

    If we have multiple exit points should we partially cancel the stoploss order, when the first goal is reached ?

    if the position is closed (stop loss or goal reached) should we remove all pending order in the code ?

    Many thanks in advance

    Lionel

    #2
    HI Lionel92,

    Thanks for posting.

    For your first question to the Log Error; You will need to have conditions for the exit orders. When the OnBarUpdate is called it will process all the code in the method. Since, the exit orders are called right after your entry, the program doesn't recognize any open positions until the next bar update.

    Alternatively, you can use the Set method, ProfitTarget and StopLoss, to create protective orders that can eventually close out a position and you can modify those methods by creating a condition that, when true, will change the SetStopLoss() and/or SetProfitTarget(). Below is a link to a reference sample that will show you how to modify the StopLoss and ProfitTarget.
    How to modify a StopLoss and ProfitTarget reference sample

    You can scale out of positions by using multiple unique entry signal names. There is a reference sample in our support forum that will show you how to scale in and out.
    Scaling out of a position reference sample

    If you want to cancel orders when a position is closed, when you submit StopLoss and ProfitTarget they are handled as OCO by the program and will cancel the other when one is filled.

    Please let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hello

      Many thanks for this prompt reply.

      Ok i have understood the basics, i should create several orders then i will have dedicated stop and profit orders

      Just for my understanding, if i use ExitLongStop and ExitLonglLmit orders are their automatically canceled when the position is closed ?

      Is it possible to Modifiy (cancelled and resubmit) those orders ?

      If i use setstoploss and setprofittarget, are the orders generated at the time or the initial order entry or dynamicaly generated by the platform when the conditions are reached. If it's the first case, how can i be sure that the change has been made ?

      Lionel
      Last edited by Lionel92; 04-24-2013, 10:08 AM.

      Comment


        #4
        Hi Lionel92,

        If your position is closed before the Exit() methods are reached, then they will be ignored by the program and will not submit exit orders.

        If you are referring to the Set orders and modifying them, you can modify those by changing the values of those. You can use the Price Modification sample below.
        http://www.ninjatrader.com/support/f...ead.php?t=3222

        Please let me know if I can be of further assistance.
        Cal H.NinjaTrader Customer Service

        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
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X