Support Board
Date/Time: Thu, 28 Nov 2024 03:57:01 +0000
[Programming Help] - How to exit trade when daily profit target hit
View Count: 712
[2023-06-01 17:04:13] |
tommartin321 - Posts: 74 |
Hello Using the spreadsheet system for trading study, I'd like to exit a trade when my daily profit target is hit. This would seem to include adding together Open Profit/Loss (J10) and Cumulative Closed Profit/Loss (J11). I'm able to disable auto trading after Closed Daily Profit/Loss (J45) reaches, by using the following in J28; =J45>=500 (in this example my daily profit goal is $500), but this isn't what I'm trying to achieve. Using the same $500 profit target example, if my current Cumulative Closed Profit/Loss is -$200, then I would need to stay in the next trade until my Open Profit/Loss reached $700 (-200 + 700 = $500) before having the system exit my trade. In columns L3 and N3 should I be able to put =J10 + J45>= 500? |
[2023-06-01 22:40:33] |
j4ytr4der_ - Posts: 938 |
Are you meaning that you want the system to get flat the moment the target is reached, intra-trade? If so try using J10 + J45 to get the live total of the P&L TODAY, right this moment, including the open trade. J11 is cumulative so it's not just today. |
[2023-06-01 23:19:39] |
Sawtooth - Posts: 4120 |
You can flatten your position with =J10 + J45>= 500 in cell J29. Use a formula like this in J28: =AND(J8 = 0, J10 + J45 >= 500) This will allow autotrading to not be disabled until you're flat, allowing J29 to work. However, since J10 is not persistent, J28 could immediately enable auto trading because J10 will go to zero when flat. You might need to use 550 instead so that J45 stays >500 when flat. |
[2023-06-02 00:43:19] |
j4ytr4der_ - Posts: 938 |
J10 will go to zero but then that amount should appear in J45, so it should be fine, no?
Date Time Of Last Edit: 2023-06-02 00:43:28
|
[2023-06-02 02:15:33] |
Sawtooth - Posts: 4120 |
J10 will go to zero but then that amount should appear in J45, so it should be fine, no?
Yes, in nearly all cases.If price is moving very fast, it's possible J45 could end up less than 500, so J28 would be 0 (enabled) Date Time Of Last Edit: 2023-06-02 03:56:26
|
[2023-06-02 03:37:56] |
j4ytr4der_ - Posts: 938 |
Ah yes I see your point here. It's a bit of an edge case but definitely not impossible, especially in thinner instruments. I like to use MAX() in cases like this, so that I know if the value I'm testing for was *ever* over a certain amount, it gets caught.
|
[2023-06-02 15:01:23] |
tommartin321 - Posts: 74 |
Fantastic, thanks so much for ur help.
|
To post a message in this thread, you need to log in with your Sierra Chart account: