Login Page - Create Account

Support Board


Date/Time: Thu, 16 Jan 2025 02:53:06 +0000



Post From: SC Function to find trade position

[2017-09-27 16:42:23]
User203925 - Posts: 40
Main objective is to have a strategy that has a triggered trailing stop to reverse when criteria are met.

Question 1:
Do I have to have sc.AllowMultipleEntriesInSameDirection set to true to make this happen?
Here is the code that launches my triggered trailing stop

if (sc.BaseData[SC_LAST][sc.Index - 1] < b_TradeTarget && sc.BaseData[SC_LAST][sc.Index] >= b_TradeTarget && ExistingOrder.Price1 != b_TrailStop) {

      b_TrailStop = b_TradeTarget - (TrailStopOff.GetInt() *sc.TickSize);

      NewOrder.OrderQuantity = OrderQuantity.GetInt();
      NewOrder.OrderType = SCT_ORDERTYPE_TRIGGERED_TRAILING_STOP_3_OFFSETS;
      NewOrder.Price1 = b_TrailStop;// Stop price
      NewOrder.Price2 = b_TradeTarget;// Trail trigger price
      NewOrder.TimeInForce = SCT_TIF_DAY;
      int Result = sc.SellEntry(NewOrder);

    }
  }


Question 2:
If sc.AllowMultipleEntriesInSameDirection has to be set to true, what is the best function to determine 1. The strategy is in a trade and 2. The direction of the trade? I am using sc.GetOrderByIndex(EntryID, ExistingOrder) and (ExistingOrder.BuySell == BSE_SELL / Buy) functions to determine the direction of the trade but multiple entries still exist.