Finding real price of current and past ADXVMA bar - NinjaTrader Programming | futures io social day trading
futures io futures trading


Finding real price of current and past ADXVMA bar
Updated: Views / Replies:588 / 10
Created: by SolubleFish Attachments:4

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 4  
 
Thread Tools Search this Thread
 

Finding real price of current and past ADXVMA bar

  #1 (permalink)
Elite Member
Chapel Hill, NC
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: NinjaTrader
Favorite Futures: Futures
 
SolubleFish's Avatar
 
Posts: 6 since Apr 2015
Thanks: 1 given, 0 received

Finding real price of current and past ADXVMA bar

I would like to find the value of anaADXVMA for a futures contract's current and past bar. I have worked on this code, but I'm not getting the right values to get the comparison right. I want to identify chop areas. When ADXVMA looks flat, there is usually a lot of chop. So, here's what I have, but the values are not coming out right. If the current bar's ADXVMA is equal to the previous bar's ADXvma, then we have flattened. Visually, it makes sense. Mathematically, I'm not able to zero in on it due to variances between ticks and actual real value. The instrument I'm using is ZB.

protected override void OnBarUpdate()
{
decimals = Math.Log10(1/Instrument.MasterInstrument.TickSize);
Print("TickSize for " + Instrument + " is " + Instrument.MasterInstrument.TickSize + " and has " + decimals + " decimal places");
Print (" ----------------------------");
adxvmaNow = anaADXVMA(8).ADXVMA[0];
roundedNow = Instrument.MasterInstrument.Round2TickSize(Close[0]);
rounded2decimals0 = Math.Round(roundedNow,2);

//
adxvmaBefore = anaADXVMA(8).ADXVMA[1];
roundedBefore = Instrument.MasterInstrument.Round2TickSize(Close[0]);
rounded2decimals1 = Math.Round(roundedBefore,2);

Attached Thumbnails
Finding real price of current and past ADXVMA bar-zb-adxvma-10min.jpg  
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,489 since Sep 2013
Thanks: 1,704 given, 3,694 received
Forum Reputation: Legendary


What are the values your are getting, can you print them both rounded and not rounded
with Print(..) ?

Reply With Quote
 
  #4 (permalink)
Elite Member
Chapel Hill, NC
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: NinjaTrader
Favorite Futures: Futures
 
SolubleFish's Avatar
 
Posts: 6 since Apr 2015
Thanks: 1 given, 0 received

Here is a printout of some values

Here's some output on the printouts I'm getting. Notice that current and previous bar are the same price.

Thanks
------
TickSize for ZB 06-16 Globex is 0.03125 and has 1.50514997831991 decimal places
----------------------------
5/18/2016 4:00:00 PM - Close of Bar - 163.65625
5/18/2016 4:00:00 PM - ADXVMA Now for ZB 06-16 Globex is: 163.839854496411
5/18/2016 4:00:00 PM - ADXVMA Before for ZB 06-16 Globex is: 163.864920513144
5/18/2016 4:00:00 PM - ADXVMA Level0 for ZB 06-16 Globex is: 163.65625
........
5/18/2016 4:00:00 PM - ADXVMA Now real ZB 06-16 Globex is: 163.65625
5/18/2016 4:00:00 PM - ADXVMA Before real ZB 06-16 Globex is: 163.65625
........
5/18/2016 4:00:00 PM - ADXVMA Now rounded for ZB 06-16 Globex is: 163.66
5/18/2016 4:00:00 PM - ADXVMA Before rounded for ZB 06-16 Globex is: 163.66
-------
TickSize for ZB 06-16 Globex is 0.03125 and has 1.50514997831991 decimal places
----------------------------
5/18/2016 4:10:00 PM - Close of Bar - 163.8125
5/18/2016 4:10:00 PM - ADXVMA Now for ZB 06-16 Globex is: 163.837111570806
5/18/2016 4:10:00 PM - ADXVMA Before for ZB 06-16 Globex is: 163.839854496411
5/18/2016 4:10:00 PM - ADXVMA Level0 for ZB 06-16 Globex is: 163.8125
........
5/18/2016 4:10:00 PM - ADXVMA Now real ZB 06-16 Globex is: 163.8125
5/18/2016 4:10:00 PM - ADXVMA Before real ZB 06-16 Globex is: 163.8125
........
5/18/2016 4:10:00 PM - ADXVMA Now rounded for ZB 06-16 Globex is: 163.81
5/18/2016 4:10:00 PM - ADXVMA Before rounded for ZB 06-16 Globex is: 163.81
-------
TickSize for ZB 06-16 Globex is 0.03125 and has 1.50514997831991 decimal places
----------------------------
5/18/2016 4:20:00 PM - Close of Bar - 163.75
5/18/2016 4:20:00 PM - ADXVMA Now for ZB 06-16 Globex is: 163.83211698193
5/18/2016 4:20:00 PM - ADXVMA Before for ZB 06-16 Globex is: 163.837111570806
5/18/2016 4:20:00 PM - ADXVMA Level0 for ZB 06-16 Globex is: 163.75
........
5/18/2016 4:20:00 PM - ADXVMA Now real ZB 06-16 Globex is: 163.75
5/18/2016 4:20:00 PM - ADXVMA Before real ZB 06-16 Globex is: 163.75
........
5/18/2016 4:20:00 PM - ADXVMA Now rounded for ZB 06-16 Globex is: 163.75
5/18/2016 4:20:00 PM - ADXVMA Before rounded for ZB 06-16 Globex is: 163.75
-------
TickSize for ZB 06-16 Globex is 0.03125 and has 1.50514997831991 decimal places
----------------------------
5/18/2016 4:30:00 PM - Close of Bar - 163.75
5/18/2016 4:30:00 PM - ADXVMA Now for ZB 06-16 Globex is: 163.83211698193
5/18/2016 4:30:00 PM - ADXVMA Before for ZB 06-16 Globex is: 163.83211698193
5/18/2016 4:30:00 PM - ADXVMA Level0 for ZB 06-16 Globex is: 163.75
........
5/18/2016 4:30:00 PM - ADXVMA Now real ZB 06-16 Globex is: 163.75
5/18/2016 4:30:00 PM - ADXVMA Before real ZB 06-16 Globex is: 163.75
........

Reply With Quote
 
  #5 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,489 since Sep 2013
Thanks: 1,704 given, 3,694 received
Forum Reputation: Legendary

use this for decimal places :

 
Code
public static class MathDecimals
{
    public static int GetDecimalPlaces(decimal n)
    {
        n = Math.Abs(n); //make sure it is positive.
        n -= (int)n;     //remove the integer part of the number.
        var decimalPlaces = 0;
        while (n > 0)
        {
            decimalPlaces++;
            n *= 10;
            n -= (int)n;
        }
        return decimalPlaces;
    }
}
1. Some indicators don't give you the previous value (if not exposed), you can verify this by
opening the databox on the chart and going over with your mouse

2. In that case, the work around could be to memorize the previous value, like

oldADXVMA = anaADXVMA(8).ADXVMA[0] at the end of your check
so at every bar, you have the old value at the beginning of your OnBarUpdae

Reply With Quote
The following user says Thank You to rleplae for this post:
 
  #6 (permalink)
Elite Member
Chapel Hill, NC
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: NinjaTrader
Favorite Futures: Futures
 
SolubleFish's Avatar
 
Posts: 6 since Apr 2015
Thanks: 1 given, 0 received

Thank you

Thanks. Will try that. Your code is much more elegant than what I stitched together.

Reply With Quote
 
  #7 (permalink)
Elite Member
Chapel Hill, NC
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: NinjaTrader
Favorite Futures: Futures
 
SolubleFish's Avatar
 
Posts: 6 since Apr 2015
Thanks: 1 given, 0 received

Not what I expected

Thanks for the help. After getting it coded it turns out what 'looks' to the eye as a neutral or choppy area, the underlying math says otherwise. So, what I really would like to know if there is a way to access the Pos, Neg, Neutral trend state in anaADXVMA indicator from the code. I can see that the series is exposed (Bloodhound can see the trend series), but I don't know how to access them from ninjascript. I could use some help there if it is possible.

Thanks!

Reply With Quote
 
  #8 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,489 since Sep 2013
Thanks: 1,704 given, 3,694 received
Forum Reputation: Legendary


SolubleFish View Post
Thanks for the help. After getting it coded it turns out what 'looks' to the eye as a neutral or choppy area, the underlying math says otherwise. So, what I really would like to know if there is a way to access the Pos, Neg, Neutral trend state in anaADXVMA indicator from the code. I can see that the series is exposed (Bloodhound can see the trend series), but I don't know how to access them from ninjascript. I could use some help there if it is possible.

Thanks!

If you open the databox, and you scroll over the chart, do you see the variables ?
what is their name ?
can you post a screenshot ?

Reply With Quote
 
  #9 (permalink)
Elite Member
Chapel Hill, NC
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: NinjaTrader
Favorite Futures: Futures
 
SolubleFish's Avatar
 
Posts: 6 since Apr 2015
Thanks: 1 given, 0 received

A couple of screenshots

Here are a couple; one for a neutral and one for a trending. The names are not different, just colors are different. I'm also including a screenshot from what Bloodhound Sees. Thanks for the help.

Attached Thumbnails
Finding real price of current and past ADXVMA bar-anaadxvma_bloodhound-exposed.jpg   Finding real price of current and past ADXVMA bar-anaadxvma_trendingjpg.jpg   Finding real price of current and past ADXVMA bar-anaadxvma_neutral.jpg  
Reply With Quote
 
  #10 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,489 since Sep 2013
Thanks: 1,704 given, 3,694 received
Forum Reputation: Legendary



SolubleFish View Post
Here are a couple; one for a neutral and one for a trending. The names are not different, just colors are different. I'm also including a screenshot from what Bloodhound Sees. Thanks for the help.

do you have the source code of that adxvma ?

Reply With Quote

Reply



futures io > > > > > Finding real price of current and past ADXVMA bar

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Price crossing adxvma indicator essiar NinjaTrader 3 July 26th, 2015 12:07 PM
question: do something IF current bar (or previous bar) is LLV choubix AmiBroker 1 April 9th, 2015 04:34 PM
Using Historical data of past years to formulate a bias for current day trading Rad4633 Traders Hideout 7 November 12th, 2013 08:09 PM
Method of scripting to project price series IN FRONT of current bar? forrestang NinjaTrader Programming 4 May 2nd, 2012 12:01 PM
REITs Finding a 'Perfect Storm' To Ride the Real Estate Wave Quick Summary News and Current Events 0 February 15th, 2012 04:40 PM


All times are GMT -4. The time now is 06:53 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-13 in 0.14 seconds with 20 queries on phoenix via your IP 54.90.92.204