NexusFi: Find Your Edge


Home Menu

 





Help coding DV2 indicator


Discussion in NinjaTrader

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




 
Search this Thread

Help coding DV2 indicator

  #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?
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
 
  #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,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,658


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 Twitter 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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts