Create a text file named ExtStrategies-YYMMDD.txt inside the Spark\ORDERS folder (.e.g. if today is Dec 10, 2015, the file name will be Spark\ORDERS\ExtStrategies-151210.txt)
[Protocol] Name=External Strategies File Version=1.00 Description=External Strategies File [Strategies] [Modify Strategies] [Delete Strategies]
To add a new Barrier strategy, add a new line under [Strategies]
20151510-001=Type=BARRIER~Product ID=HSIZ5~Is Simulation=FALSE~Is Bullish=NO~Barrier=21770~Take Profit Adj=20~Stop Loss Adj=40~Not Filled Cancel Seconds=55~Quantity=-1~Open Toler=-40~Close Toler=4~Start Time 1=09:15:00~End Time 1=11:57:00~Force Close Time 1=11:58:00~Start Time 2=15:58:00~End Time 2=16:10:00~Force Close Time 2=16:12:00~Start Time 3=23:25:00~End Time 3=23:30:00~Force Close Time 3=23:40:00~After Loss Wait Seconds=300~After Profit Wait Seconds=60
The above is a very long line, make sure you drag to the right most to see all of it. The blue part is a unique ID you give this strategy. The ~ symbol is a separator between each field. Each field is in the format of Field_Name=Field_Value
The field Type=BARRIER specifies the type of the strategy. Different types of strategies contains different fields. e.g.
For Barrier, this field means a bearish barrier strategy: "Is Bullish=NO"
Most strategies supports this field "Take Profit Adj=20" which means to place an OCO Stop Loss order of taking 20 points profit. The Stop Loss Level is specified by the field "Stop Loss Adj=40"
Copy Fields to Clipboard
There is a button "Copy Fields to Clipboard" in every strategy. Clicking it will copy the field values of the current strategy user controls to the clipboard, which you can then paste to add Strategy Text Control file. You can use it to learn the field names and format of this strategy.
Your program or Excel VBA can constantly read back the feedback file ExtStrategies_Feedback-YYMMDD.txt (e..g. Spark\ORDERS\ExtStrategies_Feedback-151210.txt )
[Protocol] Name=External Strategies Feedback File Version=1.00 Description=External Strategies Feedback File [Strategies] 20151509-009=[Feedback]~Status=Active~Status At=15-12-10 09:49:52.775~~
This file will be updated when Spark receives or rejects your new Strategy. If the new strategy is accepted, the feedback line will be like
20151509-009=[Feedback]~Status=Active~Status At=15-12-10 09:49:52.775~~
If the addition is rejected, an audio warning will be played and the feedback line will be like:
20151509-010=[Feedback]~Status=ERROR~Error=Cannot find Subscribed Ticker Product "HSIH6"~Status At=15-12-10 09:54:28.860~~
In the above example, the product code is HSIH6 which is not on the Spark Subscription List, so it cannot find it and rejected the new strategy.
If you want to modify the Barrier price level, add a line under [Modify Strategies] e.g. 001=ID=20151509-009~Barrier=21830
The blue part is a unique number that you give to each modification. Even it you are modifying the same strategy for the second time, you need to give a new unique number.
The modification will be shown in the feedback file, under [Strategies]
[Strategies] 20151509-009=[Feedback]~Status=Triggered Open~Status At=15-12-10 09:57:51.604~Modify History=001~~[Feedback-Open]~Order ID=2C5-095751.12709
Once an Open Order is triggered, you cannot modify the strategy fields except Take Profit Adj and Stop Loss Adj and Close Toler.
However, you can modify the open order via Spark User interface or External Order Control by specifying the Order ID given to you in the feedback.
To delete a strategy, add a line under [Delete Strategies] , put = after the Strategy ID. e.g.
[Delete Strategies] 20151509-009=
Check the feedback line of [Delete Strategies] for the deletion status
[Delete Strategies] 20151509-013=[Feedback]~Status=DELETED~Status At=15-12-10 15:28:39.841~~