Support Board
Date/Time: Fri, 29 Nov 2024 18:24:29 +0000
[Programming Help] - Position size/MM using Simple Alerts
View Count: 1109
[2023-01-06 05:40:22] |
User61168 - Posts: 403 |
Hi, I have an automated trading algo designed using simple alert conditions with the trade ticket attached to the chart. Is there a way to automatically increase/decrease contract size based on size of account balance via simple alert formula? I searched the forum and could not find a way to do this. How are you guys doing Money Management with algos using simple alerts? I would appreciate any assistance or guidance. |
[2023-01-06 14:31:34] |
Sawtooth - Posts: 4122 |
Is there a way to automatically increase/decrease contract size based on size of account balance via simple alert formula?
No, but it can be done with the Spreadsheet System for Trading study.
|
[2023-01-06 17:46:27] |
User61168 - Posts: 403 |
Thanks Tom. I was fearing you would say that. I am only skilled in using simple alerts. If I could get a sample of spreadsheet trading system with a very simple logic... Trade window: 9:30am - 4pm ET entry @ candle open + 5Ticks when H-L>= 10Ticks exit at candle close when profit is 10 ticks or loss is -5 ticks (trade opened and closed on the same candle) exit when profit is either 100 ticks or loss is -50 ticks (checked at every tick) Contract sizing: 1 contract per account balance of $10K (increase/decrease size based on account balance) I could then use this as a starting point to shorten the learning curve. I would appreciate it very much. Edit: Moving this post thread to "Programming help" Date Time Of Last Edit: 2023-01-06 18:34:11
|
[2023-01-06 21:00:28] |
Sawtooth - Posts: 4122 |
There is a workaround to allow you to use Alert syntax for most of the system: 1. Use the Color Bar Based On Alert Condition study instead of the Trading System Based On Alert Condition study. 2. Add the Spreadsheet System for Trading study. (This study can see the TRUE signals of the color bar study.) (Trades will initiate using this study.) - Trade times are in cells J85-J87. - If you are using Teton Order Routing, acct balance is in cell J47. - If you are not using Teton, use any cell in column H to manually enter the day's initial balance. - Order Quantity is in cell J26. Use a formula referencing the column H cell, or J47, to find the difference from J45, to return the order quantity. - Use cell K3 for the buy entry formula, like this: =ID1.SG1@3>0 where ID1 is the buy entry color bar study. - Use cell M3 for the sell entry formula, like this: =ID2.SG1@3>0 where ID2 is the sell entry color bar study. Note: Since you are proficient at Alert syntax, the spreadsheet study should not intimidate you. It's just a matter of using a similar but different syntax, and understanding a few basic things about the Spreadsheet System for Trading study format: - Spreadsheet row 3 is the current bar, and earlier bars are in rows below. All formulas from columns K-Z are entered in row 3. - Columns AA and above are the outputs of added studies. - Columns K,L,M,N are the Buy Entry, Buy Exit, Sell Entry, Sell Exit columns, respectively. - Columns O-Z are for intermediate formulas, as needed. - Alert syntax ID1.SG1[0] is ID1.SG1@3 in spreadsheet syntax. - Alert syntax ID1.SG1[-1] is ID1.SG1@4 in spreadsheet syntax, etc. |
[2023-01-06 21:57:54] |
User61168 - Posts: 403 |
Wow! Your one post reduced all my fears of spreadsheet trading study I had (due to the long learning curve). I already have all my entry and exit conditions in color bar study which returns 1 if successful to trigger the trade so this seems to be a very easy transition. Yes, I am very familiar with alert formula. I am not yet on Teton but selecting a broker this week (as I am done waiting on AMP to offer Teton).I am down to selecting either ironbeam or deepdiscounttrading. Got any recommendations which one I should select? network latency and proximity to CME is key for me as I am trading 5=7 seconds after RTH open at 9:30am ET. Thanks a TON !!! Date Time Of Last Edit: 2023-01-06 21:58:10
|
[2023-01-06 22:08:52] |
User61168 - Posts: 403 |
Tom - I have bothered you enough so one last question if you don't mind. With spreadsheet for trading study, am I forced to attached trade window to the chart? I want the trade window to be completely hidden (or inaccessible) as it just "entices" me to manually intervene with my algo! I do use attached SL and TP orders set in the trade window that Algo relies on so not sure if there is any quick and easy workaround available.
|
[2023-01-07 00:42:44] |
Sawtooth - Posts: 4122 |
Got any recommendations which [broker] I should select? network latency and proximity to CME is key for me
I'm not familiar with Ironbeam so I have no opinion.I was with DeepDiscountTrading many years ago, and he was awesome. Was unaware he has any FCMs that support Teton. You'll want to use a VPS if you require minimum latency and proximity to CME. There are several independent companies, but Stage5 offers one on their website. I like FCMs that offer ACH transfers in and out. Stage5 doesn't have any FCMs that do. AMP does but they don't offer Teton, yet. EdgeClear has Philip Capital and they do. Not sure if DeepDiscountTrading has any FCMs that do. Not sure if Ironbeam does. This is obviously an incomplete list. With spreadsheet for trading study, am I forced to attached trade window to the chart? I want the trade window to be completely hidden
The Spreadsheet System for Trading study doesn't require you do to anything different with the Trade Window that manual trading does, except you must use cell J26 for Order Quantity.You can detach the Trade Window from the chart and drag it out of sight, or you can close it and the twconfig you selected before will be used. You can use a formula in cell J112 to choose a twconfig. |
[2023-01-08 16:27:57] |
Ironbeam - Posts: 9 |
Hey there, If you have any questions about Ironbeam and our services please feel free to reach out. Mike mike.murphy@ironbeam.com ** RISK DISCLAIMER: There is a substantial risk of loss in trading commodity futures and options. Past performance is not necessarily indicative of future results. Only risk capital should be used. Losses from commodity investments may be greater than the initial investment(s). Commodity trading is not appropriate for all investors, and a commodity investment must be evaluated in light of the potential for risk of loss as well as the possibility of profit. |
[2023-01-08 19:08:12] |
User61168 - Posts: 403 |
Hey there,
If you have any questions about Ironbeam and our services please feel free to reach out. Mike mike.murphy@ironbeam.com ** RISK DISCLAIMER: There is a substantial risk of loss in trading commodity futures and options. Past performance is not necessarily indicative of future results. Only risk capital should be used. Losses from commodity investments may be greater than the initial investment(s). Commodity trading is not appropriate for all investors, and a commodity investment must be evaluated in light of the potential for risk of loss as well as the possibility of profit. Thanks Mike. I just sent you an email. I have already submitted the new account application yesterday. I am on older Sierra Chart version 2280 so my first anxiety is to do the upgrade to latest version. All my alogs are tested on v2280 so if I can use teton without any platform upgrade that would be best. |
[2023-01-08 19:10:48] |
Sierra_Chart Engineering - Posts: 17233 |
You really do have to update when using Teton. The best procedure to do would be to make a copy of your existing installation: Transferring Sierra Chart Settings and Data From Existing Installation to New Installation: Simple Transfer/Copy of Sierra Chart Installation to Another Folder or Computer System You do not have to copy the larger scid Intraday data files from your current installation. So you can make a copy very fast. And then update that new copy, then you do not disrupt the current installation. 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, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2023-01-08 19:12:37
|
[2023-01-08 19:50:55] |
User61168 - Posts: 403 |
Perfect!!!! Thanks for the tip. I plan to do it today. BTW: You guys are doing a fantastic job with the platform. The biggest home run for me was when you removed the character size limitation from Alerts. I can write 2-3 pages of code in a single alert instead of doing multiple alerts. Kudos to your engineering team!!! |
[2023-01-08 22:52:37] |
Sierra_Chart Engineering - Posts: 17233 |
That is good: I can write 2-3 pages of code in a single alert instead of doing multiple alerts. Kudos to your engineering team!!!
However, we wonder if you are running into a limitation, the edit control where you put the alert. That would be a place of a limitation controlled by the operating system. 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, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2023-01-09 03:23:32] |
User61168 - Posts: 403 |
I have yet to run into any limitation yet. This has allowed me to combine multiple strategies into a single alert condition study....very powerful! I also came up with a good way to include comments in my code as there is no way to comment any code (with a minor compromise on cpu load). Which then lead me to find a way to disable alerts since there is no "enable/disable" facility built into a color boar alert condition. Here's my sample psuedocode for exits: AND(ID8.SG1=0 ,OR(ID8.SG1="StudyName:Buy:ExitManager-OnTick",ID13.SG1=0) ,OR( OR(ID8.SG1="Exit-OnTick:TP@xxx",AND(ID8.SG1=0,OR(AND(ID7.SG1>0,ID10.SG1+(C-ID9.SG1)>=ID25.SG1+(ID3.SG1+1)*0.25+5),AND(ID7.SG1<0,ID10.SG1+(ID9.SG1-C)>=ID25.SG1+(ID3.SG1+1)*0.25+5)) )) ,OR(ID8.SG1="Exit-OnTick:SL-Fixed-xxxx",AND(ID8.SG1=0,OR(AND(ID7.SG1>0,C<=ID9.SG1-10),AND(ID7.SG1<0,C>ID9.SG1+10)) )) ,OR(ID8.SG1="Exit-OnTick:SL-@xxx",AND(ID8.SG1=0,OR(AND(ID7.SG1>0,C<=ID9.SG1-10,ABS(C-L)<1),AND(ID7.SG1<0,C>ID9.SG1+10,ABS(C-H)<1)) )) ,OR(ID8.SG1="Exit-OnTick:TP@@xxx",AND(ID8.SG1=0,ID10.SG1<=-50,ABS(O-C)<=(H-L)*0.75,OR(AND(ID7.SG1>0,ID10.SG1+(C-ID9.SG1)+(-1)*(ID3.SG1+1)*0.25>=(ID3.SG1+1)*0.25+26.5),AND(ID7.SG1<0,ID10.SG1+(ID9.SG1-C)+(-1)*(ID3.SG1+1)*0.25>=26.5)) )) ,AND(ID8.SG1=0999,OR( OR(ID8.SG1="Exit-OnTick:TP-xxxxxxx",AND(ID8.SG1=0999,OR(AND(ID7.SG1>0,C>=ID9.SG1+201.50),AND(ID7.SG1<0,C<ID9.SG1-201.50)) )) ,OR(ID8.SG1="Exit-OnTick:xxxxx",AND(ID8.SG1=0999,ID10.SG1<=-50,OR(AND(ID7.SG1>0,C>=ID9.SG1+ABS(ID10.SG1)+(ID3.SG1+1)*0.25+11.50),AND(ID7.SG1<0,C<ID9.SG1-ABS(ID10.SG1)+(ID3.SG1+1)*0.25+11.50 )) )) )) )) AND(ID8.SG1=0 ,OR(ID8.SG1="StudyName:Buy:ExitManager-OnCC",ID13.SG1=0) ,OR( OR(ID8.SG1="Exit-OnCC:ExitPnL-OnCandleClose",AND(ID8.SG1=0,ID7.SG1<>0 )) )) Doing it this way allows me to create a Master collection of entries and exits that I can quickly plug n play to explore edges and if I don't need them, I simply comment the code by moving them under ID8.SG1=0999 section to disable. If I need to disable the entire alert condition, I just put a 0999 on the main ID8.SG1 condition (first line). ID8.SG1 is just a simple Line Study defaulted to 0 value, hidden that I use to manage my codeset and to make it more readable. I also use the "alert" tab of ID8 to document my release notes for the study collection, trading results, observations etc... completely in free form text and it does not give me any errors lol (unintended but very convenient 'feature'). I love it... but it takes a hit on market replay performance for us so lately I maintain my entire codeset in notepad++ and only include the code that I am targeting to test. Piece of cake once you get the hang of it. I have tons of recommendations for improvements on system design but don't want to bother you guys on your journey to add more features which is more important than fixing issues that I have found workarounds for:- Hope this helps. p.s. It would be nice to have a disable/enable button in every study in Sierra Chart. Hiding or Ignoring subgraphs is fine but it still results in a waste of few cpu cycles if I am not mistaken. This will allow me to have a static master study collection that I can resuse. Edit: needless to say, this is not production code as it is very inefficient. I use this only for testing in market replays and then remove all the unnecessary stuff when I am ready to go live Date Time Of Last Edit: 2023-01-09 04:00:43
|
[2023-01-09 03:58:09] |
User61168 - Posts: 403 |
I just checked the max limitation of characters in alert condition enforced by OS. It is 30,000 characters on my laptop. 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz 2.80 GHz 16GB RAM Windows 11 Home version 22H2 OSBuild: 22621.963 |
[2023-01-09 05:32:46] |
Infinite - Posts: 134 |
I would use Stage 5 intoducing broker for Advantage Futures. I used IB for years and their commissions are extremely high, IMO
Date Time Of Last Edit: 2023-01-09 05:36:46
|
[2023-01-09 06:08:03] |
User61168 - Posts: 403 |
I am not a big fan of introducing brokers when I looked into this business practice several years back. Authorization agreements are usually twisted and hard to understand so I stayed clear of them. Agree on IBKR. It's has been a love and hate relationship with them since past 2 decades but funds are relatively safe if you have a large portfolio of diversified assets. Most futures FCMs have too little liquid cash/assets for my comfort. Unless funds are deployed/invested, I see no need to park excess capital with FCMs in this era where wire transfers happen within a day or two :- Edit: Decision is made to go with Ironbeam and Teton. Date Time Of Last Edit: 2023-01-09 06:09:07
|
[2023-01-09 15:55:05] |
Infinite - Posts: 134 |
Great Mike Murphy seemed nice over the years!
|
[2023-01-24 15:25:24] |
User90125 - Posts: 715 |
It would be nice to have a disable/enable button in every study in Sierra Chart. Hiding or Ignoring subgraphs is fine but it still results in a waste of few cpu cycles if I am not mistaken. This will allow me to have a static master study collection that I can reuse
+1 |
To post a message in this thread, you need to log in with your Sierra Chart account: