Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 18:48:13 +0000



After SC update, automated strategy opens more contracts than allowed

View Count: 842

[2020-06-16 08:50:53]
User658577 - Posts: 3
Hello!

I was on SC version 2086 and was testing automated strategy without any problems. After I updated SC to latest version 2120, my strategy started opening 3, 4 or 6 contracts instead of 1. Same with 2122 version. My maximum allowed positions is set to 1. Why is this happening and how do I fix it? Thank you for your support!

Regards!
[2020-06-16 20:10:31]
Sierra Chart Engineering - Posts: 104368
We tested this and we cannot reproduce. These are the results:

Submitting a new order with a Position of 1 when 'Multiple Entries in Same Direction' is not enabled:

Auto-trade: Replay 15X: ESM20[M] 1 Min #1 | 202006 | BuyEntry | Bar start date-time: 2020-06-16 05:53:00.000 | BuyEntry signal is ignored because a Long position exists or working order quantities indicate a potential Long position, and 'Multiple Entries in Same Direction' is not enabled. Position: 1. Position with all working orders: 1. Position with Market working orders: 1 | 2020-06-16 16:05:05.181

Submitting an order with a quantity of 1 when there is a position of 1:

Auto-trade: Replay 15X: ESM20[M] 1 Min #1 | 202006 | BuyEntry | Bar start date-time: 2020-06-16 06:07:00.000 | BuyEntry signal is ignored because maximum Long Position quantity allowed has been reached or would be exceeded with new order. Max. Position allowed: 1. Resulting Position without working orders: 2. Resulting Position with all working orders except exits: 2. Resulting Position with Market working orders: 2 | 2020-06-16 16:05:59.906

Trying to use an order quantity of 3 from a flat position:

Auto-trade: Replay 15X: ESM20[M] 1 Min #1 | 202006 | BuyEntry | Bar start date-time: 2020-06-16 06:50:00.000 | BuyEntry signal is ignored because maximum Long Position quantity allowed has been reached or would be exceeded with new order. Max. Position allowed: 1. Resulting Position without working orders: 3. Resulting Position with all working orders except exits: 3. Resulting Position with Market working orders: 3 | 2020-06-16 16:08:52.569

Relevant documentation:
Automated Trading Management: MaximumPositionAllowed
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: 2020-06-16 20:12:33
[2020-06-17 08:22:13]
User658577 - Posts: 3
Fixed it by setting Signal Only Once Per Bar to Yes.

Thank you for your help!
[2020-09-19 00:23:37]
User681150 - Posts: 62
user. are you using spreadsheet trading? i dont see how to enable "Signal Only Once Per Bar" within ACSIL.... only in spreadsheet, is this correct?
[2020-09-19 14:14:38]
bradh - Posts: 854
i dont see how to enable "Signal Only Once Per Bar" within ACSIL

You could program this by setting a persistent integer flag that the signal has been generated, then check the next time to see that the flag is not set. Once the bar closes, or the trade is flattened, the flag can be reset.
[2020-09-19 20:58:52]
User681150 - Posts: 62
thanks Brad

im new to ascil. can you give me the line of code that would make this "persistent integer flag" and how to check if it is set etc? not exactly sure what it would look like. thanks
[2020-09-19 21:47:52]
bradh - Posts: 854

int& FirstSignal = sc.GetPersistentInt(1); // This will default to 0

if (FirstSignal == 0)
{
if (LongSignal)
{
// Enter Long trade code goes here

}
else if (ShortSignal)
{
// Enter Short trade code goes here

}
if (LongSignal || ShortSignal)
FirstSignal = 1;
}

// Reset flag when bar closes
if (FirstSignal == 1 && sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED)
FirstSignal = 0;


Date Time Of Last Edit: 2020-09-19 21:51:17
[2020-09-21 13:19:04]
User681150 - Posts: 62
makes sense when seen in code. thanks for the help

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

Login

Login Page - Create Account