Bugs in NT Parabolic code - NinjaTrader | futures io social day trading
futures io futures trading


Bugs in NT Parabolic code
Updated: Views / Replies:3,624 / 23
Created: by cprtrader Attachments:15

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 15  
 
Thread Tools Search this Thread
 

Bugs in NT Parabolic code

  #11 (permalink)
Trading Apprentice
Adelaide Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 18 since Jun 2012
Thanks: 7 given, 3 received

@Fat Tails,

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

Attached Thumbnails
Bugs in NT Parabolic code-nt-parabolic-bug-006.jpg  
Reply With Quote
 
  #12 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


cprtrader View Post
@Fat Tails,

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

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.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #13 (permalink)
Trading Apprentice
Adelaide Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 18 since Jun 2012
Thanks: 7 given, 3 received


@Fat Tails,

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.

Cheers

CPR

Attached Thumbnails
Bugs in NT Parabolic code-nt-parabolic-bug-005.jpg  
Reply With Quote
 
  #14 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


cprtrader View Post
@Fat Tails,

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.

Cheers

CPR

This is what I can offer:


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).



I will send you the indicator via private message so that you can test it.

Reply With Quote
 
  #15 (permalink)
Trading Apprentice
Adelaide Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 18 since Jun 2012
Thanks: 7 given, 3 received

@Fat Tails,

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.

Hope this helps.

Cheers

CPR

Attached Thumbnails
Bugs in NT Parabolic code-fat-tails-sar-001.jpg   Bugs in NT Parabolic code-fat-tails-sar-002.jpg  
Reply With Quote
The following user says Thank You to cprtrader for this post:
 
  #16 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


cprtrader View Post
@Fat Tails,

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.

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.


cprtrader View Post
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.

Hope this helps.

Cheers

CPR

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.

Reply With Quote
 
  #17 (permalink)
Trading Apprentice
Adelaide Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 18 since Jun 2012
Thanks: 7 given, 3 received

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.

Reply With Quote
 
  #18 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


cprtrader View Post
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.

Could you show me your chart with the 3 pip difference and expose the formulae that you used for calculating the stops?

Reply With Quote
 
  #19 (permalink)
Trading Apprentice
Adelaide Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 18 since Jun 2012
Thanks: 7 given, 3 received

The relevant formulae are as follows,

NextSAR = Round(NextSAR + AccFactor * (CurrSIP - NextSAR), DecimalDigits)
SARDiff = Round(Abs(CurrSIP - NextSAR), DecimalDigits)
AFxDiff = Round(SARDiff * AccFactor, DecimalDigits)

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.

Attached Thumbnails
Bugs in NT Parabolic code-fat-tails-sar-001.jpg  
Attached Files
Register to download File Type: txt FOREX AUDJPY.txt (174.7 KB, 8 views)
Register to download File Type: txt INDEX ^NDX.txt (292.1 KB, 8 views)
Reply With Quote
The following user says Thank You to cprtrader for this post:
 
  #20 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary



cprtrader View Post
The relevant formulae are as follows,

NextSAR = Round(NextSAR + AccFactor * (CurrSIP - NextSAR), DecimalDigits)
SARDiff = Round(Abs(CurrSIP - NextSAR), DecimalDigits)
AFxDiff = Round(SARDiff * AccFactor, DecimalDigits)

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.

I had hoped for a visual comparaison. Extracting that data and building an excel table is too much work for me.

Reply With Quote

Reply



futures io > > > > Bugs in NT Parabolic code

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
NT - How to set ATM Quantity via NT script code Adfra The Elite Circle 1 November 11th, 2013 04:00 AM
NT Change Indicator code vitto The Elite Circle 1 January 30th, 2013 05:31 PM
NT code problem lincor NinjaTrader 8 November 21st, 2012 07:00 AM
Convert this NT code to EL, Please lizmerrill EasyLanguage Programming 8 January 20th, 2011 02:33 PM
Need confirmation of NT code please Saroj NinjaTrader Programming 4 September 26th, 2009 01:51 PM


All times are GMT -4. The time now is 09:44 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-12 in 0.16 seconds with 20 queries on phoenix via your IP 54.221.93.187