NinjaTrader Support Forum Help to create a new volume indicator

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

 09-23-2017, 10:12 AM #1 Ataulfo Junior Member   Join Date: Sep 2017 Posts: 3 Thanks: 0 Thanked 0 times in 0 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!
 09-26-2017, 04:56 AM #3 Ataulfo Junior Member   Join Date: Sep 2017 Posts: 3 Thanks: 0 Thanked 0 times in 0 posts 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.
09-26-2017, 10:55 AM   #4
TheIndicatorClub
Junior Member

Join Date: Jan 2017
Posts: 12
Thanks: 0
Thanked 6 times in 5 posts
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 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
 CustomUpDownVolume.zip (1.8 KB, 24 views)

 09-26-2017, 11:44 AM #5 Ataulfo Junior Member   Join Date: Sep 2017 Posts: 3 Thanks: 0 Thanked 0 times in 0 posts Thank you!! Very much appreciated! This is what I was looking for. Cheers!

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News and Announcements     News and Announcements NinjaTrader 8     Platform Technical Support     Add-On Development     Indicator Development     Strategy Development NinjaTrader 7     Platform Technical Support     General Development     Indicator Development     Strategy Development NinjaScript File Sharing     NinjaScript File Sharing Discussion     Version 8 Add-Ons     Version 8 Indicators     Version 8 Strategies     Version 7 Indicators     Version 7 Strategies     Version 7 Miscellaneous NinjaScript Educational Resources     Reference Samples     Tips Suggestions and Feedback     Suggestions And Feedback Historical Beta Archive     Version 8 Beta

 Similar Threads Thread Thread Starter Forum Replies Last Post Drtro Indicator Development 4 10-26-2015 01:41 PM JoshDance Indicator Development 3 05-21-2012 02:00 PM Fran8 Indicator Development 4 04-03-2012 11:48 AM cw30000 Platform Technical Support 1 03-11-2011 03:44 PM Tasuki Platform Technical Support 8 01-03-2011 11:25 AM

All times are GMT -6. The time now is 08:26 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.