Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Swing indicator within strategies

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

    Swing indicator within strategies

    In strategy script, SwingHigh and SwingLow values are incorrectly calculated by Swing indicator if Calulate Mode is "per tick" instead of "on bar close".

    With NT7 the solution was to create a named instance of the swing indicator an asign it the correct propertie:

    this.MySwing = Swing(str);
    this.MySwing.CalculateOnBarClose = true;


    In NT8 the equivalent I suppose is:

    this.MySwing = Swing(str);
    this.MySwing.Calculate= Calculate.OnBarClose;


    But in this case, the calculated values for SwingHigh and SwingLow ara incorrect and this workaround, that is ok for NT7, doesn't work with NT8.

    I would appreciate any sugestion that help me to solve this problem.

    Thanks in advance

    #2
    Hello lillomur,

    Thank you for your post.

    I am not seeing incorrect values in either NinjaTrader 8 or 7 when setting the Calculate for the indicator separate from the strategy. I am using Update() on the swing indicator in OnBarUpdate(), are you doing this as well?

    You can find my two test strategies attached.

    I look forward to your response.
    Attached Files

    Comment


      #3
      Hi PatrickH,

      Iv'e tried with your strategy "TestSwingHosted.cs" and the problem persists.

      As you can see in the image attached, in this example ( Strength = 15) SwingMin is calculated correctly up to 9:22 bar, but after that, de value change from 1.7327 to 1.7273.

      In this case SwingMax remain ok, but other times both values are incorrect.

      For NT7 I found the solution in this thread http://www.ninjatrader.com/support/f...ad.php?t=48386 and I thought would be the same in NT8.


      Thanks a lot for your help.
      Attached Files

      Comment


        #4
        Hello lillomur,

        Thank you for your response.

        The strategies I provided use a 5 strength Swing, can you confirm you changed this in code to 15 and compiled? If you leave the strategies at 5 strength and add a 5 strength Swing to the chart does it then report correctly?

        I look forward to your response.

        Comment


          #5
          Yes I did, I changed and compile the strength value to 15 before the test.

          I've tested right now with strength=5 and again the values are incorrect, as you can see in the attached image.


          My NT8 release is 8.0.10.0 64-bit (Standard)
          Attached Files

          Comment


            #6
            Hello lillomur,

            Thank you for your patience.

            I am unable to reproduce the same behavior on my end.

            Please send me your log and trace files so that I may look into what occurred. You can do this by going to the Control Center-> Help-> Email Support. Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

            Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

            I look forward to assisting you further.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by sidlercom80, Today, 02:40 AM
            0 responses
            11 views
            0 likes
            Last Post sidlercom80  
            Started by b16_aln, Today, 01:52 AM
            0 responses
            11 views
            0 likes
            Last Post b16_aln
            by b16_aln
             
            Started by junkone, Yesterday, 08:55 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by adaeiqendqw, 01-16-2021, 02:56 AM
            1 response
            16 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by [email protected], Yesterday, 06:10 PM
            5 responses
            17 views
            0 likes
            Last Post NinjaTrader_ChrisSch  
            Working...
            X