Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to acquire ext price at target

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

    Unable to acquire ext price at target

    Once an ATM controlled strategy goes flat because it hit a target, it does not seem to be possible to find out the exit price. The following code gives an error message
    string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET1", atmStrategyIdn[lim]);

    // Check length to ensure that returned array holds order information
    if (orders.Length > 0)
    {
    for (int i = 0; i < orders.GetLength(0); i++)
    {
    Print(CurrentBar + " upOrdS Target Status" +
    " target fill price is " + orders[i, 0].ToString() +
    " Qty " + orders[i, 1].ToString() +
    " state is " + orders[i, 2].ToString());
    }
    }
    Is there a workaround?
    Last edited by roland_nt; 03-30-2014, 11:55 PM.

    #2
    Hi Roland, you are correct this is a current known limitation, once the ATM strategy is terminated there would be no way to access this info.

    Comment


      #3
      I'm capturing EntryPrice,EntryBar, ExitPrice,ExitBar. This has been running for a week OK, If the entry and exit occur on the same bar the code needs to run in OnMarketData(), if it can be guaranteed the entry and exit occur on separate bars then OnBarUpdate() is OK. I'm running 1 Order / Strategy, if you use multiple Orders/Strategy the approach should still work but coding would be more complicated.

      psuedoCode
      At OrderCreate
      {
      EntryPrice=0,EntryBar=0,ExitPrice=0,ExitBar=0
      }
      if(EntryBar=0){
      if(MarketPosition(StrategyId) !=Flat && GetAtmEntryOrderStatus(OrderId)==Filled) // Trade was filled this (Bar/Tick)
      { // Capture Entry Info
      EntryBar=CurrentBar;
      EntryPrice=GetAtmEntryOrderStatus; // Like your code
      }
      }
      if(ExitBar=0){
      if(MarketPosition(StrategyId) ==Flat && GetAtmEntryOrderStatus(OrderId)==Filled) // Trade was exited this (Bar/Tick)
      {
      ExitBar=CurrentBar;
      ExitPrice=Calculate Based on( Entryprice above plus GetAtmRealizedPnL)
      }
      }

      Comment


        #4
        Finding exit price of closed ATM strategy

        Very clever:
        Use entry price (which is known) and add realized PNL to it.
        Brilliant tquinn..
        A real head slapper.
        Thank you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X