Login Page - Create Account

Support Board


Date/Time: Sun, 28 Apr 2024 23:44:17 +0000



[Programming Help] - Trading System Based on Alert Condition

View Count: 5354

[2018-02-12 19:15:13]
User35525 - Posts: 179
It looks amazing but I'm having trouble generating trades with this sutdy. On the alerts tab, the only box checked is "Enabled", and the alert fires fine in the Alert Manager (TRUE is shown).

Trade-->Auto Trading Enabled - Global" is selected, but trades aren't generated, and "0.0" shows in the Tool Values Windows under "Buy" and "Sell".

The study itself has these settings: Yes, 1, Buy Entry, Yes, Yes, 2, 20, 20, Yes. I'm not sure where debugging output ends-up (the message log?).
[2018-02-13 03:24:43]
Sierra Chart Engineering - Posts: 104368
The debugging output is in the Trade >> Trade Service Log.

Also you must use prerelease 1700 for this study. You cannot use an earlier version.

We are going to put together step-by-step instructions for the study with a simple example.
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: 2018-02-13 03:25:09
[2018-03-01 14:08:07]
User35525 - Posts: 179
I updated from 1697 to 1708 yesterday and still have trouble with Trading System Based on Alert Condition.

There was an alert in Alert Manager (TRUE is shown) and Trade-->Auto Trading Enabled - Global" is enabled, but trades aren't generated.
Date Time Of Last Edit: 2018-03-01 14:10:08
[2018-03-01 22:20:59]
Sierra Chart Engineering - Posts: 104368
We can only refer you to this documentation:
Trading System Based on Alert Condition

Enabling and Disabling Automated Trading
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: 2018-03-01 22:21:09
[2018-03-01 22:35:36]
User35525 - Posts: 179
Thanks, I think this was a case of user-error as I had a check by Trade >> Disable Auto Trading on Startup.

Do you have an idea why my Trade Service Log would be nearly empty? It only contains this:

Trade Activity Log: File read result: 30574 records inserted. 5267 fill records inserted. 0 records filtered. | 2018-03-01 11:36:31
Trade Activity Log: File date-time limits: Sim records date-time limit is 2018-02-14 00:00:00. Non-sim records date-time limit is 2017-11-28 00:00:00. Non-sim fill record date-time limit is 2017-03-01 00:00:00. | 2018-03-01 11:36:31
CTS T4 FIX | Received LastRptRequested in execution report for account: <snip_accountname>. Inserting missing order fills. | 2018-03-01 11:37:06

[2018-03-01 23:45:08]
Sierra Chart Engineering - Posts: 104368
That is not unusual.

However, if the automated trading system is ignoring any order signals, the reason is going to be given in this Trade Service Log.

But be sure you have also enabled Enable Debugging Output with the study for more complete logging.
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: 2018-03-01 23:45:25
[2018-03-02 10:10:43]
User35525 - Posts: 179
I have enabled Enable Debugging Output, but the reason for the ignored alert isn't given in the Trade Service Log.

I've written ACSIL studies for systems in the past and those worked fine. Is the code for this study available so I can hack on it to maybe see why the alert is ignored per this example?:
Automated Trading From an Advanced Custom Study: Debugging/Troubleshooting Automated Trading Systems

The alert shows TRUE in Alert Manager >> Alerts Log (that is good), but no trade happens until I press "B" or "S" on my keyboard for a market buy or sell (my trading keyboard shortcuts). After attached orders close the trade, the Alert Manager shows an alert type called "Trading".

These are my Trading System Based on Alert System settings:

Enabled | Yes
Number of Bars to Calculate | 1
Order Action on Alert | Buy Entry
Evaluate on Bar Close Only | Yes
Send Trade Orders to Trade Service | Yes
Maximum Position Allowed | 1
Maximum Long Trades Per Day | 20
Maximum Short Trades Per Day | 20
Enable Debugging Output | Yes
Cancel All Working Orders On Exit | Yes
Allow Trading Only During Time Range | No
Start Time For Allowed Time Range | 00:00:00
End Time For Allowed Time Range | 00:00:00

Alerts TAB
Enabled | X
Reset Alert Condition on New Bar |
Alert Only Once per Bar |
Evaluate On Bar Close | X
Use Full Precision When Evaluating |
Log Evaluated Formula at Each Eval...|


Of course Trade >> Auto Trading Enabled (Chart) and Trade >> Auto Trading Enabled (Global) are set. Running SC 1708.
Date Time Of Last Edit: 2018-03-02 10:59:47
[2018-03-02 19:39:00]
Sierra Chart Engineering - Posts: 104368
Since you have Evaluate on Bar Close Only set to Yes, there would need to be a new bar added to the chart before you would get an order signal after initially adding the study to the chart.

Also in version 1710:
With the Trading System Based on Alert Condition study, the debugging output was incorrectly going to the main Message Log instead of the Trade Service Log as documented. This is now corrected. Also improved the logic with detecting state changes with the formula. The source code for this study is in the file: /ACS_Source/TradingSystemBasedOnAlertCondition.cpp

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: 2018-03-02 19:44:18
[2018-03-05 08:57:33]
User35525 - Posts: 179
This is the complete contents of Trade Service Log, which isn't showing anything about ignoring a trade:

Trade Activity Log: File read result: 30768 records inserted. 5279 fill records inserted. 0 records filtered. | 2018-03-03 17:23:41
Trade Activity Log: File date-time limits: Sim records date-time limit is 2018-02-16 00:00:00. Non-sim records date-time limit is 2017-11-30 00:00:00. Non-sim fill record date-time limit is 2017-03-03 00:00:00. | 2018-03-03 17:23:41

Here is a screenshot from Alert Manager >> Alerts Log showing the alert on the Alerts TAB is TRUE for the Trading System Based on Alert System study.

This was a sell signal so I pressed "S" on my keyboard for market short, and that keyboard shortcut worked immediately. Running SC 1711.
Date Time Of Last Edit: 2018-03-05 10:41:39
imageAlert_Manager.png / V - Attached On 2018-03-05 08:57:15 UTC - Size: 3.65 KB - 464 views
[2018-03-05 19:29:30]
Sierra Chart Engineering - Posts: 104368
Since you have Evaluate on Bar Close Only set to Yes, there would need to be a new bar added to the chart before you would get an order signal after initially adding the study to the chart.

We would have to go through this scenario carefully but there might not be any debugging message about this condition.
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: 2018-03-05 19:31:02
[2018-03-05 19:59:50]
User35525 - Posts: 179
I'm just not having any success with Trading System Based on Alert System.

Is it possible to create an alert mechanism that can trigger any existing keyboard shortcut via the Alerts TAB? That would be the best option for simple trading alerts, and also enable a powerful feature giving other actions besides only entry/exit. Such trigger would also set the focus back to the chart first per this thread:
ACSIL focus chart, Alert focus chart | Post: 130043
Date Time Of Last Edit: 2018-03-05 20:34:19
[2018-03-06 04:15:23]
Sierra Chart Engineering - Posts: 104368
This does not make sense. On the Trading System Based on Alert Condition, use this Alert Formula directly on that study itself:
1

When a new bar is added to the chart, there will be an order signal. And there is going to absolutely be logging as well if there is not.

You cannot possibly fail. The study works very reliably.
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: 2018-03-06 06:29:20
[2018-03-06 21:39:33]
User35525 - Posts: 179
Yes, the alert is on the Trading System Based on Alert Condition (the Alert TAB).

Also interesting, is the visual portion of this alert doesn't happen, but I see TRUE for the Trading System Based on Alert Condition alert in the Alert Manager (that was the screenshot in post #9). So the alert works, but the order doesn't happen, and nothing is logged. My settings are all in post #7.

So my Trading System Based on Alert Condition was setup to alert me visually in a unique way, but that didn't happen.
But I have another alert notify me visually and audibly (and that does happen). So maybe this complexity is part of the issue in my case, having two different alerts trigger TRUE on the same bar; one draws a pattern visually plus notifies me audibly (that works), while this Trading System Based on Alert Condition was directed to to draw a different visual pattern and place a trade order.

I have various patterns that may trigger audio/visual alerts (dots on the screen), and the Trading System Based on Alert Condition is supposed to change the background color and place a trade, but all it does is trigger TRUE in Alerts Manager, maybe because another alert was already triggered? I've never seen an issue having multiple alerts trigger concurrently, but somehow that sounds like a possible issue.
Date Time Of Last Edit: 2018-03-06 21:47:23
[2018-03-06 22:22:58]
Sierra Chart Engineering - Posts: 104368
OK we overlooked the obvious:

Number of Bars to Calculate | 1
Evaluate on Bar Close Only | Yes

This is never going to work. You need to calculate at least two bars.
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
[2018-03-15 23:40:43]
User35525 - Posts: 179
Is it possible to pay $80 to have somebody look at my chartbook?

My chartbook has one chart and two studies:
study ID1: Color bar based on alert condition, name "buy em", alert condition: C>C[-1]
study ID2: Trading System Based On Alert Condition, name "NOW ENTER LONG", alert condition: ID1.SG1=1

"Enabled" and "Evaluate On Bar Close" is checked on the alerts tab for both, plus I have an audio sound playing for "buy em" and selected "Log Evaluated Formula at Each Evaluation" for both so I can test for boolean =1 in Alert Manager.

The Trading System Based on Alert Condition settings:

Enabled | Yes
Number of Bars to Calculate | 2
Order Action on Alert | Buy Entry
Evaluate on Bar Close Only | Yes
Send Trade Orders to Trade Service | Yes
Maximum Position Allowed | 3
Maximum Long Trades Per Day | 2000
Maximum Short Trades Per Day | 2000
Enable Debugging Output | Yes
Cancel All Working Orders On Exit | Yes
Allow Trading Only During Time Range | No
Start Time For Allowed Time Range | 00:00:00
End Time For Allowed Time Range | 00:00:00

Alerts TAB
Enabled | X
Reset Alert Condition on New Bar |
Alert Only Once per Bar |
Evaluate On Bar Close | X
Use Full Precision When Evaluating |
Log Evaluated Formula at Each Eval...| X

Please see the attached "Alert_Manager_buyem.png" image. Running SC 1717.
Date Time Of Last Edit: 2018-03-16 00:03:40
imageAlert_Manager_buyem.png / V - Attached On 2018-03-15 23:38:11 UTC - Size: 10.94 KB - 449 views
[2018-03-16 08:54:05]
User35525 - Posts: 179
I figured this out after watching a video from Infinity Futures called "Ready, Aim, Fire How to Create a System and Send Automated Trades with Sierra Chart": https://www.youtube.com/watch?v=8o_jYvu1HzQ

I didn't understand fully that most study alerts aren't like the "Color bar based on alert condition" alerts, which will process the last completed bar when selecting "Evaluate on Bar Close Only".

For anybody else needing help, the way to get Trading System Based on Alert Condition to process signals generated from "Color bar based on alert condition" alerts directed to evaluate on bar close only, is to use these settings, within the Trading System Based on Alert Condition study:
1. Deselect "Evaluate On Bar Close" on the Alerts tab (this is optional and doesn't seem to make any difference, but I deselected it anyway to be extra careful).
2. Select "Alert Only Once per Bar" on the Alerts tab, to make sure you don't get a follow-up, duplicate signals after a complete round turn has executed, in the event the chart is still building the bar following the signal generated by the "Color bar based on alert condition" study. (may be moot due to state logic in Trading System Based on Alert Condition but it doesn't hurt).
3. Set "Evaluate on Bar Close Only" to "No" on the "Settings and Inputs" tab. This is vital, and documented by SC, but I didn't understand that "Trading System Based on Alert Condition" processes the current bar by default (which will be the following bar after a signal generated on bar-close (...yes it's obvious now)
4. Use indexing to refer to the previous full bar on the alert set on the Alerts tab: i.e. for my example in post #15 use this: ID1.SG1[-1]=1

This study is a very welcome addition to Sierra Chart and is very handy.
Date Time Of Last Edit: 2018-03-16 09:17:50
[2018-05-15 23:39:24]
CrunchFX - Posts: 13
Im having the same problem as above. i get an alert for the entry and it shows a dot on the chart. but no actual entry happens. and i have followed the documents provided and watched the youtube video. and auto trading is enabled on charts and globally.

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

Login

Login Page - Create Account