ATRpercentage - NinjaTrader | futures io social day trading
futures io futures trading


ATRpercentage
Updated: Views / Replies:1,193 / 7
Created: by Fried Tomato Attachments:3

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
 
Thread Tools Search this Thread
 

ATRpercentage

  #1 (permalink)
Elite Member
Vancouver
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: GLD
 
Posts: 4 since Apr 2012
Thanks: 1 given, 1 received

ATRpercentage

Hi guys

I am not a programmer (although am learning) and I got an ATRpercentage indicator from this site. The ATR percentage calculates the ATR as a percentage of price. The indicator program plots both ATR and ATR percentage and therefore cannot be used in strategies when I am comparing ATR to ATRpercentage, because to ATR is part of the ATRpercentage program.

Anyone know how to remove the ATR "piece" of programming from the indicator so that only the ATR percentage will be outputted.

The following is a snippet of code. I have played around with it, but notice that if I get the ATRpercentage to be plotted only, then it is incorrect. I have no idea why??

protected override void OnBarUpdate()
{
if (CurrentBar == 0)
{
Value.Set(High[0] - Low[0]);
}
else
{
double trueRange = High[0] - Low[0];
trueRange = Math.Max(Math.Abs(Low[0] - Close[1]), Math.Max(trueRange, Math.Abs(High[0] - Close[1])));
double atr =(((Math.Min(CurrentBar + 1, Period) - 1 ) * Value[1] + trueRange) / Math.Min(CurrentBar + 1, Period));
Value.Set(atr);

double price = Close[0]; // the median price is used. You can replace Median with Close
double atrp = atr / price * 100;
ATRperc.Set(atrp);

}

Any help would be fantastic.

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
Salt Lake City, UT
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Dormans/Zen-fire
Favorite Futures: 6E ES YM
 
Posts: 233 since Mar 2010
Thanks: 46 given, 321 received


You could just comment out the code not needed...

There are 2 ways to do comments

// does just this line, everything after the two slashes is a comment

/*
is how you do a range of comment, everything between the first slash-star up to the star-slash is a comment
*/


The Value.Set is what is drawing the ATR value

you could put // infront of them... I added them below....



Fried Tomato View Post
Hi guys

I am not a programmer (although am learning) and I got an ATRpercentage indicator from this site. The ATR percentage calculates the ATR as a percentage of price. The indicator program plots both ATR and ATR percentage and therefore cannot be used in strategies when I am comparing ATR to ATRpercentage, because to ATR is part of the ATRpercentage program.

Anyone know how to remove the ATR "piece" of programming from the indicator so that only the ATR percentage will be outputted.

The following is a snippet of code. I have played around with it, but notice that if I get the ATRpercentage to be plotted only, then it is incorrect. I have no idea why??

protected override void OnBarUpdate()
{
if (CurrentBar == 0)
{
// commented out Value.Set(High[0] - Low[0]);
}
else
{
double trueRange = High[0] - Low[0];
trueRange = Math.Max(Math.Abs(Low[0] - Close[1]), Math.Max(trueRange, Math.Abs(High[0] - Close[1])));
double atr =(((Math.Min(CurrentBar + 1, Period) - 1 ) * Value[1] + trueRange) / Math.Min(CurrentBar + 1, Period));
// commented out Value.Set(atr);

double price = Close[0]; // the median price is used. You can replace Median with Close
double atrp = atr / price * 100;
ATRperc.Set(atrp);

}

Any help would be fantastic.


Reply With Quote
The following user says Thank You to tulanch for this post:
 
  #4 (permalink)
Elite Member
Vancouver
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: GLD
 
Posts: 4 since Apr 2012
Thanks: 1 given, 1 received

Thanks Tulanch. I had already tried this and that is when the ATRpercentage value is plotted incorrectly. I have no idea why? Any other ideas? I was wondering whether it had something to do with the code that is in the "Properties" section of the coding. (I am quite familiar with writing strategies, but indicators are very new to me - and like I say I have no coding background).

Reply With Quote
 
  #5 (permalink)
Elite Member
Salt Lake City, UT
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Dormans/Zen-fire
Favorite Futures: 6E ES YM
 
Posts: 233 since Mar 2010
Thanks: 46 given, 321 received

If you commented exacly the lines listed and it still is not working, there is other code invovled... can you post the entire .cs file?

Note: there are times if you access data using references other than [0], for example Close[1], you may find it necessary to use

if(CurrentBar < 1)
return;

but your code looked to me like it handled that...

Another thing, there are times it helps to remove the indie under devlelopmenet from the chart, and re-add it rather than just doing a refreash (F5)

Here is another good resource... when I first started out with indies, I found the NT help docs very useful... search for "indicator basic concepts" click on the "Educational Resources" link and then on the "Developing Indicators" link.
I know its rather basic, but it does explain things well.

The following code was generated by the NT wizard... just click on create new a indicator and check the overlay box, then press the next buttons till you get the code to display...

Note the name "Plot0" is how this example adds a plot draw item that you are having issues with, notice how "Plot0" is referenced in 3 places.... initialize, onbarupdate and in the properties..


/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0")); // <<<<here
Overlay = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
Plot0.Set(Close[0]); // <<<<here
}

#region Properties

// //////////////////////////////////////////////
// here is where it is defined if you wil
// how it is brought to the indicator dialog for setting related items such as color or sytle from the UI
// //////////////////////////////////////////////

[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}


Last edited by tulanch; October 28th, 2012 at 12:18 PM.
Reply With Quote
The following user says Thank You to tulanch for this post:
 
  #6 (permalink)
Elite Member
Vancouver
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: GLD
 
Posts: 4 since Apr 2012
Thanks: 1 given, 1 received

Hi Tulanch, thanks for references, still fiddling with this thing I just can't seem to wrap my head around these indicators. I see in the properties section there are references to data one bar ago [1] you mentioned [1] can effect the if (CurrentBar . . . ) line, does that include when it is in this properties section??

I have attached the file, as you can see it is not much code. I am also trying to compare to other code that works (specifically a Bollinger Bandwidth indicator). I see a huge difference in how it is written and I think adding to my confusion.

Any additional thoughts??

Attached Files
Register to download File Type: zip ATRpercentage.zip (2.3 KB, 21 views)
Reply With Quote
 
  #7 (permalink)
Elite Member
Salt Lake City, UT
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Dormans/Zen-fire
Favorite Futures: 6E ES YM
 
Posts: 233 since Mar 2010
Thanks: 46 given, 321 received

units....that is the issue here....if you will, you're trying to draw miles and inches at the same time....

the units for the percentage range between 0 and 100

the units for ATR are based on the ticksize and bar range (high-low)

With the 6E the units currently are around 1.2938 and a bar that has 4 ticks higher would be 1.2942, so these units would be significantly smaller than the % values. ( for example 0.0004)

so this indie was actually working as designed, just the view scale was not set to pick up all the drawn items.

In the attached version I commented out the Value.set lines using //tulanch

the Value.set is weird.. sort of a short cut/hack... but the since first plot is named "ATR" (look inside initialize) and there is already an ATR data series ( the indicator provided by NT you could call from inside this indicator), I would guess if you tried to use ATR.Set the compiler would complain with some compiler error.

If the first plot was named "ATRvalues" instead of "ATR" the Value.set could more correctly and clearly be
ATRvalues.set


To see what is being drawn you need to adjust the view scale... you know how to use the little F icon/button on the upper right side of a panel when the view can be adjusted?

I just ran this indie against the 6E and the percentage came out to 90, but the lines drawn are at 50 max ... so I then zoomed out using the y axis drag feature... eventually the purple line became flat and I could see all the horizontal lines too

hope this make sense...

Attached Files
Register to download File Type: zip ATRpercentage.zip (2.4 KB, 14 views)
Reply With Quote
The following user says Thank You to tulanch for this post:
 
  #8 (permalink)
Elite Member
Vancouver
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: GLD
 
Posts: 4 since Apr 2012
Thanks: 1 given, 1 received

Yep, I agree the indicator was working exactly as it was designed, just I wanted to separate the two lines ie the ATRpercentage and the ATR because I wanted that ATRpercentage to output a number so that I could run a strategy or even output it to the Market Analyzer. I though it was necessary to remove the ATR from the plot BUT . . .

I deleted the version I had and imported the one you attached, but I prefer the "units" used before (it is how I have manually been calculating this stuff) so I changed it a little, so that the Value.Set(atr) was once again included ie removed"//", but I left the rest and the only thing I see differently is the line "//Value.Set(High[0] - Low[0])" ie you essentially removed it. The plot obvioulsy is the same as before, with the two lines, but for some reason (????) it computes the ATRpercentage (same value as before) and successfully outputs to the market analyzer and also is able to use it in my strategy when I run the strategy analyzer. Like I say I have no idea why but I am really

I spent most of yesterday going over those lessons on Ninjatrader that you recommended. I will get there . . . just like I did manage to learn the Strategy Analyzer stuff. But still seems a little like gibberish at the mo'.

Thanks for all your help!!

To anyone who wants the indicator as I am presently using it I am including it here.

And for anyone who wonders what it can be used for. It is great on daily and weekly charts to indicate when to trade systems that are dependent on high volatility. When the ATRpercentage > ATR (I like 10 period) it indicates high volatility.

Attached Files
Register to download File Type: zip ATRpercentage.zip (2.3 KB, 46 views)
Reply With Quote
The following user says Thank You to Fried Tomato for this post:

Reply



futures io > > > > ATRpercentage

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
ATRpercentage indicator Peter NinjaTrader 1 September 2nd, 2014 02:26 PM


All times are GMT -4. The time now is 02:09 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-15 in 0.14 seconds with 20 queries on phoenix via your IP 54.82.56.95