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

Help to create a new volume indicator

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

    Help to create a new volume indicator

    Hi,

    I have an idea to create a new volume indicator but I need help to develop it since I am not a programmer. I think that I have solved the formula, so I would only need help to write the code to create a Ninjatrader indicator.


    I think that the idea is very simple but also very powerful.
    It would be similar to the indicator volume up/down but plotting 2 volumes for each candle (1 for up and 1 for down).


    The up volume and the down volume for each candle would be calculated from the percentage of the body candle.
    In case that the bar is a perfect doji, and the opening price is the same as the closing price, up and down volumes would be 50% each.
    In case that the body is 30% of the candle in an up bar, the up volume would be 65% of the total volume, calculated as 30 + (70/2) because the wicks would be 50% of the volume each (up/down).


    I believe that the code would be something like this:

    Input data: Volume, Open, High, Low & Close

    Variables:
    UpBar (Boolean)
    Body (% of candle)= ((Open-Close) x 100) / (High – Low)
    Wicks (% of candle) = 100 – “ Body”

    IF (Open < Close){UpBar=True}
    IF (UpBar=True) { UpVolume = (Body + (Wicks/2)) x (Volume /100) }
    ELSE { UpVolume = (Wicks/2) x (Volume/100) }

    DownVolume= Volume UpVolume

    UpVolume (Output this data)
    DownVolume (Output this data)
    Plot UpVolume and DownVolume

    ….


    I think that this is the right formula but I am not completely sure, so is there anybody that could help me to write the code?


    The goal is to create a new indicator with the outputs I propose here, similar to a MACD based on 3 volumes (total, up, and down)


    Thanks!

    #2
    Hello Ataulfo,

    This thread will remain open for any community members that would like to create this script as a convenience to you.

    In the support department at NinjaTrader it is against our policy to create, debug, or modify code or logic for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.

    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.


    Below I am providing a link to a forum post with helpful information about getting started creating NinjaScript Indicators and Strategies in C#.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello NinjaTrader_ChelseaB,

      Thanks for the links. I will try to create the indicator myself. Anyway i think that this indicator can be helpful also for another people and not only for me so any help from any comunity member who likes the idea will be very apreciated.

      Comment


        #4
        Try this

        Is this what you are trying to do? I multiply the body percent by Volume[0] and assign that to Up or DownVolume based on the candle direction, or if there is a doji I make Up and DownVolume equal to Volume[0] / 2.

        If you set iDebug to false, it will turn off the prints and draw objects.

        Originally posted by Ataulfo View Post
        Hello NinjaTrader_ChelseaB,

        Thanks for the links. I will try to create the indicator myself. Anyway i think that this indicator can be helpful also for another people and not only for me so any help from any comunity member who likes the idea will be very apreciated.
        Attached Files

        Comment


          #5
          Thank you!! Very much appreciated!

          This is what I was looking for.

          Cheers!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CortexZenUSA, Today, 12:53 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by CortexZenUSA, Today, 12:46 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by usazencortex, Today, 12:43 AM
          0 responses
          5 views
          0 likes
          Last Post usazencortex  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          168 responses
          2,266 views
          0 likes
          Last Post sidlercom80  
          Started by Barry Milan, Yesterday, 10:35 PM
          3 responses
          13 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X