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

unirenko as addedseries

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

    unirenko as addedseries

    NinjaTrader_ChelseaB

    HI regarding custom bartype you converted for unirenko
    (Update March 11th, 2020 – Fix for TickReplay, calculates values if bar object is mid-session and have not been calculated as least once) This is a conversion of the UniRenko ‐ Universal Renko BarType developed and originally coded for the NinjaTrader 7 platform by monpere. Please contact the original author for any questions or comments. […]


    Is it possible to have strategy that runs using this custom bar type with added series for same bartype as a higher time frame.

    for some reason i implemented it but I get wrong readings of close and open from Print("Closes0:"+Closes[1][0]);

    I was just wondering if it sould return the right values or not.

    #2
    Hello tkaboris,

    Testing on my end I am not seeing an issue.

    Below is a link to a video of the test. Attached is the test script.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you for detailed test of your indicator.

      I remember I used to do it and it worked too but this time its not working.
      It shows bar index is off and closing prices are off too. Output prints closing price of 18672.75 where actual closing price of that bar is 18671.75. Bar index outputs as 273 but in databx it shows 2015

      In my onbarupdate i Have these prints
      if (CurrentBars[0] < 2 || CurrentBars[1] < 2 ) //Need more than 2 bars to trade
      {
      return;
      }
      Print(string.Format("{0} | BarsInProgress: {1}, Closes[1][1]: {2}, Closes[1][0]: {3}",
      Time[0], BarsInProgress, Closes[1][1], Closes[1][0]));
      Print("CurrentBars[1]"+CurrentBars[1]);
      Print("Closes0:"+Closes[1][0]);
      Print("Opens0"+Opens[1][0]);
      Print("filterEMAHTF"+filterEMAHTF[0]);​

      Click image for larger version

Name:	image.png
Views:	39
Size:	812.3 KB
ID:	1306917


      Comment


        #4
        Hello tkaboris,

        If you use the test script I've provided and follow the exact steps shown in the video, are you seeing different behavior than what is shown in the video?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          To my understanding yes. I made sure I have your logic in my script (i have large script) But i made sure to place prints right after onbarupdate class so not to go anywhere deeper into the logic.

          Comment


            #6
            Hello tkaboris,

            Please test the script I have provided you without making any modifications.

            Test using the exact steps shown in the video.

            If the behavior is different, I will want to schedule a call with you where I can observe you test the script I have provided with the exact steps shown in the video.

            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I am working in barsinprogress 0, your vidoe shows in barsinprogress1,
              Is this the problem?




              if (BarsInProgress == 0)
              {
              if (State != State.Realtime) //Only trades realtime. Ignores historical trades.
              {
              return;
              }


              if (CurrentBars[0] < 2 || CurrentBars[1] < 2 ) //Need more than 2 bars to trade
              {
              return;
              }
              Print(string.Format("{0} | BarsInProgress: {1}, Closes[1][1]: {2}, Closes[1][0]: {3}",
              Time[0], BarsInProgress, Closes[1][1], Closes[1][0]));
              Print("CurrentBars[1]"+CurrentBars[1]);
              Print("Closes0:"+Closes[1][0]);
              Print("Opens0"+Opens[1][0]);
              Print("filterEMAHTF"+filterEMAHTF[0]);​

              Comment


                #8
                Hello tkaboris,

                The added series is BarsInProgress 1. To print the bar information of the added series, when the added series bar updates, this is done in BarsInProgress 1.

                Please let me know if the test script I have provided you and the steps in the video are resulting in different behavior on your end.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hi yes your steps result in different behavior on my end. If we can review it together that would be nice.

                  Comment


                    #10
                    Hello tkaboris,

                    Please send an email to scriptingsupport [at] ninjatrader.com, with the subject line Attn: Chelsea 04455787.

                    In the email please include a link to this forum thread.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello tkaboris,

                      On our call you have let me know that the script I have provided you without any modifications is working correctly as expected just as shown in the video I have provided.

                      This test script and video were provided to show that adding a series with AddDataSeries() and accessing the values do work correctly, and the issue is with the custom code in your script.

                      You can choose to make a copy of this script I have provided you as a base for your script and start adding code to this until the behavior changes. Once the behavior changes, the last modifications are likely responsible for the issue.

                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Hi again.

                        So yesterday I started to create a script from scratch with multi series added and it all was working as suppose to and printing correct values from added series.

                        I added like 50 % of the code and all was printing right values. I made sure to reload historical data and reload ninjascript. All was fine.

                        However this morning, it started to print different values. Is this because I restarted PC?

                        Litterally I am going back to the script i had yesterday and its not printing correct values as it was yeseterday.

                        Last edited by tkaboris; 06-13-2024, 05:37 AM.

                        Comment


                          #13
                          Hello tkaboris,

                          I would not expect restarting or reloading data to cause this behavior (the script would also be reloaded when reloading all historical data).
                          The data provided from AddDataSeries() is provided using the same method that charts are fetching data.

                          Please redownload the test script I have provided in post # 2 and re-import this to ensure there have been no modifications to the script.

                          Is the original test script I have provided you having the same behavior?

                          If the original test script I have provided you is not able to reproduce the behavior, then restarting is not causing the behavior. This would indicate something in your code is causing the behavior.

                          I recommend starting over by copying the test script I have provided you and modifying the copy. Change one line at a time until the behavior returns.
                          What is the last line you modified when the behavior starts?

                          Make sure you are keeping things as simplified as possible. Comment out or remove all other code from the script and focus just on the data being processed in BarsInProgress 1.

                          I also recommend you close all open workspaces and in a new blank workspace open two new charts with no template applied so that there are not other indicators applied, again to keep things simple. Apply only the 1 indicator to the chart, so that there is no confusion about the print output appearing in the output window.

                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello tkaboris,

                            ​You have requested that we take the conversation private through email.
                            Note, I will no longer be responding in this forum thread.
                            Chelsea B.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by psangram, Today, 03:14 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post psangram  
                            Started by giogio1, Today, 02:56 AM
                            0 responses
                            2 views
                            0 likes
                            Last Post giogio1
                            by giogio1
                             
                            Started by Skifree, Today, 02:42 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post Skifree
                            by Skifree
                             
                            Started by cathypriester, Today, 01:50 AM
                            0 responses
                            6 views
                            0 likes
                            Last Post cathypriester  
                            Started by DJ888, 07-11-2024, 09:28 PM
                            3 responses
                            28 views
                            0 likes
                            Last Post CassieQuinn  
                            Working...
                            X