| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Help reading the ZigZag... https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4931 |
Page 1 of 1 |
| Author: | Bruster400 [ Tue Oct 04, 2016 10:53 am ] |
| Post subject: | Help reading the ZigZag... |
Hi, I'm looking at adding some automation to a manual trading system and I need to reference the recent highs and lows on the ZigZag indicator. Before I get blasted... yes, I know that it repaints the previous point but that's why I'm looking to reference points before this. From looking at the code it appears that ZigZag stores the price of each point in buffer0 where i is a standard count of bars back from now. I've seen a couple of support and resistance indicators that reference this but they call all the bars back to "limit" and it's very cpu hungry. I only need the most recent few points so I was trying to call from bar 1 working up (i++) rather than down. I've written the following code to try to populate 5 price doubles with the price of the last 5 high and low points held by the ZigZag indicator. Code: Select all The problem I've got is that this code seems to only half work. Sometimes it's great and the 5 variables are perfect. Other times, the 5 variables all have valid zz points but some of the points have been missed out in between. So the variables 1 to 5 are actually populated with zz points 1,2,4,6,8 for example. With the zigzag indicator on a craptester chart alongside this code in an EA I can see the missed points but I have no idea why they are not populating correctly. Yes, I have the inputs the same in the indicator and the EA. Can anyone spot the error? Does anyone know of a better way to get the values out - without having to look back through all the bars each time!? Any help appreciated. Thanks Bruster. |
|
| Author: | afeudale [ Tue Nov 15, 2016 3:56 am ] |
| Post subject: | Help reading the ZigZag... |
Just read through your post quickly, but I struggled with a similar issue (getting values from a range trading indicator) and iCustom just wasn't cutting it. Instead, I wrote some code where it scanned the trendlines themselves, then found which trendline was most recent and got the value directly, rather than the iCustom call. It works great now. Basically this (replace the ZigZag line name where it shows LRC): Code: Select all |
|
| Author: | renexxxx [ Tue Nov 15, 2016 7:22 am ] |
| Post subject: | Help reading the ZigZag... |
Hi Bruster, I don't understand your code ... but I would do something like this: Code: Select all |
|
| Author: | Bruster400 [ Tue Nov 15, 2016 10:00 am ] |
| Post subject: | Help reading the ZigZag... |
Lol!! In truth, I had the right idea of scanning back through the points and recording the values as they appeared (>0) but I was clearly going about it the wrong way. Dropping them into an array until it's full is eminently more sensible. Thanks very much for your help renexxxx! afeudale, Thanks for you help too, really appreciate it! I had tried looking at object lines using a separate indicator but I want to keep this as simple (and cpu easy) as possible so I need to look for the zigzag points directly. |
|
| Author: | ruktoa [ Tue Nov 29, 2016 1:45 pm ] |
| Post subject: | Help reading the ZigZag... |
Here is my changed version of "ZigZag" indicator.
|
|
| Author: | Bruster400 [ Tue Nov 29, 2016 8:44 pm ] |
| Post subject: | Help reading the ZigZag... |
Thanks for this version. I knew that the Metaquotes zigzag was incorrectly coded due to the deviation input not working. However, that doesn't mean that it's meaningless. Check out this thread by Big Be » Mon Dec 17, 2012 4:19 am for an in-depth review of the intended purpose of the indicator and what the deviation input is supposed to do. He's also posted a corrected version of the indicator which is now the one I use. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|