Support Board
Date/Time: Sun, 08 Sep 2024 00:40:44 +0000
[User Discussion] - how to create automated Exit which is based on my Stoploss
View Count: 720
[2022-07-02 16:27:10] |
artmaan - Posts: 23 |
Hello, i am trying create an automated Exit which is based on my Stoploss. i want my TakeProfit to be 2xStoploss and automated when i adjust my Stoploss on the chart. i would like to manual enter a trade, then move my Stoploss per hand below/above my entrybar on the chart, then my Take Profit should be automated twice as big as my Stoploss placed as on order (or an attached order modified) Can you point me in the correct direction how to do this the best way? i am currently learning the spreadsheet trading but i am not sure yet what the best way is to achieve this. thanks for help |
[2022-07-03 21:38:04] |
artmaan - Posts: 23 |
can you tell me please how i can reference the attached orders in the spreadsheet? i am trying to reference my attached stoploss order and then i want to create a column (where i calculate my TP) which i can reference in the trade management study. unfortunately j96 only works if i dont have a target as attached order(because it takes the target attached order and not the stop), but then the trade managment study wont work for my target. thank you |
[2022-07-03 23:13:37] |
Sawtooth - Posts: 4083 |
how i can reference the attached orders in the spreadsheet
You can't use J96 to do what you want, for the reason you've mentioned.You could use J80/J81 for your initial Attached Orders' offsets (in points, not ticks), which can be from a formula in those cells. You could calculate the stoploss and target in two Formula Columns, and then use two instances of the Trade Management by Study study to move them where you want. If you want to manually move the stoploss, and have the TP follow at 2x, you'd have to enter a value or offset in a spreadsheet cell, then formulas could reference that cell, and the Trade Management by Study studies would move the TP and SL. |
[2022-07-04 10:06:56] |
artmaan - Posts: 23 |
thank you for your reply. You could calculate the stoploss and target in two Formula Columns, and then use two instances of the Trade Management by Study study to move them where you want.
i am not sure about this, because how i can calculate my stoploss before the trade if its not static every trade, i mean i move the SL below/above my entry bar. i think i could display my stoploss if i could reference the stop order in the spreadsheet, similar to j96 but for my stop order and not the target. then i could calculate my TP from this and have trade management study move my TP. If you want to manually move the stoploss, and have the TP follow at 2x, you'd have to enter a value or offset in a spreadsheet cell, then formulas could reference that cell, and the Trade Management by Study studies would move the TP and SL.
i think this would work if my SL would be static every trade but since i move my stop order below/above the signalbar, my offset setting should also change every trade. i am trading a fast moving tick chart and want to minimise my manual adjustments on the chart, thats why i try to automatic move my TP based on my SL setting. i think all i need is the price value of the current active stop order in the spreadsheet, similar to j96, but for my stop order. is there a way to show the stop order price in the spreadsheet or is there a study which shows the values of current active attached orders? (similar to study: Trading:Position Average Price , but for my attached orders? is this doable in spreadsheet or do i need to focus on ACSIL? thank you |
[2022-07-04 12:10:23] |
Sawtooth - Posts: 4083 |
is there a way to show the stop order price in the spreadsheet or is there a study which shows the values of current active attached orders?
The short answer is no.is this doable in spreadsheet or do i need to focus on ACSIL?
Only with ACSIL.If you have marked the signal bars via a formula, you can make the H/L of the signal bar persistent, and calculate your SL/TP from it. Spreadsheet Example Formulas and Usage: Formula to Count Bars Since An Event Date Time Of Last Edit: 2022-07-04 12:12:35
|
[2022-07-16 21:36:46] |
artmaan - Posts: 23 |
i am trying to make a simple study which shows me the value of the attached stop order in a subgraph,then i can use this in spreadsheets, but i am not sure how to do it. i tried for test purpose to show me avgfillprice with SCPositionData in a subgraph this way and it worked like i wanted: //Get Position data for the symbol that this trading study is applied to. s_SCPositionData PositionData; int Result = sc.GetTradePosition(PositionData); float AvgPrice = PositionData.AveragePrice;//Access the AveragePrice sc.Subgraph[0][sc.Index] = static_cast<float>(AvgPrice); then i tried to get the the attached stoporder with sc.GetNearestStopOrder() and StopChildInternalOrderID the same way as above, but it didnt work. s_SCTradeOrder TradeOrder; int GetNearestStopOrder(s_SCTradeOrder & OrderDetails); int Result = sc.GetNearestStopOrder(TradeOrder); float Stopprice= TradeOrder.StopChildInternalOrderID ; sc.Subgraph[0][sc.Index] = static_cast<float>(Stopprice); i have tried to learn from the examples in tradingsystem.cpp and other, but couldnt find a solution for my simple study yet. can you tell me please what the best way would be to access the price of the attached stoporder in ascil? thank you |
[2022-07-16 22:08:23] |
Sawtooth - Posts: 4083 |
can you tell me please what the best way would be to access the price of the attached stoporder in ascil?
I have no experience with ACSIL, so I'm no help here.If your stoploss is consistently the same offset from the H/L of the entry bar, you can make that value persistent in a spreadsheet Formula Column, then use the Trade Management by Study study to move it there. Like this for longs, e.g. in P3: =IF(M3,0,IF(K3,C3+$J$21*2,P4)) This will return the High of the buy entry bar + 2 ticks, and be persistent until a sell entry bar. The stoploss offset could even be dynamic, from a formula referencing the H/L of the entry bar. |
[2024-07-03 21:13:10] |
User103448 - Posts: 72 |
Ive been trying to figure out the persistent value... but im not getting it correctly, as the value keeps changing with new bars coming.. I have this in Cell U3: =IF(V3,0,IF(J5<0,C4,U4)) V3 is "=J$5>-1" When a short positions is opened it gives me the value of C4, but with the new candle the value keeps changing.. |
[2024-07-03 22:50:58] |
Sawtooth - Posts: 4083 |
In order to make a price persistent, it must be associated with a specific bar, not just the previous bar. J5<0 is always TRUE when you are in a position, so you will always get C4. Use a formula that ties the event to a certain bar, like this: =IF(K3,0,IF(M3,C4,U4)) where M3 is a Sell Entry signal at a certain bar. It is released when there is a Buy Entry signal. |
[2024-07-04 09:55:25] |
User103448 - Posts: 72 |
@sawtooth thank you one more time. I think the calculation inside the spreadsheet should be correct now. But i noticed a different thing. When replaying on a higher speed e.g. x60 the stops keeps trailing. When replaying it in realtime (x1) the stops keeps the persistent value. You can find a video of it as attachment. Pls disregard above mentioned problem. Is there any other event you suggest for releasing the persistent value? When using the Opposing Signal K3 or M3, it release the value to early for me. As i have floating orderflow entry triggers, which frequently turn on and off, the value does not stay persistent with this system. It works on strategies based on candle closes and with valid entry signals from the past candle. Date Time Of Last Edit: 2024-08-01 22:00:32
|
Private File |
To post a message in this thread, you need to log in with your Sierra Chart account: