Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Polarized Fractal Efficiency

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Polarized Fractal Efficiency

    I tried out this indicator, observed some odd results, and looked at the help info here:



    Here are some questions/comments:

    1) The NT implementation of the formula from FM Labs http://www.fmlabs.com/reference/default.htm?url=PFE.htm does not look quite right.
    Help says Period = "Number of bars used in the calculation". But the NT implementation in beta 15 is using 2 MORE bars than user has requested.
    Part of the code is apparently trying to calculate the Hypotenuse for a triangle whose horizontal length is Period bars. But instead of the correct Period-1 it uses Period+1 when calculating the "length" of the vertical side. As a result the "Hypotenuse" calculated is from the sides of two different triangles!

    I think the formula published on the FM Labs has an error (unless the +1 was some sort of traders adjustment).


    2) The FM Labs formula is quite different to the Metastock formula in this article: http://transcripts.fxstreet.com/2005...zed_fract.html
    I have implemented this in NT and got quite different results to the current NT PFE.

    Can anyone recommend a good maths/finance book that might help in deciding between the merits of these type of formulas that are supposed to measure fractal properties?
    Currently the Metastock version looks more reasonable to me.


    3) In trying to get a reasonable scale between the height (price difference) and width (time or range-bar sequence) of the triangle, I think it may be necessary to use Instrument.MasterInstrument.PointValue in the NT implementation? Otherwise instruments with large PointValue (such as FX) are using extremely flat triangles in the existing calculations (at least with small-timescale charts).



    4) The use of (Close[0] < Close[1] ? -1: 1)
    This introduces a positive bias into the result.
    If a chart is in use with a significant number of sequential bars with the same Close value, then the bias can be large. This often happens in Range charts if instrument is in consolidation (e.g. a horizontal sequence of red/green bars). In this case the current indicator rarely goes below zero (even in an obvious downturn).
    Perhaps there should be another Parameter say "Bias" with the following values +1 (current method), 0 (no bias), -1 (negative bias - more useful to Shorters)?

    #2
    Dave,

    1) What are you going off of that you think the FM Labs indicator reference is incorrect on there website? From what I can tell the NinjaTrader PFe coded matchs the FM Labs code.

    2) I do not have any recommendations on a book however some other users may have a recommendation.

    3) Can you please post your code that you used to implement the metastock version? So that I may check to see if I see any errors?

    4) I guess I dont understand what you are mentioning here. Im not seeing how this gives a bias as the values are 1 or -1 based on if the close is below or higher then the close of he previous bar.

    Any other information here would be appreciated so that I can pass on to the developers.

    Comment


      #3
      Brett,

      Thanks for the reply.

      1. I have not seen the FM Labs code, only their formula. I agree that the NT code is an accurate translation of their formula. But I dont think their formula is correct.
      Their site says the formula is from "Hans Hanulla". But since my first post I see that this is a pen name for the person behind this "Market Astrophysics" site http://moneytide.com/hans/index.asp
      So perhaps +1 was used instead of -1, due to the lunar phase at the time. LOL.

      3. I may post my implementation of the Metastock version later. But I'm not trying to identify an error in my code. I'm asking anyone, who might be interested in using this NT PFE indicator, whether the formula its based on is actually correct.

      4. The positive bias is introduced when the current close is the same as the previous close. This may only affect certain types of data-series.

      Comment


        #4
        DaveE,

        Thanks for that information.

        Since I'm not that familiar with this indicator personally I would need to see an implementation of the indicator that proves that the indicator code is incorrect to send in to development so that we can make changes. Otherwise it is my assumption the the FMLabs website is correct. Also about the Bias this makes since, however I believe this is the nature of the indicator as developed from the forumula at FMLabs. Other users may be able to post their own experiences however.

        Let me know if I can be of further assistance.

        Comment


          #5
          I asked an Ivy League Mathematics Professor, an expert on fractals and markets, to look at the formula http://www.fmlabs.com/reference/default.htm?url=PFE.htm

          What connection do you think he could he find with fractals?
          Answer: "none whatsoever"!

          I suggest that NinjaTrader look elsewhere for a reliable Fractal formula.

          Comment


            #6
            Dave,

            Thanks for the tip. I will let development know. I am not a master mathematician so I cannot either dispute or verify these finding but I will pass on to development.

            Thank You.

            Comment


              #7
              Polarized Fractal Efficiency ( PFE )

              The PFE that comes with NinjaTrader 7 is not correct. It uses period as a smoothing value. Here is the correct formula. Works perfect.



              protected override void OnBarUpdate()
              {
              if (CurrentBar <= Period)
              return;

              double Path1 = Math.Sqrt(Math.Pow(Close[0] - Close[Period],2) + Math.Pow(Period,2));
              double Path2 = 0;
              double numsum = 0;
              int i = 0;

              for(i=0;i<Period;i++)
              {

              numsum = Math.Sqrt(Math.Pow(Close[i] - Close[i-1],2)+1);

              Path2 = Path2 + numsum;

              }


              pfeSeries.Set(Math.Sign(Close[0] - Close[Period]) * Path1 / Path2 * 100);

              Value.Set(EMA(pfeSeries, 10)[0]); // the 10 in this statement is a smoothing value. So there should be two user defined values, period and smoothing.



              }

              Comment


                #8
                MacProgammer,

                Thanks for posting. I will send into development for them to look into.

                Also, welcome to the forums!

                Let me know if I can be of further assistance.

                Comment


                  #9
                  Originally posted by macprogrammer View Post
                  The PFE that comes with NinjaTrader 7 is not correct. It uses period as a smoothing value. Here is the correct formula. Works perfect.



                  protected override void OnBarUpdate()
                  {
                  if (CurrentBar <= Period)
                  return;

                  double Path1 = Math.Sqrt(Math.Pow(Close[0] - Close[Period],2) + Math.Pow(Period,2));
                  double Path2 = 0;
                  double numsum = 0;
                  int i = 0;

                  for(i=0;i<Period;i++)
                  {

                  numsum = Math.Sqrt(Math.Pow(Close[i] - Close[i-1],2)+1);

                  Path2 = Path2 + numsum;

                  }


                  pfeSeries.Set(Math.Sign(Close[0] - Close[Period]) * Path1 / Path2 * 100);

                  Value.Set(EMA(pfeSeries, 10)[0]); // the 10 in this statement is a smoothing value. So there should be two user defined values, period and smoothing.



                  }
                  macprogrammer...could you perhaps show a screen shot or two on the way this revised indicator looks and works...??

                  Thanks...

                  Comment


                    #10
                    Hello,

                    Your comments on smoothing for the PFE indicator are justified. I have sent into development and we are adding this in next beta release for PFE.

                    Thanks for posting!

                    Let me know if I can be of further assistance.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Torontobluejays, Yesterday, 08:43 AM
                    4 responses
                    21 views
                    0 likes
                    Last Post Torontobluejays  
                    Started by Ticks_66, Today, 09:50 AM
                    2 responses
                    9 views
                    0 likes
                    Last Post Ticks_66  
                    Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
                    7 responses
                    27 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by iceman2018, Today, 11:46 AM
                    1 response
                    4 views
                    0 likes
                    Last Post NinjaTrader_Erick  
                    Started by akuntysh, 05-18-2018, 03:39 AM
                    11 responses
                    810 views
                    0 likes
                    Last Post Leeroy_Jenkins  
                    Working...
                    X