Login Page - Create Account

# Support Board

Date/Time: Mon, 27 Jun 2022 00:19:44 +0000

## [User Discussion] - Daily Loss Limit in Spreadsheet Auto Trading

### View Count: 2384

 [2013-06-14 19:12:56] #1 User51517 - Posts: 58 Hello Admin/Fellow SC users, I'm exploring spreadsheet auto trading and wanted to ask this question - is there a way to impose a daily loss limit for intraday trading? The idea is : auto trading will be disabled when trading loss has reached a limit of XYZ amount for the day. It will be enabled again for the next day of course. Is it possible to do this in SC? I searched here and the online documentation, but could not come up with anything. Thank you! Edit: Or is it possible to disable spreadsheet auto trading after 2 or 3 consecutive loss for the day? Date Time Of Last Edit: 2013-06-14 21:59:11
 [2013-06-14 22:31:32] #2 vegasfoster - Posts: 444 J28 controls whether autotrading is enabled, J29 will flatten and cancel all open orders, J10 is your Open PL and J11 is your Closed PL. If the total of cells J10 and J11 are greater than your daily stop loss, then you want both J28 and J29 to equal true. The issue is when you flatten and cancel, if price moves in your favor before the orders fill, then you could be slightly under your daily loss again and autotrading will resume even though you don't want it to. So you may want to create positive slippage in your Open Profit/Loss in J10 so that when the final value transfers to the Closed Profit/Loss in J11, then J28 and J29 will stay false. Assuming you have a \$500 daily stop and you estimate max \$30 of positive slippage, then you would enter: In J28, =(J11 + if(J10<0, J10+30, 0)) < -500 In J29, =J28 Problem is your actual loss could be greater by the amount of the estimated positive slippage. Maybe someone else knows a better way. I can't think how to do 2 or 3 losing trades in a row using the spreadsheet. Again, maybe someone else knows.
 [2013-06-15 13:51:45] #3 tomgilb - Posts: 3325 To disable autotrading after n losing trades, add the Trading: Losing Trades study, then reference it's column in your formula.
 [2013-06-16 17:41:10] #4 User51517 - Posts: 58 Thanks vegasfoster and tomgilb! vegasfoster, I'll try your formula. How can I make sure J11 is closed PL for the day, not cumulative over several days? Do I have to manually reset everyday? tomgilb, thanks for the tip about the losing trades study. Is there a way filter out consecutive losing trades? I''d like to have auto trading disabled only after 2 or 3 consecutive losing trades in a single day. Also, how do I make sure it only shows losing trades for the day? Date Time Of Last Edit: 2013-06-16 17:45:32
 [2013-06-17 07:20:59] #5 Sierra Chart Engineering - Posts: 103469 Please have a look at the following 2 Spreadsheet cells which will help you with this: https://www.sierrachart.com/index.php?l=doc/doc_SystemsAlerts.php#CellJ45 ( closed daily profit/loss) https://www.sierrachart.com/index.php?l=doc/doc_SystemsAlerts.php#DisableAutoTrading (disable auto 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
 [2013-06-17 18:05:17] #6 User51517 - Posts: 58 I think I figured out a way to calculate consecutive losing trades for the day. For example, if your daily limit is 2 losses in a row, you would disable trading when Daily Lose Trades [Cell J51] - Daily Win Trades[Cell J50] = 2 Date Time Of Last Edit: 2013-06-18 04:05:43
 [2013-06-18 01:53:33] #7 tomgilb - Posts: 3325 I don't think J51-J50 will necessarily produce a consecutive losing trades value. 1) Try this for counting consecutive losing trades: -Add the Trading: Losing Trades study -Add the Trading: Winning Trades study -Put this in cell O3: =IF(AA3>AA4,TRUE,IF(OR(AC3>AC4,INT(A3)>INT(A4)),FALSE,O4)) This will repeat TRUE until there is a winning trade, or until the date changes -Put this in cell P3: =IF(AND(O3,O4=FALSE),1,IF(AND(O3,AA3>AA4),P4+1,IF(AND(O3,O4),P4,0))) This will increment the consecutive losing trade count, and reset to zero if there is a winning trade, or the date changes. The formulas assume the Trading: Losing Trades study is in column AA and the Trading: Winning Trades study is in column AC; edit as needed. 2) To disable autotrading at a daily max loss value, I would use J45 instead of J11.
 [2013-06-18 04:05:16] #8 User51517 - Posts: 58 Hi tomgilb, thank you for the help! Yes you're right. I failed to consider this scenario: win-lose-lose. J51-J50 = 1, but clearly I have 2 losing trades in a row.
 [2013-07-22 16:34:39] #9 User51517 - Posts: 58 Hi I'm returning to this thread with just one more question: Since I'm going to trade multiple symbols, is there a way to configure either daily loss or consecutive losing trades for the entire trading account, rather than one specific symbol? Thank you Date Time Of Last Edit: 2013-07-22 17:16:46
 [2013-07-22 17:16:48] #10 tomgilb - Posts: 3325 You could add the same spreadsheet study, using the same Spreadsheet Name and setup from post #7, to the other charts in your chartbook, then on each sheet# sum the consecutive losing trades by referencing the other sheet#s. Same with J45 from each sheet#. Date Time Of Last Edit: 2013-07-22 18:03:23
 [2013-07-22 17:56:55] #11 User51517 - Posts: 58 Wow, that's fast! Thanks Tomgilb Can you be more specific about "referencing the other sheet#s"?
 [2013-07-22 18:11:28] #12 tomgilb - Posts: 3325 For example, to reference Sheet2 cell J45 in Sheet1 cell H45,: =Sheet2!J45 You don't have to type this. You can press '=' in cell H45, click on the Sheet2 tab, then cell J45, then press Enter.
 [2013-07-23 12:13:36] #13 User51517 - Posts: 58 Got it, just like in regular MS Excel. Thank you for your help!
 [2014-03-02 23:59:52] #14 oyehya - Posts: 12 sorry to jump on this old post, but i look for help for "disabled auto trading on times" for the auto-trading will not enter a trade on news time . i run a auto trading system but i get "KILL" on news time and i will like not to auto trade on this times the best is to update the times it will "disabled auto trading" for each day with spreadsheet programing . hope to get some help on this. Date Time Of Last Edit: 2014-03-03 00:10:09
 [2014-03-03 00:39:23] #15 tomgilb - Posts: 3325 Here is an example for use in cell J28: =AND(J41-INT(J41)>TIMEVALUE("09:59:00"),J41-INT(J41)
 [2014-03-04 03:09:15] #16 oyehya - Posts: 12 Thank you,Tomgilb.

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

Login