Support Board
Date/Time: Sat, 24 May 2025 07:10:09 +0000
[Programming Help] - Programming Help - How to avoid multiple trade entry signals at same price level?
View Count: 595
[2023-08-01 21:55:38] |
User61168 - Posts: 442 |
Hi, I am looking for some direction in dealing with these two challenges: 1) I have multiple (and unrelated) trade signals coded in a single "Simple Alert-Trading based on Alert condition" study. There are times when 2 or more signals are generated at the same price level (at different times or on different range/renko bars) so I need a filter that would track and avoid a second trade execution at the same price level. Example: If a trade was already triggered at Session open price line, I would like all future trade signals across multiple strategies to ignore when ABS(C-session Open Line) <= xticks. 2) Is there a study that will tell me how many times a price level is visited? Like a counter based on last price to return a number in subgraph representing how many times this price point has been revisited in the past during intraday session only. I would really appreciate any creative solution or ideas. |
[2023-08-02 04:56:01] |
Sawtooth - Posts: 4220 |
I would really appreciate any creative solution or ideas.
1) The Trading System Based On Alert Condition study cannot directly do what you want.You could try using the Trading: Position Average Price study, and disallow an entry at its output, but its output cannot be made persistent, as it is only the first position's price. If this doesn't work, even a spreadsheet study would have the same limitation, so only a custom ACSIL study would be the solution. 2) There is no native study that can capture an intrabar value; only a close-of-bar value could be made persistent. If the latter, the number of bars could be counted, if the former, a custom ACSIL would be required. |
[2023-08-02 06:14:04] |
User61168 - Posts: 442 |
Thanks Tom. In most cases, I would only take one trade per bar as Average position line (APL) is fine. It's the referencing of these average price lines that is compute-heavy as I will have to check 1000s of bars on every tick to see if there is an APL that exists in the past. There is also no array looping capability so all the bar indexes would have to be hard-coded in the formula making it just impossible. I tried the following approach but does not work and I don't know why..... Create an color bar alert condition "based on" APL study as input. Use "draw extension lines at color bar value" setting as "extend to end of chart".... this should draw all APL lines from "all" historical bars as subgraph SG2 but I don't see any lines drawn on the chart (after I run replay for a month). I have never used SG2 before so perhaps I am not doing this right. EDIT- Please ignore my question on extension lines. I ran into this thread Alert when crossing extension line and reference to extension lines are not supported by Sierra Charts (which sucks!) Date Time Of Last Edit: 2023-08-02 08:34:02
|
[2023-08-02 08:45:47] |
User61168 - Posts: 442 |
I have one more mystery to solve lol I have a spreadsheet formula study (ID45.SG1) with the following code to draw lines at candle lows (Draw style of SG1 is Dash). This simple one line of code gives a becomes a great visual aid for trailing stops, stop hunts, to add positions in trending price action etc. IF(AND(H-L>=10,OR(O>C,O-L>H-O)),L,ID45.SG1[-1]) Code works fine and during replay it draws all the lines nicely but all the historical lines gets wiped out the moment I do a calculate studies via "apply" in studies window. Is this normal behavior? It draws line on the Low so once the candle is closed, values should remain persistent right? I am just having one of those days with SC :-( |
[2023-08-02 13:51:56] |
Sawtooth - Posts: 4220 |
Is this normal behavior?
This sounds like it might be a calculation precedence issue.Chart Studies: Study Calculation Precedence And Related Issues Do the lines reappear when you do a Chart >> Recalculate? Does it do this if you use that same formula on a chart with no other studies? |
[2023-08-03 10:41:27] |
User61168 - Posts: 442 |
Thanks for the link Tom. Recalculate does put all the lines back on the chart. Yay! Same formula on a new chart with no other studies does not hide the lines. |
[2023-08-03 13:53:01] |
Sawtooth - Posts: 4220 |
If you can't resolve the calculation precedence issue, you could add the Chart Recalculation - Periodic study.
|
[2023-08-03 20:29:19] |
User61168 - Posts: 442 |
Perfect! I feel this mysterious recalculation issue could also be tied to the market Replay accuracy I notice sporadically between "Calculate Same as Real time" and "Calculate at every tick" setting. You are collecting a ton of good karma with your insightful posts. Thank you! |
To post a message in this thread, you need to log in with your Sierra Chart account: