Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 22:38:32 +0000



Post From: Request for ASCIL Code

[2024-02-02 13:21:05]
emmanuel - Posts: 58
The position quantity is > 0 when there's a long position and < 0 when there's a short position. See Automated Trading From an Advanced Custom Study: s_SCPositionData Structure Members

Use: if (PositionData.PositionQuantity != 0)

`if (!ordersPlaced)` always returns false because the state of the `ordersPlaced` variable is not retained between invocations of the study function. Use a persistent variable instead: See Persistent Variable Functions


if (sc.SetDefaults)
{
...

// There are no bool persistent variables. Use an int.
int& ordersPlaced = sc.GerPersistentInt(1);
return;
}