Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

MTF + Swing + Draw.Ray + CrossAbove

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

    #46
    Hello Amedeus,

    I'm not sure I'm completely following.

    To confirm, you are supplying a secondary series as the input series to the swing indicator and this is not producing any values when attempting to print the value?

    Or it is producing values when printed, but these values don't match a chart using that series? (As a heads up, the swing indicator changes past values retro-actively)

    Or are you calling a draw method and this is not appearing on the bar its timestamp is within?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #47

      Hey Chelsea, thank you,

      Llime dots should show the secondary swings. That is if the strategy sees the secondary swings as/where they are.
      If applied on the 270, they still should show the swings of the 90 ticks secondary added dataseries.

      Were you talking about prints like those ? : attachment "prints".

      The output of these is like so on the 90 :
      HTML Code:
      29/07/2021 16:53:06 | M2K 09-21 90 Tick |OnBarUpdate |BarsInProgress : 0 |CurrentBar[0] : 28505 |CurrentBars[1] : 28505 |CurrentBars[2] : 9507 |CurrentBars[3] : 2861 |CurrentBars[4] : 488
      29/07/2021 16:53:06 This bar: |s0Wc0_HighBarsAgo0 : 45 |s0Wc0_High1: 2250,4
      29/07/2021 16:53:06 | M2K 09-21 90 Tick |OnBarUpdate |BarsInProgress : 1 |CurrentBar[0] : 28505 |CurrentBars[1] : 28505 |CurrentBars[2] : 9507 |CurrentBars[3] : 2861 |CurrentBars[4] : 488
      29/07/2021 16:53:06 This bar: |s0Wc0_HighBarsAgo1 : 44 |s0Wc1_High1: 2250,4
      and like so on the 270 :
      HTML Code:
      29/07/2021 16:52:12 | M2K 09-21 270 Tick |OnBarUpdate |BarsInProgress : 2 |CurrentBar[0] : 9507 |CurrentBars[1] : 28503 |CurrentBars[2] : 9507 |CurrentBars[3] : 2861 |CurrentBars[4] : 488
      29/07/2021 16:52:33 | M2K 09-21 90 Tick |OnBarUpdate |BarsInProgress : 1 |CurrentBar[0] : 9507 |CurrentBars[1] : 28504 |CurrentBars[2] : 9507 |CurrentBars[3] : 2861 |CurrentBars[4] : 488
      29/07/2021 16:52:33 This bar: |s0Wc0_HighBarsAgo1 : -1 |s0Wc1_High1: 2250,4
      
      29/07/2021 16:53:06 | M2K 09-21 90 Tick |OnBarUpdate |BarsInProgress : 1 |CurrentBar[0] : 9507 |CurrentBars[1] : 28505 |CurrentBars[2] : 9507 |CurrentBars[3] : 2861 |CurrentBars[4] : 488
      29/07/2021 16:53:06 This bar: |s0Wc0_HighBarsAgo1 : -1 |s0Wc1_High1: 2250,4
      
      29/07/2021 16:53:45 | M2K 09-21 270 Tick |OnBarUpdate |BarsInProgress : 0 |CurrentBar[0] : 9508 |CurrentBars[1] : 28506 |CurrentBars[2] : 9508 |CurrentBars[3] : 2861 |CurrentBars[4] : 488
      29/07/2021 16:53:45 This bar: |s0Wc0_HighBarsAgo0 : 98 |s0Wc0_High1: 2244,7
      29/07/2021 16:53:45 | M2K 09-21 90 Tick |OnBarUpdate |BarsInProgress : 1 |CurrentBar[0] : 9508 |CurrentBars[1] : 28506 |CurrentBars[2] : 9508 |CurrentBars[3] : 2861 |CurrentBars[4] : 488
      29/07/2021 16:53:45 This bar: |s0Wc0_HighBarsAgo1 : -1 |s0Wc1_High1: 2250,4
      We can see that s0Wc0_HighBarsAgo1 is -1.
      Would it have to do with the indicator return, like pointed in attachment "return" ?
      If so, then there is no index for s0Wc0_HighBarsAgo1 and Swing0Wc0.mtfSwig0aHighBar1(0, 1, barUpdateLookback).
      Is this not correct ?

      Is this line from the swig not supposed to create the index we want to access ? :
      Code:
      if (saveCurrentBar1 != CurrentBars[1])
      {
      mtfSwig0aHighSwings1[0] = 0; // initializing important internal
      What do you think ? Why is mtfSwig0aHighBar1 not talking when primary and secondary are not the same ?

      What does the swing indicator changes past values retro-actively mean ? How does it affect the lookback of the functions ?
      Attached Files
      Last edited by Amedeus; 07-29-2021, 10:37 AM.

      Comment


        #48
        Hello Amedeus,

        Yes, those would be the prints from the output I am referring to. Using print lets us see the values processed by the script and understand behavior.




        If you are asking if your custom logic is returning a -1, you can add a print below it to confirm, or you could change the value returned to see if it changes, confirming thats the value returned.

        If you are specifically asking about the s0Wc0_HighBarsAgo1 variable and why it has a value of -1, look for where the variable is assigned a value.

        With multi-series scripts, each series is going to be updating independently. Drawing objects and plots are attached to the primary series only. If information is coming from another series, that will appear when the other series updates over the bar of the primary that happens to be open (unless you specify a different primary bar).

        Below is a link to an example of a similar idea. The example gets information from a higher time frame series, and then plots this on the primary series, filling in empty bars with the previous bars info.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #49
          hey Chelsea, thank you very much,

          Quick adjustment.
          As pictured in the attachment, a mistake in the string of the print has been made, apologies.

          s0Wc0_HighBarsAgo1 is the primary swing barsago 1. (from the function Swing0Wc0.mtfSwig0aHighBar0)

          s0Wc1_HighBarsAgo1 is the secondary swing barsago 1. (from the function Swing0Wc0.mtfSwig0aHighBar1)

          But the value printed was like intended : from Swing0Wc0.mtfSwig0aHighBar1, and is -1.



          As we understood the updating independently , when BiP is 1, the value should not be -1 because there is an index for BiP 1. In theory.
          And a value shoud return from the indicator function (Swing0Wc0.mtfSwig0aHighBar1).
          The value should be -1 only when BiP is 0.
          Is this not correct ?

          With this new print focused on the primary only, we see from the output that mtfSwig0aHighBar1 never returns an index value to the strategy.
          Wich begs the question : is the function functional ?

          Basically, mtfSwig0aHighBar1 (secondary function) returns a value when the primary dataseries and the seconadary are the same.

          The sample, from what I could understand of it, would keep the value returned when BiP=1, during BiP=0.
          But in our case, there is no value when BiP=1, for the custom duplicated mtfSwig0aHighBar1.

          Is anything not correct ?
          are we not dealing with a lack of the indicator function, more than with a lack of the strategy "accuracy" ?
          Attached Files
          Last edited by Amedeus; 07-30-2021, 06:03 AM.

          Comment


            #50
            Hello Amedeus,

            This is Jim responding on behalf of Chelsea who is out of the office at this time.

            This thread has gotten rather long, and I am not cure where I can jump in to assist further.

            I can say that if you are trying to find out why your Swing0Wc0.mtfSwig0aHighBar1 function is not returning an expected value, you should follow the code back and use prints to see that exactly it is returning when you reproduce the symptom, and then to follow back how that return value got calculated.

            I cannot say if something is correct or incorrect without reviewing a small example, and there is a quite a bit going on in this thread, as well as with all of the debug prints added.

            Could you prepare a separate test script that just includes enough code to demonstrate your questions and send it to me in an email to scriptingsupport [at] ninjatrader [dot] com with the text "Attn Jim?" (Please include a link to this thread.) I cannot review a full script, but if you implement a certain part in a test script and present a direct question, I may be able to give insight that can help you move forward.

            I look forward to hearing from you.
            JimNinjaTrader Customer Service

            Comment


              #51
              Hey everyone, Chelsea and Jim, thank you very much,

              Attached is a example of a 3 mtf swing ray projection strategy.
              There are plots only if the primary is 90, but it will calculate the specified price periods swings on any timeframe.

              No excuse for anyone who can't test a swing ray now.

              have a great day !
              Attached Files

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Max238, Today, 01:28 AM
              3 responses
              29 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by timko, Today, 06:45 AM
              2 responses
              12 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Started by habeebft, Today, 07:27 AM
              0 responses
              4 views
              0 likes
              Last Post habeebft  
              Started by Tim-c, Today, 03:54 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by rocketman7, Today, 01:00 AM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X