NexusFi: Find Your Edge


Home Menu

 





Help coding DV2 indicator


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Big Mike with 1 posts (0 thanks)
    2. looks_two bigAllan with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 jmagaia with 1 posts (0 thanks)
    1. trending_up 5,287 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
bigAllan
New York City
 
Posts: 2 since Mar 2010
Thanks Given: 0
Thanks Received: 0

Hey guys, I do most of my work in R/Java and am new to ninjatrader. I am trying to write a simple ninjascript based on the DV2. I have wrote out the code, but it does not work properly. I am using yahoo historical pricing for my data. I have attached my script and would appreciate any pointers or tips about what is wrong with my script.

The DV2 indicator from ( Varadi?s RSI(2) Alternative: The DV(2) MarketSci Blog) is calculated as follows: (a) for each trading day calculate: [(close / average of the high and low price) – 1]. And then (b) take the average of today and yesterday’s result.



Thanks,
Allan


Attached Files
Elite Membership required to download: DV2.cs
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Bookmap Global Plus Lifetime + Lifetime Addons For Sale
Platforms and Indicators
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
Prediction Markets & Event Contracts
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
Kharg Island at 6%, Regime Fall at 1.5% -- The Black Swa …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


I think the "-1" is probably meaning one day (or index) old.

Try:

 
Code
                            
            if(CurrentBar 2) return;

            {
                
today = (Close[0] / (.5* (High[0] + Low[0]))) - Close[1];
                
                
Value.Set(.5 * (yesterday today)  );
                
                
yesterday today;
            } 
Also on a side note, please share your R knowledge and code examples, we could use some help in that area.

Downloads - Matlab Functions - Big Mike's Day Trading Forum

If the code I provided above doesn't work let me know, I don't have Ninja loaded so didn't test it.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 jmagaia 
Porto Portugal
 
Experience: Intermediate
Platform: IB
Trading: Stocks
Posts: 15 since Mar 2012
Thanks Given: 9
Thanks Received: 3


bigAllan View Post
Hey guys, I do most of my work in R/Java and am new to ninjatrader. I am trying to write a simple ninjascript based on the DV2. I have wrote out the code, but it does not work properly. I am using yahoo historical pricing for my data. I have attached my script and would appreciate any pointers or tips about what is wrong with my script.

The DV2 indicator from ( Varadi?s RSI(2) Alternative: The DV(2) MarketSci Blog) is calculated as follows: (a) for each trading day calculate: [(close / average of the high and low price) – 1]. And then (b) take the average of today and yesterday’s result.



Thanks,
Allan

Can someone say if this indicator (Attached in first message) are work? And the formula are ok?
Because he say " but it does not work properly.".

If no, can someone, please, do this indicator?

I search here, but not find.
Thanks

If someone can programm and do a indicator, I can search for the formula.

edit: And if not ask much... and do this Indicator:
IBS = (Close - Low)/(High - Low)

Is for use in systems wizard in Ninja.
Thanks again


Reply With Quote




Last Updated on August 22, 2014


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts