Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Referring to bug #2 (that we agreed was not a bug), Wilders's rule states ... "If short, never move the SAR for tomorrow below the previous days high or today's high ...".
Looking at the attached chart, as soon as bar #2 was complete, the SAR for bar #3 (today) would be calculated, and based in the above rule, should not be below the high of bar #1 or bar#2. But bar #3 triggered the stop somewhere below the high of bar #1, thus breaching wilders rule, resulting the next 13 SAR plots all being incorrect.
I'd appreciate your thoughts. Perhaps I have missed something.
Cheers
CPR
Can you help answer these questions from other members on NexusFi?
Yes, looks strange. My chart is different. As I do not have the same data provider for FOREX. If you wish exact comparisons, please do not use FOREX data, as there are too many ECNs around. An instrument traded at one exchange only would be better to do comparisons.
Thanks for checking. So we are back to 2 bugs in NT's Parabolic code.
Regarding bug #1 (raising or lowering the SAR), further investigation indicates it is an intermittent bug, which could explain why NinjaTrader's programmers missed it.
Examination of lower timeframe data shows there are times when raising (or lowering) the SAR is correct. One example is when price (in a downtrend) rallies and breaches the upper SAR (which immediately creates a new lower SAR), but then quickly crashes through the newly created lower SAR. The only option is to print a higher SAR. But unfortunately there are cases with NinjaTrader raises or lowers the SAR for no apparent reason. On example is the attached chart. Examination of tick data shows NinjaTrader's plot (circled) is incorrect.
Your PSAR looks good. I like the way you identify on the chart the exact level at which the SAR was triggered.
The two attached charts compare your PSAR with NinjaTrader's (large blue plots). Generally, NT's plots are correct, but there are times when NT's plots are a complete mess, as seen on chart #1.
I also compared your PSAR with mine, and mostly our plots match perfectly. There are some instances of minor deviation, and I suspect this is due to different approaches we took to rounding. In developing my PSAR I used the prices in Wilder's book as test data, and I ensured that my program perfectly matched all calculations in the book, including partial calculations. The only way I could do this was by careful use of the rounding function. I have marked on chart #1 an example where our plots deviated by up to 3 pips, which is pretty good compared with NT's plots which at times is incorrect by up to 50 pips or more.
Chart #2 (NDX) shows examples of your SAR being triggered within price gaps. Obviously this would not occur in real trading. Another approach might be to move the SAR to the opening price to indicate the "fill" if the SAR is triggered within a gap.
My knowledge of C# is limited, so I can't see any obvious issues with your PSAR code. However it seems to assume that the initial high and low will occur within the first 10 bars. This is unlikely to be a problem with liquid instruments, however it may cause problems with less liquid markets. Another approach is to initially locate the first high and low irrespective of where they occur, and then set a variable to indicate they have been located.
Of course I do not know your exact coding logic. The rules I have used are as follows
-> The first value for the stop is the extreme point (in this case low point) of the prior downtrend (Wilder does not show this stop on his charts, but I have decided to show both old and new stop for the reversal bar).
-> The second value is calculated by applying the minimum acceleration of 0.02 (no new high) or the increased acceleration of 0.04 (case new high > prior high) to the difference between the new extreme point and the previous value for the PSAR.
Afterwards the usual rules for the PSAR are followed.
If there are discrepancies, they might be data related, as not all data feeds show the same values.
The price gaps are no problem. The PSAR is calculated from the prior bar, so it is available prior to the start of the trading day. If price gaps beyond the stop line, the position will be reversed with the opening of the session.
My logic was to initially locate the first high and the first low, and then use whichever came first to begin calculating subsequent plots as early as possible.
I am not saying this is better. It's just the logic I chose to locate the earliest plot, and to prevent problems with less liquid instruments.
Your assumption that data is the cause of plot differences is not correct. I used precisely the same data to compare our PSARs.
The biggest discrepancy I found was 3 pips, so it may not be an issue, depending of course on what you intend to do with your PSAR.
SARDiff and AFxDiff aren't needed in the calculation, however I coded them anyway to cross check against Wilder's partial numbers.
DecimalDigits is a variable that contains the number of decimal values in the price of the instrument. This could account for the differences in our SAR plots. However, if I didn't round NextSAR the results often failed to match Wilder's numbers.
I can' recall where I saw the 3 pip variance, however the attached chart (AUDJPY) shows an example of 2 pip variances which occurred on 24/11/06 and 27/11/06 (Aussie time).
I also have attached two data files (AUDJPY and NDX) which include my PSAR values for each day. If you extract your PSAR values into Excel, you can run a comparison to locate all the differences. The data originates from Kinetick, if needed.