Support Board
Date/Time: Sun, 22 Dec 2024 15:05:06 +0000
Post From: ACSIL SCT_ORDERTYPE_TRAILING_STOP example needs updating
[2015-08-12 23:02:51] |
bjohnson777 (Brett Johnson) - Posts: 284 |
I'm having a bad health week, so sorry for the sluggishness of the responses. I did some testing yesterday and notice that sc.BuyExit/sc.SellExit will cancel any previous entries made by them. Can that behavior be updated in the documentation? I kept wondering why both orders would be accepted, but the first would always be immediately cancelled. Nothing showed up in the trade or message logs. Can y'all modify sc.BuyExit/sc.SellExit to allow for 2 exit orders? One would be above the price line and the other below. This would be for take profit and safety stop setup. Having the functions still automatically cancel their last above or below matching order would make updates simple. I set up a function to temporary disable the blocking variables. For those running into the same problem I have, here's the code. Place it above the scsf_ function. //Disable or enable blocking variables.
void SetBlockingVariables(SCStudyInterfaceRef sc, int Status) { if(Status > 0) { //safety on sc.AllowOnlyOneTradePerBar = true; sc.AllowMultipleEntriesInSameDirection = false; sc.AllowEntryWithWorkingOrders = false; sc.AllowOppositeEntryWithOpposingPositionOrOrders = false; sc.CancelAllOrdersOnEntriesAndReversals = true; } else { //safety off sc.AllowOnlyOneTradePerBar = false; sc.AllowMultipleEntriesInSameDirection = true; sc.AllowEntryWithWorkingOrders = true; sc.AllowOppositeEntryWithOpposingPositionOrOrders = true; sc.CancelAllOrdersOnEntriesAndReversals = false; } } //end SetBlockingVariables Usage is: //Turn them off.
SetBlockingVariables(sc, 0); //order code goes here //Turn them back on. SetBlockingVariables(sc, 1); I have concerns about disabling safeties, but I need to be moving forward on this program. I've identified a possible race condition in the program I'm working on. I'll handle that separately. |