Coloring an IndicatorLine by Slope: Questions for Optimal Coding - NinjaTrader Programming | futures io social day trading
futures io futures trading


Coloring an IndicatorLine by Slope: Questions for Optimal Coding
Updated: Views / Replies:14,444 / 59
Created: by Trendseek Attachments:19

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

Coloring an IndicatorLine by Slope: Questions for Optimal Coding

  #31 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary


stephenszpak View Post

In the 6E using 3 RangeNoGap charts these dojis are always coming up.
If the bands are widened to include all the dojis, then candles that should go bullish or bearish
have closes within the bands and would be colored neutral.

Is there a way to make all dojis with the same close neutral, regardless of what
the computations of BollingerUniversalX come up with, within some code? I believe you
said once that NT can't do stuff like that.

- Stephen

Everything is possible. Just set up the rules, and it can be coded in a few minutes.

Do you now intend to color the candles according to the slope of the moving average or according to the condition, whether they close inside or outside the bands?

Dojis can be accounted for as neutral candles.

What do you want to color, the moving average, the bands, the candles or the candle outlines?

Reply With Quote
 
  #32 (permalink)
Elite Member
Massachusetts (USA)
 
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: YM
 
stephenszpak's Avatar
 
Posts: 778 since Jun 2009
Thanks: 144 given, 358 received


Fat Tails View Post
Everything is possible.

I like your attitude!

Reply With Quote
 
  #33 (permalink)
Elite Member
Massachusetts (USA)
 
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: YM
 
stephenszpak's Avatar
 
Posts: 778 since Jun 2009
Thanks: 144 given, 358 received



Fat Tails View Post
Everything is possible. Just set up the rules, and it can be coded in a few minutes.

Do you now intend to color the candles according to the slope of the moving average or according to the condition, whether they close inside or outside the bands?

Dojis can be accounted for as neutral candles.

What do you want to color, the moving average, the bands, the candles or the candle outlines?

There might be a way to improve upon the color coding of your new ThrustBars indicator, using
the BollingerUniversalX indicator but I've given up. Tried different parameters in the BollingerUniversalX
but there must be some hidden math, or whatever it's called, going on within the ThrustBars that is
somewhat better. Sometimes the bands would be slightly too wide or too narrow causing late
signals or false signals.

All set using your new ThrustBars indicator, unless something better comes along. I suppose I'll
always think there's something better (ha, ha).

Thanks,

- Stephen

Reply With Quote
 
  #34 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary


stephenszpak View Post
There might be a way to improve upon the color coding of your new ThrustBars indicator, using
the BollingerUniversalX indicator but I've given up. Tried different parameters in the BollingerUniversalX
but there must be some hidden math, or whatever it's called, going on within the ThrustBars that is
somewhat better. Sometimes the bands would be slightly too wide or too narrow causing late
signals or false signals.

All set using your new ThrustBars indicator, unless something better comes along. I suppose I'll
always think there's something better (ha, ha).

Thanks,

- Stephen

I have several good friends, who are not married. They always thought that there would be someone better.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #35 (permalink)
Elite Member
Massachusetts (USA)
 
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: YM
 
stephenszpak's Avatar
 
Posts: 778 since Jun 2009
Thanks: 144 given, 358 received


Fat Tails View Post
I have several good friends, who are not married. They always thought that there would be someone better.

On a more serious note...

I am just throwing this out as an idea. I don't say I myself even have a great
deal of interest in it. Maybe others might.

1) This would be off topic for this thread, but since we're sort of talking about it,
maybe there is/was a thread listing all the charting methods.

{ No moving
averages or indicators
, just the charts. For example, NoGapRange, generic candlestick,
Kase, Momemtum, Renko Hybrid, etc.}

2) Maybe a running poll on the thread as time passes and perhaps new charting
ideas come along over the years.

I am positive that some charts are just harder to read than others.

- Stephen

Reply With Quote
 
  #36 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary

It is some time that I had been looking for the post of William Eckhardt on the C-Test. It is one of the best explanations available, why the concept of angles does not work on scalable charts.

Here is the text, which was originally published in Technical Analysis of Stocks & Commodities V12:5, and which can be found in various internet blogs:

We all know that thorough testing is the only way to determine whether a particular trading system or indicator is viable. William Eckhardt, the mathematician whose conversation with Richard Dennis helped bring about the Turtles, points out that before you spend time testing a method, you should first use a methodological test for dimensional coherency called the c-test. Eckhardt explains.

In most cases, the only way to evaluate trading indicators or systems is through diligent and rigorous testing. However, there are cases in which indicators, systems or even entire approaches can be rejected on principle. A good way to root out the unworkable indicators, systems or approaches is to apply a c-test, which is a methodological test for dimensional coherency. A system can be said to be dimensionally coherent if its results do not change even though the units of measure do. The test is applied directly to the formulas or rules that define a system or indicator. If the system or indicator fails the c-test, then it will give incoherent results that cannot be trusted; however, a formula determined to be incoherent can often be modified to pass the c-test.

To determine why a coherency test is necessary, first we look at some charting procedures that we suspect may be incoherent — for example, the fallacy of attaching significance to the sizes of angles on a bar chart or similar price graph. It is not that trading systems making use of angles are inferior — there is such a glut of bad systems in general that it would hardly be worthwhile to identify only a few — but rather, these angle-dependent trading systems are pseudo-systems, incoherent procedures disguised as algorithms.

What holds true in a particular system should hold true no matter what the measurement. Now, a change in one unit may necessitate a change in others; if you change the unit of distance, then you must make corresponding changes to the unit of area or volume. However, in price analysis, the overriding variables of price and time are so heterogeneous that a change in the scale of one may occasion no need for a change in the scale of the other. (Chart services frequently rescale the price axes of their charts while leaving the time scales the same year after year.) Clearly, then, it should be possible to change the units for price and time separately in a valid rule — for example, if corn must rally 15 cents in five trading days, then it is also true that corn must rally 0.15 dollars in five trading days or 15 cents in one week. The meaning should not change, only the way in which it is stated.

RIGHT ANGLE INCLINATIONS
The fallacy concerning the sizes of angles in a bar chart or price graph arises from ignoring price/time heterogeneity. As an example, consider the claim that a major downtrend and the subsequent uptrend tend to be at right angles to each other. In Figure 1, the first chart conforms to the right-angle rule; in Figure 2, the uptrend falls short of the right-angle projection; in Figure 3, the uptrend exceeds the projection. The problem: These are all charts of the same price series (December 1989 gold, July 17, 1989, to December 1, 1989), but only the vertical price scale is different. This technique is likely to give the user varying results depending on the chart service he or she uses.

RELATIVE INCLINATION
Relative inclination fares no better. Here, the rule is that in the first two legs of a bull move, the angular inclination above the horizontal axis of the second leg is twice that of the first leg. Initially, this may appear to be a coherent prediction of the behavior of the second leg given that of the first, but what if the first leg climbs at more than 45 degrees? The rule predicts that the second leg will incline at more than 90 degrees — that is, it has to backtrack in time. And whatever the angular inclination of the first leg on the original chart, there exists a rescaling of the price axis in which this first leg climbs at more than 45 degrees. Thus, this rule is incoherent. It cannot stand up to the c-test.

Note that these geometric angle lines should not be confused with classical chart trendlines, which are defined as incidence properties — connecting points on a chart — and not in terms of angles. In Figures 1, 2 and 3, the downtrend line crosses the price series at the same price and on the same day.

A price chart is an attempt to model relevant aspects of price change. Price change is not linear displacement, whether vertical, horizontal or oblique. Nonetheless, price change can be represented as vertical displacement and time elapsed as horizontal displacement. Such a model, however, invariably supports relationships that does not correspond to anything in the original process.

The angular inclination of a trend on a price chart is a visually striking feature of this representation. Such angles have no intrinsic meaning for the price series, but this is one of the many factors (along with our facility for pattern recognition and wishful thinking) that contributes to our interpreting more from price charts than rigorous testing reveals is there.

FRACTAL EFFICIENCY
Sophisticated geometric constructions can have the same problems as simpler angular formulations. For a recent example, Hans Hannula defines a fractal efficiency indicator for a lookback of n days:

[1] SQRT((Pn-P1)*(Pn-P1)+n)/SQRT((P2-P1)*(P2-P1)+1)+SQRT((P3-P2)*(P3-P2)+1)+...+SQRT((Pn-Pn-1)*(Pn-Pn-1)+1)

where P1,...,Pn are n consecutive closes. This expression is multiplied by -1 if Pn- P1 is negative.

And whatever the angular inclination of the first leg on the original chart, there exists a rescaling of the price axis in which this first leg climbs at more than 45 degrees. Thus, this rule is incoherent. It cannot stand up to the c-test.

Here, price and time variables are combined in such a way as to make it impossible for the indicator to retain the relative importance of price action and time change when both axes are rescaled independent of each other. The trader who prices a market in dollars finds that time components mean much more to that market's fractal efficiency than the trader who prices the same market in cents. This dimensional difference is not insignificant. Consider the following three-day price series:

Day
Series 1 2 3
1 50.00 50.60 50.80
2 52.00 52.50 52.40

The first has a fractal efficiency of 1.420..., while the second has a slightly higher one of 1.425.... Now suppose we multiply all these prices by 100, signaling a unit change from dollars to cents. In these units, the first series (5000, 5060, 5080) has a fractal efficiency of 1.000..., but the second (5200, 5250, 5240) has a lower fractal efficiency of 0.667.... Thus, fractal efficiency ranks these price series in an irrational and incoherent manner.
The only way to rid equation 1 of this ranking incoherency is to eliminate the time terms. The modified formula reduces to:
[2] Pn-Pn-1/ABS(P2-P1)+ABS(P3-P2)+...+ABS(Pn-Pn-1)

Simplified and divested of the surrounding incoherencies, the true formula becomes apparent. It is the net change divided by a close-to-close path length.

THE C-TEST
These ideas can be used to regulate system development. In essence, the c-test transforms relevant formulas in an indicator or system by multiplying every price term by a positive constant c (cą1), while leaving nonprice terms the same. If the transformed indicator or system gives the same indications or signals as the original, then it has passed the c-test. If not, the formulation in question is incoherent and depends unacceptably on the units chosen.

Let us examine in this connection a commonly used measure of trend strength, the n-velocity:
[3]VELn=(Pn-P1)/(n-1)

A c-test of the velocity has the effect of multiplying the whole expression by c; all velocities grow or shrink in concert. This indicates that the value of veln cannot be given absolute significance; to be coherent, a system or indicator must relate veln to something else.

This defect can be repaired in many ways. We might compare the strength of two trends by measuring the ratio of their velocities. The reader can check that a ratio of velocities is left unchanged in a c-test, as the net effect is to multiply both numerator and denominator by c. The velocity ratio is a dimensionally correct measure of relative trend strength, something that could not be constructed by means of trend angles. Because the velocity of a vertical line is effectively infinite, no doubling of a velocity gives a vertical ascent or goes beyond the vertical. However, the velocity ratio can only be useful if the denominator measures the velocity of a trend. The ratio behaves erratically if the denominator remains near zero.

A MORE APPLICABLE MEASURE
Seeking a more universally applicable measure, we might divide VELn by Pn:
[4]
(Pn-P1)/(n-1)Pn

to derive a percent of price velocity that clearly passes the c-test.
Equation 4 is dimensionally sound but flawed in other respects. Different futures contracts have different characteristic ranges of percent of price velocity, making it difficult to research this measure across contracts. (The velocity ratio shares this drawback.) We might seek to universalize the percent of price velocity further, perhaps by gauging it, in any given contract market relative to some historic norm for that market.

The analysis of price series is fraught with perils. A common pitfall is to research formulations that are dependent on arbitrary factors such as choice of units. A c-test performed on any proposed system or indicator before embarking on any statistical testing would save time and would aid in the avoidance of many errors.

William Eckhardt is a mathematician who has been trading since 1974. He has an extensive background in the history of scientific methodology as well as mathematical statistics, both of which have been instrumental in the development of his trading program. In addition, Eckhardt was profiled in Jack Schwager's The New Market Wizards. Currently, he is an officer of C&D Commodities, Inc.

REFERENCES
Hannula, Hans [1993]. “Polarized fractal efficiency,” Technical Analysis of STOCKS & COMMODITIES,
Volume 12: January.

Reply With Quote
The following 4 users say Thank You to Fat Tails for this post:
 
  #37 (permalink)
Market Wizard
Las Vegas, NV
 
Futures Experience: Advanced
Platform: Abacus, Slide Rule, HP-65, Metastock, TOS, NT
Favorite Futures: Futures
 
aligator's Avatar
 
Posts: 3,424 since Aug 2010
Thanks: 1,053 given, 5,822 received
Forum Reputation: Legendary


Fat Tails View Post
It is some time that I had been looking for the post of William Eckhardt on the C-Test. It is one of the best explanations available, why the concept of angles does not work on scalable charts.

@Fat Tails;

I recall this article from way back (I actually have all paper magazine copies from early 80's until now). It appears that none of the many Slope indicators are really worth a hoot, so can there really be a slope indicator? I don't know.

But, back then I came up with something for Metastock that was a derivative of the Velocity formula that I called Accelerator. It was a go/no-go tool and worked great in those days when we did not have the e-minis. I am not sure if it still works in this HFT environment.

Cheers!


Last edited by aligator; June 27th, 2012 at 06:20 PM.
Reply With Quote
The following user says Thank You to aligator for this post:
 
  #38 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary


aligator View Post
@Fat Tails;

I recall this article from way back (I actually have all paper magazine copies from early 80's until now). It appears that none of the many Slope indicators are really worth a hoot, so can there really be a slope indicator? I don't know.

But, back then I came up with something for Metastock that was a derivative of the Velocity formula that I called Accelerator. It was a go/no-go tool and worked great in those days when we did not have the e-minis. I am not sure if it still works in this HFT environment.

Cheers!

@aligator: Slope is just a graphical representation of momentum. If you have a software package with scalable charts, just measure momentum!

Reply With Quote
 
  #39 (permalink)
Market Wizard
Las Vegas, NV
 
Futures Experience: Advanced
Platform: Abacus, Slide Rule, HP-65, Metastock, TOS, NT
Favorite Futures: Futures
 
aligator's Avatar
 
Posts: 3,424 since Aug 2010
Thanks: 1,053 given, 5,822 received
Forum Reputation: Legendary


Fat Tails View Post
@aligator: Slope is just a graphical representation of momentum. If you have a software package with scalable charts, just measure momentum!

Thanks , Yes, I got your point many years ago when I started using the "Accelerator", a form of momentum formula.

Reply With Quote
 
  #40 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary

Update Bollinger Universal and Keltner Universal


Have now updated the Bollinger Universal and Keltner Universal indicators.

You can select the midband from moving median, moving mode and 27 moving averages. Period for the midband and the smoothing period for the range or true range can be different. Both indicators allows to color the plots according to their slope or alternatively according to the slope of the midband. The range where the slope is considered neutral can be adjusted. It is possible not to display midband or channels.

The indicators can be found here:

https://futures.io/download/ninjatrader-7/indicators/626-download.html?view
https://futures.io/download/ninjatrader-7/indicators/625-download.html?view


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
The following 3 users say Thank You to Fat Tails for this post:

Reply



futures io > > > > > Coloring an IndicatorLine by Slope: Questions for Optimal Coding

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Some Basic NinjaTrader Coding Questions -- IDataSeries Crow NinjaTrader Programming 7 October 15th, 2017 04:49 AM
Tricky NinjaScript coding {questions} . . . jmejedi NinjaTrader Programming 10 August 2nd, 2014 10:09 PM
InvestorRT axis label coloring Big Mike Investor/RT 3 August 18th, 2011 07:53 AM
NT MA with BG coloring emini_Holy_Grail NinjaTrader 10 January 11th, 2011 07:29 AM
On finding the optimal settings for a range interval trendisyourfriend The Elite Circle 5 December 7th, 2010 02:53 PM


All times are GMT -4. The time now is 10:29 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-10 in 0.20 seconds with 20 queries on phoenix via your IP 54.221.73.186