Support Board
Date/Time: Tue, 01 Jul 2025 09:39:15 +0000
Trailing Stop for order entry that following the price.
View Count: 504
[2025-05-07 11:59:52] |
MTScalper - Posts: 29 |
Hello everyone. I come from a platform where it is possible to set a trailing stop for entries on the DOM. For example, if the market is falling and I want to go long, I place a stop buy order on the book that follows the price by a certain number of ticks as it declines. In this way, I can work with the market's "breaths" during periods of controlled volatility near specific price levels. Is it possible to do the same with Sierra? In other words, to have an entry stop order that follows the price with an X tick offset? I took a look at the various order types offered by Sierra Chart, but I can't seem to find anything specific for this. Thank you for any replies. |
[2025-05-08 18:57:19] |
Sierra_Chart Engineering - Posts: 20026 |
Yes a trailing stop is supported: Order Types: Trailing Stop Refer to: Chart Trading and the Chart DOM: Entering Orders From the Chart 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 |
[2025-05-10 13:36:45] |
MTScalper - Posts: 29 |
Thank you for the response, but I can't seem to find the functionality as I outlined in the first message. Could you provide me with a direct indication on how to obtain it?
|
[2025-05-11 20:17:37] |
Thanthou - Posts: 10 |
Trade >> Open Trade Window For Chart Trade >> Chart Trade Mode on (So you can visualize attached orders to confirm they are doing as you expected) Dom: Make sure Use Attached Orders is checked Dom: Click on the Targets Tab Dom: Click on Add to add a new attached order Look under 'Type' for the type of new attached order you would like, 'Stop: Trailing stop' or whatever you'd like Play around with them in SIM mode to see what combinations are what you are after. If you cannot achieve what you are after via the DOM, you may need to program a custom study yourself. Hope that was helpful |
[2025-05-13 07:14:47] |
MTScalper - Posts: 29 |
Thanks but I know how to set a classic trailing stop, but I cant find the type that i looking for: set a trailing stop for entries on the DOM. For example, if the market is falling and I want to go long, I place a stop buy order on the book that follows the price by a certain number of ticks as it declines.
@Sierra_Chart Engineering Can explan how to set it? I’m not sure if it’s allowed to post a video to show what I mean, since I would need to do it using another platform that allows me to record it. If it is possible to share it, please let me know so I can send it. Date Time Of Last Edit: 2025-05-13 07:16:42
|
[2025-05-13 13:11:46] |
John - SC Support - Posts: 40676 |
You can post a video from another system, but we tend to ignore videos. Have you tried the "Trailing Stop" or "Trailing Stop Limit" order type and seen if it will do what you are wanting? From what you describe, the "Trailing Stop Limit" works as you want - if you place a buy order above the current market price, it will follow the price as it drops and if it rebounds and crosses back through the order, then a Buy order will occur. You can also have attached orders associated with this. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-05-13 14:37:41] |
MTScalper - Posts: 29 |
I tried, but it doesn’t work. The order doesn’t follow the price. Also, when using a limit Trailing order, it’s necessary to set a specific "limit" price. I’ve tried several approaches, and I’m sure the feature exists, but I haven’t been able to find the right settings parameters.
Date Time Of Last Edit: 2025-05-13 14:38:29
|
[2025-05-13 14:49:03] |
MTScalper - Posts: 29 |
Okay, I made a video where I simulate the effect I'm trying to achieve on Sierra Chart — not on another platform. In the video, I'm trailing the order manually.
Date Time Of Last Edit: 2025-05-13 15:43:12
|
![]() |
[2025-05-13 15:42:03] |
Stefano Corsi - Posts: 5 |
Hello everyone I read MTScalper’s request and I’m also interested. The trailing functionality currently available in SC provides a trailing stop only when already in a market position. My need, however, is to be able to enter the market by taking a position with a trailing stop order, which is highly effective in counter-trend situations in highly volatile markets. Unfortunately, the trailing function currently in SC only supports trailing after the order has been filled. What is needed instead is the ability to enter the market with a trailing order. Is it possible to find a solution?
|
[2025-05-13 15:48:08] |
John - SC Support - Posts: 40676 |
The "Trailing Stop Limit" order does exactly what is shown in the video posted by MTScalper. It DOES NOT require that you already have an open position, you can enter a parent order as a "Trailing Stop Limit" and it will trail the price as it drops and then fill when the price reverses. We will make a quick video that shows this. But in the end, just play with it in Simulation Mode and using Replay where you have a nice falling price area and you will see how it works. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-05-13 15:59:43] |
John - SC Support - Posts: 40676 |
Attached is a video of a Trailing Stop Limit order set as the parent order with attached orders to it. If you are not able to reproduce this, then we need to know what you are doing that is not working. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2025-05-13 17:11:15
|
![]() |
[2025-05-13 16:24:43] |
MTScalper - Posts: 29 |
John the file it's private.
|
[2025-05-13 17:11:28] |
John - SC Support - Posts: 40676 |
Sorry about that. It is public now.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-05-13 19:14:46] |
MTScalper - Posts: 29 |
Thank you for your response, John. However, this method requires clicking "Buy," and when I tested it, I was forced to enter a limit price each time to activate the trailing order. It’s really not practical, especially with a fast-moving instrument like the NQ. By the time I set the limit price and calculate the starting tick, it defeats the purpose. Would it be possible to integrate a function that works with steps (distance from price and order buy ord X tick from frice), or simply maintains the trail using a basic stop buy placed directly from the DOM, without needing to set a limit price or use the Sierra Chart trade box to submit the order? Date Time Of Last Edit: 2025-05-13 19:16:27
|
[2025-05-13 19:49:34] |
John - SC Support - Posts: 40676 |
There are a few options. First, you can setup a specific trading action for the DOM to be a "Trailing Stop". So you can define whether a right or left click in the Buy or Sell column above or below the price defines that order. Refer to the following: Global Trade Settings Windows: Order Types (Global Settings >> Chart DOM Settings) Second, you can create a Keyboard Shortcut that defined as either a Buy Trailing Stop, Buy Trailing Stop Limit, Sell Trailing Stop, or Sell Trailing Stop Limit and define the offset you want from a particular bar reference (i.e. offset from Open, High, Low, or Close/Last). Third, you can reference the above Keyboard Shortcut as a Control Bar button to do the same thing with a button instead of keyboard shortcut. Fourth, you can create a custom study to place the order as you want it based on some input you define. Refer to the following for this: Automated Trading From an Advanced Custom Study For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2025-05-14 03:37:25] |
Thanthou - Posts: 10 |
Hi John, I was curious if you could provide me with some SC best practices. I coded up a "Trailing Stop Limit" and have been curious about a few things for quite some time. 1. I would assume the trade cycle methodology is: 1. Place Trade 2. Confirm Fill 3. Exit Trade 4. Confirm Fill But, perhaps there is nuance and other things to factor in as well? 2. Best way to handle Entry/Exit Fills. What I have gets the job done, but I am certain it is not ideal. 3. Best way to handle sc.modify(order) -I was getting alot of error messages relating to the price and quantity being the same as before while attempting to modify it. However, the if statement was clearly blocking this from happening. I thought it was a floating point problem, but that wasn't it. Perhaps it was the speed (fast replay) that was the problem. Anyways, any insight would be appreciated. ----- MTSCALPER, here is a study that does what you are looking for. #include "sierrachart.h" SCDLLName("Custom Trailing Entry") bool short_logic(SCStudyInterfaceRef sc){ return sc.Close[sc.Index] > sc.Close[sc.Index - 1]; } bool long_logic(SCStudyInterfaceRef sc){ return sc.Close[sc.Index] < sc.Close[sc.Index - 1]; } bool check_entry_fill(SCStudyInterfaceRef sc, s_SCNewOrder order) { s_SCOrderFillData fill; int latest_index = sc.GetOrderFillArraySize() - 1; // Step 1: Check most recent fill if (latest_index >= 0 && sc.GetOrderFillEntry(latest_index, fill)) { if (fill.InternalOrderID == order.InternalOrderID) return true; } // Step 2: Iterate backwards if needed for (int i = latest_index - 1; i >= 0; --i) { if (sc.GetOrderFillEntry(i, fill) && fill.InternalOrderID == order.InternalOrderID) return true; } return false; } bool check_exit_fill(SCStudyInterfaceRef sc, s_SCNewOrder order) { s_SCOrderFillData fill; int latest_index = sc.GetOrderFillArraySize() - 1; // Step 1: Check most recent fill if (latest_index >= 0 && sc.GetOrderFillEntry(latest_index, fill)) { if (fill.InternalOrderID != order.InternalOrderID) return true; } return false; } void enter_trade(SCStudyInterfaceRef sc, float stop, float target, float offset, int direction, s_SCNewOrder& order, int& result) { order.OrderType = SCT_ORDERTYPE_TRAILING_STOP_LIMIT; order.OrderQuantity = 1; order.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; order.AttachedOrderStop1Type = SCT_ORDERTYPE_LIMIT; order.Stop1Offset = stop; order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT; order.Target1Offset = target; if (direction == 1) { order.Price1 = sc.Close[sc.Index] + offset; result = sc.BuyEntry(order); } else if (direction == -1) { order.Price1 = sc.Close[sc.Index] - offset; result = sc.SellEntry(order); } } SCSFExport scsf_TrailingEntry(SCStudyInterfaceRef sc) { static bool waiting_to_enter = false; static bool in_trade = false; static int direction = 0.0f; static double trail_price = 0.0f; static int result = -1; static s_SCNewOrder entry_order; static double last_sent_trail_price = 0.0; static double offset = 5.0f; //Can also use sc.TickSize * ticks static double stop = 3.0f; static double target = 3.0f; if (sc.SetDefaults) { sc.GraphName = "Trailing Entry"; sc.AutoLoop = 1; sc.UpdateAlways = 1; sc.GraphRegion = 1; sc.ValueFormat = 3; sc.AllowOnlyOneTradePerBar = true; return; } if (sc.Index != sc.ArraySize - 1) return; if (!in_trade && !waiting_to_enter) { if (long_logic(sc)) direction = 1; else if (short_logic(sc)) direction = -1; if (direction != 0) { enter_trade(sc, stop, target, offset, direction, entry_order, result); if (result > 0) { waiting_to_enter = true; direction = direction; trail_price = sc.Close[sc.Index] + (direction * offset); SCString msg; msg.Format("Trailing %s: %.2f | Result: %d", (direction == 1 ? "Long" : "Short"), entry_order.Price1, result); sc.AddMessageToLog(msg, 1); } else { SCString msg; msg.Format("Order failed with code: %d", result); sc.AddMessageToLog(msg, 1); } } } if (waiting_to_enter && check_entry_fill(sc, entry_order)) { waiting_to_enter = false; in_trade = true; } if (in_trade && check_exit_fill(sc,entry_order)) { in_trade = false; trail_price = 0.0f; direction = 0; } if (waiting_to_enter && (direction == 1 || direction == -1)) { double candidate_price = sc.RoundToTickSize(sc.Close[sc.Index] + (direction * offset), sc.TickSize); bool should_trail = (direction == 1 && candidate_price < trail_price) || (direction == -1 && candidate_price > trail_price); if (should_trail && candidate_price != last_sent_trail_price) { s_SCTradeOrder status; if (!sc.GetOrderByOrderID(entry_order.InternalOrderID, status) || status.OrderStatusCode == SCT_OSC_OPEN) return; trail_price = candidate_price; last_sent_trail_price = candidate_price; s_SCNewOrder modify; modify.InternalOrderID = entry_order.InternalOrderID; modify.Price1 = trail_price; int result = sc.ModifyOrder(modify); if (result <= 0) { SCString msg; msg.Format("%s Modify failed: %d %.2f", (direction == 1 ? "Long" : "Short"), result, trail_price); sc.AddMessageToLog(msg, 1); } } } } |
[2025-05-14 15:00:43] |
John - SC Support - Posts: 40676 |
Thanthou: Sorry, but the questions you are asking are really Programming Help, which is beyond the scope of our support. Other programmer users should be willing to answer your questions. We recommend putting it into a separate thread with an appropriate title so others can find it. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: