Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 15:04:44 +0000



Multiple Limit Order Entries in Both Directions

View Count: 693

[2017-03-13 15:27:04]
Gary Lockwood - Posts: 16
I'm writing an automated trading system that puts out limit orders in both directions at certain levels, but am having issues getting more than one of the s_SCNewOrder's to start working on the chart. Below is the code associated with my Orders. I'm sorry if this question has already been answered, but I couldn't find an answer anywhere. Thank you.

s_SCNewOrder Upper1Order; s_SCNewOrder Upper2Order; s_SCNewOrder Upper3Order; s_SCNewOrder Upper4Order;
  s_SCNewOrder Lower1Order; s_SCNewOrder Lower2Order; s_SCNewOrder Lower3Order; s_SCNewOrder Lower4Order;

  Upper1Order.OrderQuantity = Entry1Size.GetInt();
  Upper2Order.OrderQuantity = Entry2Size.GetInt();
  Upper3Order.OrderQuantity = Entry3Size.GetInt();
  Upper4Order.OrderQuantity = Entry4Size.GetInt();
  Lower1Order.OrderQuantity = Entry1Size.GetInt();
  Lower2Order.OrderQuantity = Entry2Size.GetInt();
  Lower3Order.OrderQuantity = Entry3Size.GetInt();
  Lower4Order.OrderQuantity = Entry4Size.GetInt();

  Upper1Order.OrderType = SCT_ORDERTYPE_LIMIT;
  Upper2Order.OrderType = SCT_ORDERTYPE_LIMIT;
  Upper3Order.OrderType = SCT_ORDERTYPE_LIMIT;
  Upper4Order.OrderType = SCT_ORDERTYPE_LIMIT;
  Lower1Order.OrderType = SCT_ORDERTYPE_LIMIT;
  Lower2Order.OrderType = SCT_ORDERTYPE_LIMIT;
  Lower3Order.OrderType = SCT_ORDERTYPE_LIMIT;
  Lower4Order.OrderType = SCT_ORDERTYPE_LIMIT;

  Upper1Order.Price1 = UpperLine1;
  Upper2Order.Price1 = UpperLine2;
  Upper3Order.Price1 = UpperLine3;
  Upper4Order.Price1 = UpperLine4;
  Lower1Order.Price1 = LowerLine1;
  Lower2Order.Price1 = LowerLine2;
  Lower3Order.Price1 = LowerLine3;
  Lower4Order.Price1 = LowerLine4;

  Upper1Order.Target1Price = (float)YellowLine;
  Upper2Order.Target1Price = UpperLine1;
  Upper3Order.Target1Price = UpperLine2;
  Upper4Order.Target1Price = UpperLine3;
  Lower1Order.Target1Price = (float)YellowLine;
  Lower2Order.Target1Price = LowerLine1;
  Lower3Order.Target1Price = LowerLine2;
  Lower4Order.Target1Price = LowerLine3;

  Upper1Order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
  Upper2Order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
  Upper3Order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
  Upper4Order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
  Lower1Order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
  Lower2Order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
  Lower3Order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
  Lower4Order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;

  Upper1Order.AttachedOrderStopAllType = SCT_ORDERTYPE_STOP;
  Upper2Order.AttachedOrderStopAllType = SCT_ORDERTYPE_STOP;
  Upper3Order.AttachedOrderStopAllType = SCT_ORDERTYPE_STOP;
  Upper4Order.AttachedOrderStopAllType = SCT_ORDERTYPE_STOP;
  Lower1Order.AttachedOrderStopAllType = SCT_ORDERTYPE_STOP;
  Lower2Order.AttachedOrderStopAllType = SCT_ORDERTYPE_STOP;
  Lower3Order.AttachedOrderStopAllType = SCT_ORDERTYPE_STOP;
  Lower4Order.AttachedOrderStopAllType = SCT_ORDERTYPE_STOP;

  Upper1Order.StopAllPrice = RedLineSubgraph[sc.Index] + (RedLineSubgraph[sc.Index] - BlueLineSubgraph[sc.Index]) * StopPerc.GetDouble();
  Upper2Order.StopAllPrice = RedLineSubgraph[sc.Index] + (RedLineSubgraph[sc.Index] - BlueLineSubgraph[sc.Index]) * StopPerc.GetDouble();
  Upper3Order.StopAllPrice = RedLineSubgraph[sc.Index] + (RedLineSubgraph[sc.Index] - BlueLineSubgraph[sc.Index]) * StopPerc.GetDouble();
  Upper4Order.StopAllPrice = RedLineSubgraph[sc.Index] + (RedLineSubgraph[sc.Index] - BlueLineSubgraph[sc.Index]) * StopPerc.GetDouble();
  Lower1Order.StopAllPrice = BlueLineSubgraph[sc.Index] - (RedLineSubgraph[sc.Index] - BlueLineSubgraph[sc.Index]) * StopPerc.GetDouble();
  Lower2Order.StopAllPrice = BlueLineSubgraph[sc.Index] - (RedLineSubgraph[sc.Index] - BlueLineSubgraph[sc.Index]) * StopPerc.GetDouble();
  Lower3Order.StopAllPrice = BlueLineSubgraph[sc.Index] - (RedLineSubgraph[sc.Index] - BlueLineSubgraph[sc.Index]) * StopPerc.GetDouble();
  Lower4Order.StopAllPrice = BlueLineSubgraph[sc.Index] - (RedLineSubgraph[sc.Index] - BlueLineSubgraph[sc.Index]) * StopPerc.GetDouble();

  ////////////////////////////////////////////

  if (LongEnabled.GetYesNo())
  {
    sc.BuyEntry(Lower1Order);
    sc.BuyEntry(Lower2Order);
    sc.BuyEntry(Lower3Order);
    sc.BuyEntry(Lower4Order);
  }

  if (ShortEnabled.GetYesNo())
  {
    sc.SellEntry(Upper1Order);
    sc.SellEntry(Upper2Order);
    sc.SellEntry(Upper3Order);
    sc.SellEntry(Upper4Order);
  }

[2017-03-13 17:39:51]
Sierra Chart Engineering - Posts: 104368
To determine the reason for the order submissions being ignored, you need to follow through the instructions here:
http://www.sierrachart.com/index.php?page=doc/ACSILTrading.html#DebuggingTradingSystems

Also make sure you are using unmanaged automated trading.

Refer to:
http://www.sierrachart.com/index.php?page=doc/AutoTradeManagment.php#UnmanagedAutomatedTrading
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2017-03-13 17:40:32

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account