Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Exit an entering position

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

    Exit an entering position

    I couldn't find anything explaining the question therefor I started a new thread. Well lets go ..

    Say I have an enter position like

    Code:
    limit = 2;
    stop = 1,15
    EnterLongStopLimit(BarsInProgress, true, 999999, limit, stop, "EnterLong");
    And it started to get partial filled as expected (but it does not filled up all the way), them the market turn and i want to exit the position, but the market didn't reached my limit target and i didn't cancel the enter position but place something like the following command

    Code:
    limit = 1,15;
    stop = 2;
    ExitLongStopLimit(BarsInProgress, true, FilledQuantity, limit, stop, "ExitLong", "EnterLong");
    Keep in mind that i set the FilledQuantity variable with the quantity orders the enterlong has reached till the time i set the enterlongstoplimit ...

    1) Will enterLong stop getting filled for i placed an exitlong tied to it by the bind signal (signalName in documentation of EnterLong function and "EnterLong" string in the samples above)?
    1.a) If the answer is NO what is the signalName purpose?

    2) If i want to exit a partial filled position i should cancel the enterlong to prevent it to enter further and place an exitlong. And even thought the enterlong was canceled i should bind the exitlong to the enterlong using the signalName, is it?

    3) As I didn't cancel the enterlong it would enter a little more, therefor, as "i set the FilledQuantity variable with the quantity orders the enterlong has reached till the time i set the enterlongstoplimit" by the time the exitlong reaches filled I'll find myself with some orders yet to exit?

    4) If i do cancel the enterlong before place the exitlong should i got any warning or error message because i place an exitlong bonded to the canceled enterlong?

    thanks

    #2
    Hello rstriquer,

    Thank you for your patience.

    1. The Enter method would remain and continue to be filled.
    1. a. The signalName ties the entry to the position it creates.
    2. You would need to use CancelOrder() to cancel the order if you do not want it to remain and continue to fill orders as in number 1.
    3. Correct, unless you implemented logic that would account for the remaining open quantity.
    4. No, there would be no error message. As in 1. a., the signalName would tie the exit to the position created by the entry.

    Please let me know if you have any questions.

    Comment


      #3
      ok, another questions ...

      Lets say I got a partial filled order and cancel the enterlongstoplimit ...
      1) Can i resubmit it with another stop/limit parameters different of those i set when i call enterlongstoplimit?

      2) If i resubmit, when it got back to me with "Accepted" status (or some alike) will it start as new and lose the filled/AvgFillPrice
      information I had before i cancel the order or will it keep the information and complement with new filled orders?

      3) I finished the enterlongstoplimit with 10 entered orders and placed a exitlongstoplimit with 10 as quantity. I got 2 exit orders filled and the market changed, I want to do a simple exitlong therefor i resubmit the order, I saw it losses the filled information, is there a table, array or method i could retrieve the order history information?

      Comment


        #4
        Hello rstriquer,

        Thank you for your response.

        1. Yes. Just submit a new EnterLongStopLimit() with the desired parameters.
        2. The Average Fill Price is the average of all fills. So the new fill and the previous would be factored into the Average Fill Price.
        3. I would use Position.Quantity: http://ninjatrader.com/support/helpG...7/quantity.htm

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sidlercom80, 10-28-2023, 08:49 AM
        166 responses
        2,233 views
        0 likes
        Last Post sidlercom80  
        Started by thread, Yesterday, 11:58 PM
        0 responses
        1 view
        0 likes
        Last Post thread
        by thread
         
        Started by jclose, Yesterday, 09:37 PM
        0 responses
        6 views
        0 likes
        Last Post jclose
        by jclose
         
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        10 responses
        1,414 views
        0 likes
        Last Post Traderontheroad  
        Started by firefoxforum12, Yesterday, 08:53 PM
        0 responses
        11 views
        0 likes
        Last Post firefoxforum12  
        Working...
        X