Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 12:39:27 +0000



Post From: ASCIL strategy trades will not reverse positions

[2021-01-22 20:24:07]
User566913 - Posts: 39
Where would I put this code?
....
....
// Check if there is an actual position, if not return

s_SCPositionData PositionData;

sc.GetTradePosition(PositionData);

if (PositionData.PositionQuantity == 0)

return;
.....
.....
.....
.....
.....
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
  /* Buy Order Function */
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

  if (RecentBidVolume > RecentAskVolume)
  {
    int Result = (int)sc.BuyOrder(NewOrder);
    if (Result > 0) //If there has been a successful order entry, then draw an arrow at the low of the bar.
    {
      Subgraph_BuyEntry[sc.Index] = sc.Low[sc.Index];

      // Remember the order IDs for subsequent modification and cancellation
      Target1OrderID = NewOrder.Target1InternalOrderID;
      Stop1OrderID = NewOrder.Stop1InternalOrderID;
    }
  }

/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
  /* Sell Order Function */
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

if (RecentAskVolume > RecentBidVolume)
  {
    int Result = (int)sc.SellOrder(NewOrder);
    if (Result > 0) //If there has been a successful order entry, then draw an arrow at the high of the bar.
    {
      Subgraph_SellOrder[sc.Index] = sc.High[sc.Index];

      // Remember the order IDs for subsequent modification and cancellation
      Target1OrderID = NewOrder.Target1InternalOrderID;
      Stop1OrderID = NewOrder.Stop1InternalOrderID;
    }
  }