Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 03:42:28 +0000



[Programming Help] - How to fix buy exit based on a study | Spreadsheet System for Trading

View Count: 307

[2023-10-01 13:16:28]
User140688 - Posts: 13
I am facing an issue placing buying exits, For e.g IF I want to exit a buy based on a dynamic study(indicator), Lets say I took long based on bollinger band now at this time( Time=nTh candle) the lower band value is 15, Price is at 16, I want to exit when price drops below this band value (which happens to be 15 for this candle), The price doesn't breaches 15 now but drops to 14 in next candle close, but for this candle the lower band itself shifts to 13 and thus the condition in spreadsheet buy exit(Last<Lowerband) is still not valid for this candle hence no buy exit would take place, Kindly help me with this,

My Goal is to: Have buy exit fixed on the value of a study, where the fixed candle is the candle of buy entry
What the issue is: That the value of the study changes and I don't want the dynamic changes in values rather the initial static value when I entered the trade
[2023-10-01 22:53:15]
Sawtooth - Posts: 4120
Have buy exit fixed on the value of a study, where the fixed candle is the candle of buy entry
You would need to create a persistent variable of the lower band's value at the signal candle, like this, e.g. in P3::
=IF(K4,BBlowerband,P4)
(This assumes a close of bar signal).

Here are some example formulas for persistent variables, though none are specific to your need:
Spreadsheet Example Formulas and Usage: Persistent and Incrementing Variables

So that you have a stoploss in the market, use Attached Orders (instead of cells L3/N3) and move its stop to the lower band value using the Trade Management by Study study.
Attached Orders: Study Controlled Targets and Stops
Date Time Of Last Edit: 2023-10-01 22:53:48

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

Login

Login Page - Create Account