Go Back   NinjaTrader Support Forum > NinjaTrader 8 > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

NinjaTrader
Reply
 
Thread Tools Display Modes
Old 09-23-2017, 10:12 AM   #1
Ataulfo
Junior Member
 
Join Date: Sep 2017
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default 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!
Ataulfo is offline  
Reply With Quote
Old 09-24-2017, 01:56 PM   #2
NinjaTrader_ChelseaB
NinjaTrader Customer Service
 
NinjaTrader_ChelseaB's Avatar
 
Join Date: Dec 2012
Location: Denver, CO
Posts: 7,688
Thanks: 120
Thanked 1,699 times in 1,601 posts
Default

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#.
http://ninjatrader.com/support/forum...609#post503609
NinjaTrader_ChelseaB is offline  
Reply With Quote
Old 09-26-2017, 04:56 AM   #3
Ataulfo
Junior Member
 
Join Date: Sep 2017
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

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.
Ataulfo is offline  
Reply With Quote
Old 09-26-2017, 10:55 AM   #4
TheIndicatorClub
Junior Member
 
Join Date: Jan 2017
Posts: 12
Thanks: 0
Thanked 6 times in 5 posts
Default 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.

Quote:
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
File Type: zip CustomUpDownVolume.zip (1.8 KB, 16 views)
TheIndicatorClub is offline  
Reply With Quote
Old 09-26-2017, 11:44 AM   #5
Ataulfo
Junior Member
 
Join Date: Sep 2017
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you!! Very much appreciated!

This is what I was looking for.

Cheers!

Ataulfo is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to make a volume indicator that shows volume of that time of day? Drtro Indicator Development 4 10-26-2015 01:41 PM
Modify tick volume and create CVB chart JoshDance Indicator Development 3 05-21-2012 02:00 PM
Create On Balance Volume Alert Fran8 Indicator Development 4 04-03-2012 11:48 AM
How to create alert when volume of future > current contract cw30000 Platform Technical Support 1 03-11-2011 03:44 PM
how to create volume charts? tick charts? Tasuki Platform Technical Support 8 01-03-2011 11:25 AM


All times are GMT -6. The time now is 03:13 AM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content.