Support Board
Date/Time: Sat, 30 Nov 2024 06:47:57 +0000
[Programming Help] - Auto trading two studies crossover from below to enter
View Count: 3534
[2022-12-05 14:47:08] |
Dean Roberts - Posts: 79 |
Hi All I'm just starting to configure auto trading and I want to know if the below is correct and if i would be better moving up to spreadsheet trading. I have two symbols on one chart with the same studies on each. Between certain times I want to check the ATR is within certain limits and volume is not 200% times the last 5 minutes. I then want to enter a trade if price on Symbol A crosses from below on Study X, and within 5 seconds Symbol B also crosses a Study on its own region of the chart. Can this be written by: Adding alerts to the studies Adding trading system by alert condition. Adding formulas into this trading study for the time/ATR/Volume conditions above? Or do I need to use spreadsheets? Is there someone that could help me write this out there as well please? Much appreciated Cad |
[2022-12-05 22:14:52] |
Sawtooth - Posts: 4123 |
The 5 second window would be the challenging part. Only a custom ACSIL study could find an intrabar time to use for a comparison. What are you using to get 2 symbols on the same chart? Are they the same bar duration? You may need to modify your setup to be able to use some kind of workaround, like chart B with session times with a 5 second offset. I wouldn't bother with the Trading System Based On Alert Condition study for this type of system. Start with the Spreadsheet System for Trading study. It's hard to be more specific without knowing more details. |
[2022-12-05 22:42:25] |
Dean Roberts - Posts: 79 |
Thanks Tom. I do think I will need to advance to spreadsheets but I am literally taking first steps. I'm no programmer but I do use Excel quite a lot in my job so I am intermediate... first thing I'm struggling with is Syntax. I have added ES into region 2 as Price/Study overlay... then added studies against that, using that overlay as 'based on' in their settings. So, I have NQ in Region 1 and ES in Region two with the same studies (daily highs/lows, VWAP, Pivots etc. standard studies). I am looking to scalp when NQ and ES hit these levels at the same time... so I have 30 second charts and will set the alerts to not repeat trigger more than once on the auto trading from alert study. At the moment I want to keep it simple... if NQ crosses VWAP from above... within the same 30 second bar, that ES crosses from above its' own vwap... and when ATR on NQ is between 8-16 for the last three 30 second bars (which I will set in an the ATR study). =AND(CROSSFROMABOVE,ID#.SG#), (CROSSFROMABOVE,ID#.SG#). (ID#.SG#, 8>=8, 16<=16)) The last part being the ATR check. I know it's wrong but I can't find any examples of syntax of these compounded formulas on here. Any help is much appreciated Cad Date Time Of Last Edit: 2022-12-05 22:42:51
|
[2022-12-05 23:27:13] |
Sawtooth - Posts: 4123 |
The Trading System Based On Alert Condition study uses Alert syntax: =AND(CROSSFROMABOVE(C,ID1.SG1), CROSSFROMABOVE(ID4.SG4,ID5.SG1), ID2.SG1>=8,ID2.SG1<=16, ID2.SG1[-1]>=8,ID2.SG1[-1]<=16, ID2.SG1[-2]>=8,ID2.SG1[-2]<=16 ) where: C is the NQ close ID1.SG1 is the NQ VWAP ID4.SG4 is the overlaid ES close ID5.SG1 is the ES VWAP ID2.SG1 is the NQ ATR current bar ID2.SG1[-1] is the NQ ATR 1 bar previous ID2.SG1[-2] is the NQ ATR 2 bars previous Study/Chart Alerts And Scanning https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#CROSSFROMABOVE_Function |
[2022-12-06 10:58:08] |
Dean Roberts - Posts: 79 |
Fantastic, thank you Tom. I presume if I add in a couple more qualifiers, it may become too long and complex for the Trading System Based on Alert and that is when I step up to using the spreadsheets. For intstance; AND ES Crossover from above VWAP NQ Crossover from above VWAP ATR between 8-16 ES Price above RTH Value Area High Line - do I use the price line study or the actually study overlay for ES to assess if ES price in region 2 is higher than ES RTH VAH - ID#.SG#>ID#.SG# ? NQ Volume is high volume - , average(v[-1:0])>average(v[-20:-3])*1.8 Thank you for your continued help. Cad |
[2022-12-06 13:33:05] |
Sawtooth - Posts: 4123 |
Since you have Excel experience, and since your conditions are increasing in complexity, it would seem natural to migrate to the Spreadsheet System for Trading study. To better manage complex conditions, use individual Formula Columns to separate conditions, then combine them in K3/M3. do I use the price line study or the actually study overlay for ES to assess if ES price
Use ID#.SG4 of the Study/Price Overlay study.
|
[2022-12-06 13:38:43] |
Dean Roberts - Posts: 79 |
I'm getting Syntax error with the below, could you help please? =AND ( CROSSFROMABOVE(C,ID15.SG2), CROSSFROMABOVE(ID1.SG4,ID4.SG4), ID22.SG2>=8,ID22.SG2<=16, ID22.SG2[-1]>=8,ID22.SG2[-1]<=16, ID22.SG2[-2]>=8,ID22.SG2[-2]<=16 ) The thing is that ID1.SG4 - the price/study overlay of ES from another chart - SG4 is 'last' (there is Open, high, low, and Last) and when I try to make Open and Last visible it won't accept the changes and they go back to 'ignore'. And the ID4.SG4 is not an overlay from the other chart... but a Volume By Price based directly on the overlay ES study on this chart. So I presume I have something wrong? Thanks again Cad |
[2022-12-06 13:40:09] |
Dean Roberts - Posts: 79 |
I will definitely be moving over to spreadsheets... it will just be nice to get something simple working and get better at the syntax. Cad |
[2022-12-06 13:55:57] |
Dean Roberts - Posts: 79 |
High level spreadsheet formula question please - is there a formula structure that can check Price has crossed over (from above) a level (VWAP for instance) over 10 bars ago but less than 30 (for instance)... Remained above the level by x points for 3-10 bars... Then crossover from below, and within 1 bar, crosses from above again... Place a sell order here... i.e. a method of trading a pull back to a level it has already crossed? Thank you. Cad |
[2022-12-06 14:13:10] |
Sawtooth - Posts: 4123 |
Since you will be moving to a spreadsheet study, which uses spreadsheet syntax, don't bother with making the Alert syntax work. is there a formula structure that can check...
Yes, but it's exceedingly complex, involving creating multiple persistent variables.The concept of isolating a pullback entry using an algo is nowhere near as easy as what your eye sees. There are just too many caveats to consider. From experience, it will likely find more bad entries than good entries, and ignore more good entries than bad entries. |
[2022-12-06 14:23:49] |
Dean Roberts - Posts: 79 |
That makes logical sense... I'll keep it simple. Why is the study price overlay ID#.SG4 (last) not taking as a setting? I would still like to get a simple cross from below on two studies - one from region 1 and a second from region 2 - working if possible? That identifier for the study price overlay main ES price study seems to be the problem? Thanks Cad |
[2022-12-06 16:58:05] |
Sawtooth - Posts: 4123 |
when I try to make Open and Last visible it won't accept the changes and they go back to 'ignore'
You need to overlay the Main Price Graph so that all 4 (OHLC) values will produce a candlestick in region 2.See attached for my settings. Then add the VWAP and set its Based On to the overlay study, and chart region 2 Now you have Region 1 with NQ and its VWAP, and Region 2 with ES and its VWAP. Now you can reference Region 1's Close and VWAP with C, ID#.SG1 and Region 2's Close and VWAP with ID#.SG4, ID#.SG1 BTW, there are no occurrences where both the NQ and ES cross their VWAPs in the same bar. Date Time Of Last Edit: 2022-12-06 17:28:14
|
Overlay settings.PNG / V - Attached On 2022-12-06 16:57:45 UTC - Size: 44.54 KB - 104 views Overlay settings2.PNG / V - Attached On 2022-12-06 16:57:54 UTC - Size: 45.77 KB - 89 views Overlaid ES.PNG / V - Attached On 2022-12-06 17:28:08 UTC - Size: 38.63 KB - 180 views |
[2022-12-08 12:21:54] |
Dean Roberts - Posts: 79 |
Thanks Tom VWAP was just for discussion - I'm actually trying to align a bounce from NQ Levels (mainly Developing RTH and ETH Value Area high and low lines) when ES crosses major levels... Basically, I am trying to scalp when NQ is at it's Value Arean range extreme, into the range - supported by when ES hits a level (pivots, VWAP, previous highs and lows etc.) so that the bounce back from NQ VAH/Ls is supported by ES traders entering for a bounce against major ES levels... I have noticed this visually but want to back test this theory using the spreadsheets and add some controlling operaters to the formulas - perhaps based on angle of moving averages/VWAP and increasing volume/ATR etc. Much appreciated CAD |
To post a message in this thread, you need to log in with your Sierra Chart account: