Login Page - Create Account

Support Board


Date/Time: Fri, 29 Nov 2024 08:40:38 +0000



[Programming Help] - Moving a stop, but only once

View Count: 389

[2023-02-26 20:20:14]
Ed C. - Posts: 117
I know that you can use "Trade Management by Study" to move your stops and targets, but is there a way to move a stop automatically to, say, the low or high of the previous candle and NOT move it again? Trade Management by Study doesn't seem to be able to just do it once, it will move the stop on each bar.

This seems to be something simple to do, but I'm scratching my head over this one. What am I missing?
[2023-02-27 15:46:48]
John - SC Support - Posts: 36350
The easiest thing is to turn off the Trade Management by Study once it has moved the Stop.

Otherwise, you would have to modify the code for the study and keep track of whether it has made a move and then disable the study once it has. Refer to the following:
How to Build an Advanced Custom Study from Source Code
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-02-28 02:48:17]
Ed C. - Posts: 117
Thanks for the reply, but this is an automated system, I can't turn off the study. I guess I'll have to modify the study code. Thanks!
[2023-02-28 03:04:38]
Sawtooth - Posts: 4120
If you are using the Spreadsheet System for Trading study, the Trade Management by Study study can follow any subgraph/column value, so you could returns the H/L of the previous candle with a formula.
[2023-02-28 04:16:28]
Ed C. - Posts: 117
Hi, Tom! True, but how would you prevent the stop from moving from candle to candle?
[2023-02-28 09:04:27]
Sierra_Chart Engineering - Posts: 17225
You can get the source code for that study which is provided and modify it to meet your requirements. This is the way to accomplish this:
How to Build an Advanced Custom Study from Source Code
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-02-28 13:41:33]
Sawtooth - Posts: 4120
how would you prevent the stop from moving from candle to candle?
Make the event persistent that triggered the move of the stoploss.

If you want to move the stop to the H/L of the signal bar, try a formula like this, e.g. in cell O3:
=IF(K3,D3,IF(M3,C3,O4))
Date Time Of Last Edit: 2023-02-28 14:19:40

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

Login

Login Page - Create Account