Support Board
Date/Time: Thu, 13 Feb 2025 02:44:20 +0000
Post From: sc.MaximumPositionAllowed no longer works from sc.SetDefaults block
[2020-11-14 22:47:02] |
ForgivingComputers.com - Posts: 1001 |
So I should not have any issues with this: #include "sierrachart.h"
SCDLLName("Custom Study DLL") SCSFExport scsf_TemplateFunction(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName = "Template Function"; sc.AutoLoop = 1; //Automatic looping is enabled. sc.MaximumPositionAllowed = 4; return; } s_SCPositionData PositionData; sc.GetTradePosition(PositionData); if (PositionData.PositionQuantity == 0) { s_SCNewOrder NewOrder; NewOrder.OrderQuantity = 4; NewOrder.OrderType = SCT_ORDERTYPE_MARKET; int result = sc.BuyEntry(NewOrder); } } Yet I get this with v2192: Auto-trade: Replay 60X: NQZ20-CME[M] 1 Min #1 | Template Function | BuyEntry | Bar start date-time: 2020-11-09 00:14: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: 4. Resulting Position with all working orders except exits: 4. Resulting Position with Market working orders: 4 | 2020-11-14 16:40:05.883
There is no issue if the sc.MaximumPositionSize = 4; statement is after SetDefaults, or if I use v2092. |
![]() Attachment Deleted. |