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

Can you add() 'weekly' bars to a minute chart in script?

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

    Can you add() 'weekly' bars to a minute chart in script?

    Hello.

    I am developing a MTF indicator that I want to use to collect info on a few different TFs. I've done this many times before, but never trying to add a 'weekly' period.

    Adding onto a minute chart, it doesn't seem to want to recognize the added bar series.

    Just starting, plotting a line at bar close of each added TF. It works fine for the two minute periods, but doesn't seem to do so for the weekly period.

    At this link below, I see 'weekly' isn't one of the listed items, although there is a weekly period type.

    Since this is for FX, I also thought about adding a 7200 minute series, but it only adds a daily. Can a weekly series be added?

    Code:
            protected override void Initialize()
            {
                Overlay				= true;
    			Add(PeriodType.Minute, 360); 	//INdex of 1 CurrentBars[1]
    			Add(PeriodType.Minute, 1440); 	//INdex of 2 CurrentBars[2]
    			Add(PeriodType.Week, 1); 		//INdex of 3 CurrentBars[3]
            }
    
            protected override void OnBarUpdate()
            {
    			if (BarsInProgress ==1 )	//EOD
    				DrawVerticalLine("TF1"+CurrentBar,0,Color.Orange,DashStyle.Dot,1);
    			
    			if (BarsInProgress ==2 )	//EOD
    				DrawVerticalLine("TF2"+CurrentBar,0,Color.Cyan,DashStyle.Dot,2);
    			
    			if (BarsInProgress ==3 )	//EOD
    				DrawVerticalLine("TF3"+CurrentBar,0,Color.Purple,DashStyle.Dot,4);
    
            }

    #2
    Hello forrestang,

    Thank you for writing in.

    Please ensure that you have loaded enough data on your chart that spans at least a week. The data available to your script is limited to the amount you have loaded on your chart and if you do not have enough data, then the Week series will never be called.

    To look at this information, right-click within your chart and select Data Series. The information will be below the "Data" category.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the response Zach.

      I had enough data to display a few weeks, and still didn't show.

      So I added a few years of data to the chart, and now it plots the lines from my script all the way up till the end of last year. But it won't plot this year forward for some reason?

      Seems like some type of template issue? I've tried the standard 'Forex' template as well as the '24/7' template that comes with NT, and it still shows the problem.
      Attached Files

      Comment


        #4
        Hello forrestang,

        I am not able to reproduce this on my end with the code you have provided in your initial post. The purple dots plot to the 21st of February on the $GBPUSD 60 minute chart.

        Do any errors appear in the log tab of the Control Center?
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          There is an orange there that says, "Session Break (Version 7.0.1000.31)".

          Should I post a screen capture of the entire log file?

          Comment


            #6
            Hello forrestang,

            Please export the entire indicator and attach it to your next post so I may test the exact script that you are using.

            To export your script do the following:
            1. Click File -> Utilities -> Export NinjaScript
            2. Enter a unique name for the file in the value for 'File name:'
            3. Select the indicator from the objects list on the left -> click the right facing arrow ">" to add the indicator to the export
            4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


            By default your exported file will be in the following location:
            • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


            Below is a link to the help guide on Exporting NinjaScripts.
            http://www.ninjatrader.com/support/h...nt7/export.htm
            Zachary G.NinjaTrader Customer Service

            Comment


              #7
              Attached file
              Attached Files

              Comment


                #8
                Hello forrestang,

                I've tested the indicator on my end and was not able to run into this behavior.

                As a test, please take the following steps to force NinjaTrader to start without your saved workspace. You will have the option to reopen these after our tests.
                • Shut down NinjaTrader
                • Navigate to (My) Documents\NinjaTrader 7\workspaces
                • Delete the file named "_Workspaces.XML". DO NOT delete the 'workspaces' folder - only delete the '_Workspaces.XML' file within the 'workspaces' folder
                • After deleting this file, restart NinjaTrader which should startup without any workspaces.
                • Once NinjaTrader has started on just the control center, please open a new chart with no custom bar types/indicators/templates and test for issue.
                • *Please note this will not delete your workspace however the new blank workspace will be named Untitled1. If you have a workspace already named Untitled1 however you will not want to save the workspace when exiting NinjaTrader, otherwise it will overwrite it.
                Zachary G.NinjaTrader Customer Service

                Comment


                  #9
                  Ok, I followed the instructions and started up which created the UNtitled1 workspace.

                  I loaded a chart w/o adding anything to it.

                  I then added the indicator to the chart and and it still shows the same issue

                  Comment


                    #10
                    I think I just realized the issue.

                    I opened a weekly chart, and noticed that it only loads data till.... beginning of the the year. So likely the first idea you posted of not actually having the data.

                    I will try to connect to my feed to refill the bars, but it seems there is some maintenance going on with FXCM and can't connect at the moment.

                    I will repost when I am able to verify.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by algospoke, Yesterday, 06:40 PM
                    2 responses
                    19 views
                    0 likes
                    Last Post algospoke  
                    Started by ghoul, Today, 06:02 PM
                    3 responses
                    14 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    45 views
                    0 likes
                    Last Post jeronymite  
                    Started by Barry Milan, Yesterday, 10:35 PM
                    7 responses
                    20 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by AttiM, 02-14-2024, 05:20 PM
                    10 responses
                    181 views
                    0 likes
                    Last Post jeronymite  
                    Working...
                    X