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

Volume indicator drawing arrows on charts

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

    Volume indicator drawing arrows on charts

    I have an indicator and I am having hard time with a few things.

    I would like to view a 5 minute chart but when the volume for the day is .5 of the average volume for the past 20 days I want it to put an arrow on the chart.

    The problem I am having is how to get the 5 minute chart and get an average daily volume?
    I cant find where to do this.

    Also how do I tell the program to put an arrow "when" the volume reaches .5 of the average daily volume. I know it can place arrows on price based on price data but Im not sure I can do it with volume. Would I have to create a different indicator then place the arrows based off of the secondary indicators signals or can this do it without this "help"

    Any help would be greatly appreciated.

    #2
    Hello illcrx,
    You have to build a multi series indicator to do it. Please refer to our help guide to know more about multi-series


    A basic code in your case will be like

    In initialize
    Add(PeriodType.Day, 1);

    in OnBarUpdate
    Code:
    protected override void OnBarUpdate()
    {
    	if (CurrentBars[0] <0 || CurrentBars[1] < 0) return;
    	
    	
    	if (BarsInProgress == 0)
    	{
    		if (VOL()[0] > SMA(Volumes[1], 20)[0] / 2 )
    		{
    		
    			//do something
    		}
    	}
    }



    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Great, thanks for the quick response I'll check out those links!

      Comment


        #4
        Errors when compiling

        I am putting this here instead of a new thread because I dont want to hijack the Indicator Development thread.

        Check out this picture, I am getting errors on lines where there are no text, or where there are comments.

        I had an error before where I always got an error on line 37 no matter what, even when I compiled existing prebuilt indicators.

        I also uploaded the code so you can try yourself, last time I had erroneous errors, it compiled fine for other people but not me, I had to delete all of my files and re install Ninja. I really dont want to have to do this once a week.
        Attached Files

        Comment


          #5
          Hello illcrx,
          You have another code namely AvgVol, that has programming errors. Unless you rectify it no other NinjaScript code will get compiled or imported.
          JoydeepNinjaTrader Customer Service

          Comment


            #6
            Ok so you cant have any errors anywhere, now I get it. I had to delete a few programs then lol.

            Thanks for your help!

            Comment


              #7
              Hello illcrx,
              Yes, when you compile a NinjaScript code all the files gets compiled and not just that code.
              JoydeepNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rocketman7, Today, 01:00 AM
              0 responses
              1 view
              0 likes
              Last Post rocketman7  
              Started by wzgy0920, 04-20-2024, 06:09 PM
              2 responses
              27 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 02-22-2024, 01:11 AM
              5 responses
              32 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 04-23-2024, 09:53 PM
              2 responses
              74 views
              0 likes
              Last Post wzgy0920  
              Started by Kensonprib, 04-28-2021, 10:11 AM
              5 responses
              193 views
              0 likes
              Last Post Hasadafa  
              Working...
              X