NexusFi: Find Your Edge


Home Menu

 





Help for chart based ATR price...


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one wldman with 15 posts (0 thanks)
    2. looks_two Fat Tails with 6 posts (2 thanks)
    3. looks_3 Big Mike with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 9,415 views
    2. thumb_up 5 thanks given
    3. group 5 followers
    1. forum 24 posts
    2. attach_file 4 attachments




 
Search this Thread

Help for chart based ATR price...

  #11 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


wldman View Post
I am going to work on that a bit and study what you are telling me Fat Tails. The display does not have the same look so I'll review the math. The lines in your example ate 3 times and 2.618 times the 34 period average true range. That script I posted defines Keltner Channel?

Thanks for your help and suggestions. DB

Keltner Channels are built from a SMA and the average true range. Your channels are built from an EMA and the average true range. They are modified Keltner Channels, as Linda Raschke intorduced them. The multipliers of 2.62 and 3 are close together so on the chart the two upper bands will be as close as shown.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
What broker to use for trading palladium futures
Commodities
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
24 thanks
What is Markets Chat (markets.chat) real-time trading ro …
17 thanks
ApexTraderFunding.com experience and review
15 thanks
GFIs1 1 DAX trade per day journal
13 thanks
EG Indicators
11 thanks
  #12 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,539 since Aug 2011
Thanks Given: 2,077
Thanks Received: 9,567

I hate to be "that guy" about this but the Keltner calculation just doesnt look right to me. The display seems off a bit as well.

The Keltner calculation from the NT indie, If I am correct, is missing part of the ATR calculation.

This is from the ATR indicator in NT:

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])));
Value.Set(((Math.Min(CurrentBar +
1, Period) - 1 ) * Value[1] + trueRange) / Math.Min(CurrentBar + 1, Period));

So, that is what I'm looking for in the Keltner indie calc, right?

But this is what I find there in Keltner:

Described as...
the difference between the high and low of the previous bars

and in the code as...
diff.Set(High[0] - Low[0]);

So I must be missing something or the canned Keltner is not actually using the correct ATR calculation.

The other differences that you noted sma or ema seem to be minor relative to that calc difference. Unless I just don't see it.

The Keltner Channel in terms of display on NT contracts too much during low vola and perhaps expands too much during high vola...at least based on a first view. I conclude that I am missing something or the two Keltner Channel and what I was seeking help to code are not the same. I think Im back to square one or slightly advanced from it.

I am going to keep trying to get that code that I posted above converted into C# and displayed on NT7. I have another version of the code that produces the same result. Would it be helpful to post that as well? What am I missing?

Thanks for your help.

DB

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #13 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,539 since Aug 2011
Thanks Given: 2,077
Thanks Received: 9,567


this has nothing to do with anyone named Linda Raschke. I have no idea who she is or how what I am doing is related to her. I realize that there is nothing new under the sun when it comes to math...an exact science. In that, we do not necessarily rely on the work of others, but we may from time to time , knowingly or unknowingly employ the same princilpes. When that occurs I get excited because when smart people are led to the same place independently of one another the destination tends to validte the thought process and the work.

Linda, does she bank cash? Should I know her or care to find out who she is.

My insecurity leads me to feel like you are trying to expose me or decloak me by saying that is Keltner or the work of someone named Linda that I'm trying to build on and claim as my own. I know that is not true that you have a nefarious purpose so I'm not posting to defend or attack, rather to express my frustration at my inability to code independently of help from guys like you that have that skill.

That little piece of code was the result of looking for a primary price target that would consider volatility and adjust in step with it to maximize first target. Data from different about price movement within different timeframes was exported to excell and then evaluated for specific outcome. It is somewhat interesting that the data set that produced the best result was all Fib related or "9" related...coincidence or some mystical metaphysical BS, honeybadger and wildman don't care none if it banks cash.

Thanks again for your help and direction on this. I hope that you will continue to push me along. DB

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #14 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047

I read the thread twice so far and I'm a bit confused.

I am guessing you are trying to replicate what you have on another platform and get it into NT7? If so is that the chart you are wanting to reproduce?

So those Bands, you want to replicate the green/purple MAs right?

And am I correct in saying that @Fat Tails is suggesting you can possibly use the Keltners as a possible way to get the desired output?

Just curious.

Reply With Quote
  #15 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


wldman View Post
I hate to be "that guy" about this but the Keltner calculation just doesnt look right to me. The display seems off a bit as well.

The Keltner calculation from the NT indie, If I am correct, is missing part of the ATR calculation.

This is from the ATR indicator in NT:

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])));
Value.Set(((Math.Min(CurrentBar +
1, Period) - 1 ) * Value[1] + trueRange) / Math.Min(CurrentBar + 1, Period));

So, that is what I'm looking for in the Keltner indie calc, right?

But this is what I find there in Keltner:

Described as...
the difference between the high and low of the previous bars

and in the code as...
diff.Set(High[0] - Low[0]);

So I must be missing something or the canned Keltner is not actually using the correct ATR calculation.

The other differences that you noted sma or ema seem to be minor relative to that calc difference. Unless I just don't see it.

The Keltner Channel in terms of display on NT contracts too much during low vola and perhaps expands too much during high vola...at least based on a first view. I conclude that I am missing something or the two Keltner Channel and what I was seeking help to code are not the same. I think Im back to square one or slightly advanced from it.

I am going to keep trying to get that code that I posted above converted into C# and displayed on NT7. I have another version of the code that produces the same result. Would it be helpful to post that as well? What am I missing?

Thanks for your help.

DB

You are right. The original Keltner Channels just use the range of the bars, not the true range. That is another reason that I used the Universal Keltner Channel

-> it allows you to select a different period for moving average and true range
-> it allows you to select the type of the average, that is EMA, SMA, etc.
-> it allows you to choose from the simple range and the true range

For the chart that I have posted the true range was used, as in the trade station formula.The chart shows bands at a distance of 2.618 and 3.0 ATRs.

The first screenshot which you have posted has nothing to do with the tradestation code, as it uses different settings. Your bands on the chart do not use offsets of 2.618 and 3.0, this can be easily seen without measuring anything.

Reply With Quote
  #16 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,539 since Aug 2011
Thanks Given: 2,077
Thanks Received: 9,567

something does not look right.

Fat Tails, you are the one that suggested Keltner either universal or simple, not me. I went to look at that suggestion because I asked for help with programing the piece of code that I posted for use in NT7.

My display on the chart I posted is what I want to display on mt NT charts. I assure you it is generated by the code I posted and the settings are 3* and 4.23* the 34 period atr. So you are telling me that what I am asking for help with is not what Im asking for help with and that my display is wrong? How can that be?

What I would like to do is post two variable atr lines above the period ema and two variable atr's below the period ema as referenced in the code I posted.

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #17 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,539 since Aug 2011
Thanks Given: 2,077
Thanks Received: 9,567


forrestang View Post
I read the thread twice so far and I'm a bit confused.

I am guessing you are trying to replicate what you have on another platform and get it into NT7? If so is that the chart you are wanting to reproduce?

So those Bands, you want to replicate the green/purple MAs right?

And am I correct in saying that @ Fat Tails is suggesting you can possibly use the Keltners as a possible way to get the desired output?

Just curious.

that is correct. I'm trying to recover/import indicators for use in NT7. That is the first chart, yes. Chosen because it should be the easiest to replicate IMO.

Yes the green and purple are primary, the two outer gray are secondary. The colored lines are plotted as the 34 period xma + 3*travg where travg = xaverage(range,trlength)....just like it shows in the posted code. I'll post different code that generates the same view and another chart or two. This is the simple one I have no idea how to handle adaptive or cycle period adjusted cci or Heiken Ashi.

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #18 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,539 since Aug 2011
Thanks Given: 2,077
Thanks Received: 9,567

This version was done by a prolific guy both coding and trading. He created this one so that he could change the number of decimals and he prefered to round his number.

input:
price (c), length(36), deci(4),
4xu_color(gray), 4xd_color(gray),
3xu_color(fuchsia),3xd_color(lime),
4x_style(ps_solid),3x_style(ps_dot);

av=xaverage(price,length);
atr=xaverage(truerange(),length);

atr_ 423u=round((av+(atr*4.23)),deci);
atr_3u+round((av+(atr*3)),deci);

atr_ 423d=round((av-(atr*4.23)),deci);
atr_3d+round((av-(atr*3)),deci);

plot1=atr_423u; color1=4xu_color; style1=4x_style;
plot2=atr_3u; color2=3xu_color; style2=3x_style;
plot3=atr_3d; color3=3xd_color; style3=3x_style;
plot4=atr_423d; color4=4xd_color; style4=4x_style;

2011-07-01_1850 - wilddan's library

2011-06-17_1355 - wilddan's library

Thanks to anyone who might decide to help. DB

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #19 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


wldman View Post
something does not look right.

Fat Tails, you are the one that suggested Keltner either universal or simple, not me. I went to look at that suggestion because I asked for help with programing the piece of code that I posted for use in NT7.

My display on the chart I posted is what I want to display on mt NT charts. I assure you it is generated by the code I posted and the settings are 3* and 4.23* the 34 period atr. So you are telling me that what I am asking for help with is not what Im asking for help with and that my display is wrong? How can that be?

What I would like to do is post two variable atr lines above the period ema and two variable atr's below the period ema as referenced in the code I posted.

That is what I meant: On your charts the settings were 3.0 and 4.23. The TradeStation code showed 2.618 and 3.0.

You can just download the Universal Keltner Channel, as I suggested and it will exactly display those lines. Settings are
(EMA, EMA, 3.0, 34, 34, TrueRange, false) for the first one and (EMA, EMA, 4.23, 34, 34, TrueRange, false) for the seceond one. Set the opacity to 0 for better display.

If you like smoothing you can set "Smoothed Channels" to "true", this will get you smoother channels, see chart attached.

Attached Thumbnails
Click image for larger version

Name:	6E 09-11 (60 Min)  08_09_2011.jpg
Views:	208
Size:	108.0 KB
ID:	48742  
Reply With Quote
  #20 (permalink)
 
wldman's Avatar
 wldman 
Chicago Illinois USA
Legendary Market Wizard
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
Frequency: Several times daily
Duration: Hours
Posts: 3,539 since Aug 2011
Thanks Given: 2,077
Thanks Received: 9,567


that is not easy language, it is qscript. The Wave59 "language".

I don't want to come across the wrong way or sound disrespectful but I have to say that if I wanted Keltner Channel I would have used Keltner channel. The search for that which I am trynig to display in NT would have included Keltner, Hurst, Kirschenbaum, Bollinger and anything applied by Wilder or Ehlers. I will do what you have suggested and I appreciate the suggestions. In the mean time maybe someone that knows C# will view the thread and create the appropriate code.

The discussion here though does give me an idea to overlay this universal keltner or kirshenbaum and a modified bollinger on the same chart because they handle volatility differently. Say an upper band cross of an upperband consistent with some element of price action, like a close above or below some mid line might be the basis for something interesting.

I do not typically download indicators but I will search BMP for universal keltner. DB

Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on September 8, 2011


© 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