Support Board
Date/Time: Sun, 24 Nov 2024 16:31:28 +0000
[Programming Help] - Disable Automated Trading After X Point Profit
View Count: 254
[2024-05-13 04:19:24] |
alexo2022 - Posts: 47 |
how do I disable autotrade system after x profit points, for example if x > = 3 point, disable the auto trade. |
[2024-05-13 14:39:29] |
emmanuel - Posts: 57 |
const double DailyProfitTarget = x;
bool EnableTrading = true; s_SCPositionData PositionData; if(sc.GetTradePosition(PositionData) != SCTRADING_ORDER_ERROR) { if(PositionData.DailyProfitLoss >= DailyProfitTarget) EnableTrading = false; } // Don't proceed beyond this point if the Daily profit loss is greater than daily target if(!EnableTrading) return; See Automated Trading From an Advanced Custom Study: [Type: double] DailyProfitLoss |
[2024-05-13 14:52:57] |
alexo2022 - Posts: 47 |
Thanks, And what do I need to do if I want it as a formula in a spreadsheet ? |
[2024-05-14 01:24:23] |
Sawtooth - Posts: 4119 |
The Spreadsheet System for Trading study uses Currency for its P/L, - so you'd need to calculate the number of number of ticks per point from the tick size in J21, - and multiply it by the Currency Value Per Tick in J56, - and multiple it by your threshold of 3 points, - and compare it to the Closed Daily P/L in J45. So use/include a formula like this in J28: =J45>=1/J21*J56*3 |
[2024-05-19 18:04:25] |
alexo2022 - Posts: 47 |
I came out with this formula solution, =IF(J50>=3,1,0) what do you think ? |
[2024-05-19 19:14:28] |
Sawtooth - Posts: 4119 |
=IF(J50>=3,1,0)
That would work if you want to disable autotrading after 3 winning trades.what do you think ? But it has no relation to 3 points of profit. |
To post a message in this thread, you need to log in with your Sierra Chart account: