Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Updated Fractals indicator by Bill Williams - Upper/Lower index issue in strategy?

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

    Updated Fractals indicator by Bill Williams - Upper/Lower index issue in strategy?

    Thanks to Paul and Kane for updating the BWFractal indicator to make it more strategy friendly. Timing could not have been better. The updated indicator works perfectly as an indicator.

    However I have ruin into a minor issue when using this in a strategy, a strategy that simply checks various indicators when a fractal is confirmed. The strategy calculates on Calculate.OnBarClose; At that time I check the _fractal.Upper[3] or _fractal.Lower[3] for a non-zero value to see if a new pivot has formed. However when a pivot forms on screen when the 3rd bar after the pivot forms, is is actually the Upper/Lower[2] value that is set. Pls see the attachment. I am new to c#. I can decipher some of your logic - but struggle in the overall context of NT8.

    I can check for a value in the second position but that seems cheating. I would appreciate any insights and hopefully avoid/help others running into the same issue.

    Thanks in advance, Lex


    Click image for larger version

Name:	PAUL 2021-09-17_20-05-28.png
Views:	1047
Size:	341.9 KB
ID:	1171479





    #2
    Hello grzltn,

    Thanks for your post and welcome to the NinjaTrader forums!

    Just to clarify, neither Kane nor I created the indicator. The indicator was originally created in NinjaTrader7 by forum member Gains who is likely no longer around the forums. When NinjaTrader8 was created we (the ninjascript support team) converted most of the forum indicators, strategies, and misc files to work with NinjaTrader8. We do not necessarily understand the logic of what we convert.

    If you can pull the value from 2 bars ago and it matches what the fractal value is then you should be good to go.

    Comment


      #3
      Thanks Paul. Thing is that the indicator inherits the Calculate.OnBarClose from the strategy. If one uses the other Calculate options it actually uses the 3rd Upper/Lower and create unpredictable results. I had hoped you may have a clue on how to fix this. Or perhaps now this is posted another member with subject matter expertise with ideas on how to solve as the indicator is pretty versatile? Thank you for the very prompt response!

      Comment


        #4
        Hello grzltn,

        Thanks for your reply.

        When you are checking for a fractal on historical data OR are running the strategy with Calculate.OnBarClose, then you can reference [3] for the fractal. When you are running the strategy with Calculate.OnpriceChange or Calculate.OnEachTick AND are on live (or playback with market replay data) then you would use [2].

        You could use check of the "state" to set the bars ago to use, for example

        myBarsAgo = 3;

        if (State == State.RealTime)
        {
        myBarsAgo = 2;
        }


        BwFractal.Upper[myBarsAgo]

        Comment


          #5
          Hello grzltn,

          Looking at this further, I don't see any reason why you would not be able to use [2] for both historical and real time.

          Try printing out the fractal values, on each bar, of the currentbar[0], and [1] and [2] and [3] to confirm.

          Comment


            #6
            Thanks again Paul - and a good approach. I worked out it is not the indicator but the business logic in NT8. For the OnBarClose status is as stated "on the completion of the bar" - and not the RHS bar still in formation. For the OnBarClose, bar[0] is the actually second one from the right. Definitely a trap for new players!! So your recommendation is perfect as using this approach ensures that business logic is preserved when the strategy setting is updated. Definitely a trap for new players!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            52 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            70 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            44 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            49 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X