Many thanks again for your reply Wabbit, I am very grateful.
I feel a debate coming on! [:)]
As it stands, with some testing, the code (Your code), now looks like this;
Code:
Name
Coloured MA Line
Formula
periods:=Input("Mov Avg periods",6,2600,13);
slowMA:= Ref(Mov(C,periods,S),+3);
fastMA:= Ref(Mov(C,5,E),+3);
shift:= 0.9* Min(slowMA, LOW);
up:=If(fastMA>slowMA,slowMA,shift);
dn:=If(fastMA<slowMA,slowMA,shift);
{Plot - use points only line-style for best effect}
up; {green}
dn; {red}
shift; {colour me the same as the chart background colour}
Here's the debate part.
It is with regards to "Displaced MA's, and trying to look ahead of time, into the "Future"
You quote Wabbit;"The most important part to remember when displacing indicators
is
NOT to move the data into the future!"
Well, I know 100% my knowledge on trading and formulas etc is far below your levels
and time spent in this area.
That said, hey, I do have an opinion and would like to dare I say it, disagree with your
above statement, or at least voice my opinion (As, IMO that is part of what forums are about,
having an opinion and sharing it to encourage debate).
If I may put another point of view across please.
You say ; and I quote again;
"The most important part to remember when displacing indicators
is
NOT to move the data into the future!"
Well, is that not what pro traders try to do? Predict the future?
In my limited experience I've always focused on the left hand part of the chart,
when really 50% should be in a predictive mode, trying to plot what will/MIGHT happen
to the right of the chart.
We look left at recent support lines, resistence lines etc, but isn't the idea of indicators
also to use if possible (Or any other information predictively?)
Some examples;
Predictive
1. MACD Histogram. I've looked at loads of different MACD Settings. The 1 I'm sticking to
is a setting of 8/21/8,, seems to get in about 2 bars sooner than traditional MACD, yet still
retain it's qualities. (Looked at lot's, and I mean lots of different settings, many draw similarly).
But, MACD in my opinion should be plotted on top of dual coloured histogram.
Reason I mention this,, the histogram should be used PREDICTIVELY. Never wait for a MACD
to cross it's signal line, (IMO), Histogram shows you visually, when price
SHOULD TURN, a LEADING indicator, PREDICTIVE.
2. TIME. Certain times of the day are renowned for turning points or increases in volume, again PREDICTIVE.
3.Fibonnacci Retracements - Projections,, again, Predictive.
4. MACD Divergences - (I'm sure Dr. Alexander Elder said something along the lines of that
MACD Divergences are 1 of the strongest signals in TA).
5. Dr. Alexander Elders "Safety Zone", written by Jose,, again, (Actually this is great stuff and definitely needs some closer scrutiny)
but you can set a stop PREDICTIVELY, 1 day forward
6. Using Oscillators, in a PREDICTIVE mode, selling when it looks like a stock is overbought, buy when it seems oversold. Basically you are PREDICTING the turning points
5.PSAR,, this is a hard one. I've seen some posts relating to this, 1 in articular that Patrick answered and his code interpretation in answer to the question was huge (My Scroll wheel was on fire):-), not easy to understand,, but in a way, as a stop loss system, it is kind of being predictive,
(I think,, actually, this is debatable, in metastocks pro 10 manual page 460, it does quote as using the "ZigZag function),, which is ,,,well, I'm not too sure actually,,
lets just say I don't like to here those words "Zig Zag" mentioned when an indicator is built :-)
I do need to understand this function better, but that's another story.
So, we can use TA, price in a predictive way. My Idea for the "Coloured MA line" was to use it in tandem with the coloured price bars based on certain criteria (As mentioned earlier in post; by the way, this was a starting point, other more defined rules to be added); but to use the MA's in a more PREDICTIVE way.
I've looked again at many MA's, many good ideas I've found;
Some great EMA's on Jose's website;
http://www.metastocktools.com/Also adaptive MA's (Mr. Kaufman) etc etc.
Out of all the samples I've tried, Mr. DiNapoli's DMA just struck a cord with me.
Anyone interested, please read here;
http://olesiafx.com/Joe-DiNapoli-Trading-with-DiNapoli-Levels/14.Displaced-moving-averages-ma-dma-trend-analysis-joe-dinapoli-macd-stochastic-combination.html
Two things struck me on reading this.
1. DiNapoli Quotes like;
"I arrived at the DMAs cited above over a period of about two and a halfyears,
cranking them out on a CPM based computer using an 8088 chip.
I studied thousands of charts,in all manner of markets, in all types of conditions.
I tried every kind of MA I could imagine and have programmed."2. "Therefore in keeping with my primary directive, i.e. keep everything as simple as possible,
I stuck with simple DMAs.""Rather than plotting a given Moving Average, calculated today, on today's date, you simply plot the identical value at a different, later date, hence the term "displaced." The displacement is on the time axis, not the price axis.
For the visual learners among you, the arrow in the following chart shows that the same Moving Average is simply placed
FORWARD in time."
So, it seems that Mr. DiNapoli uses a DMA place
FORWARD in Time.
I've looked at quite a few charts with this in mind. The 3x3 being the most accurate in a PREDICTIVE sense, as it is the shortest time frame, (This is with a short term trading view point by the way, my trading style, day trading, not long term hold), but when used in conjunction with a another MA(Slower), it does give what appears to be some quite PREDICTIVE results.
I know you will never ever be able to capture the very top and bottom of every move.
A "Holy Grail" system doesn't exit.
But, using this DMA (+3 settings NOT -3)(Incorporated in the "coloured MA Line Study" with the coloured line price chart (Buy green and green/ sell red and red)
does seem to give you a good chunk in the middle of the move.
Please.
It is worth taking a closer look at.
If you open any chart (Now I have open "Alexanders"usALX(EPIC CODE) only up to 8-03-2007 (As this ways on disk, I don't have real time data feed yet [:(]
Try this formula 1st for the Coloured Line Study (BUT ALSO USE THE COLOURED BARS WITH EXPERT ADVISOR AS MENTIONED BEFORE IN THE POST
Code:
{ User input }
periods:=Input("Mov Avg periods",1,2600,21);
{ Data Array }
x:= Mov(C,periods,E);
shift:= 0.9* Min(x, CLOSE);
y:=If(Mov(C,5,E)>x,x,shift);
z:=If(Mov(C,5,E)<x,x,shift);
{Plot - use points only line-style for best effect}
y; {y=Up colour Blue}
z; {z= Down colour Red}
shift; {colour me the same as the chart background colour}
NOW TRY IT WITH THIS PLEASE (Includes Displace MA)
Code:
periods:=Input("Mov Avg periods",6,2600,13);
slowMA:= Ref(Mov(C,periods,S),+3);
fastMA:= Ref(Mov(C,5,E),+3);
shift:= 0.9* Min(slowMA, LOW);
up:=If(fastMA>slowMA,slowMA,shift);
dn:=If(fastMA<slowMA,slowMA,shift);
{Plot - use points only line-style for best effect}
up; {green}
dn; {red}
shift; {colour me the same as the chart background colour}
A vast improvement it seems.
The one line of code which is;
Code:
shift:= 0.9* Min(slowMA, LOW);
Could be?;
Code:
shift:= 0.9* Min(slowMA, CLOSE);
Not sure, if this matters Wabbit?
So, to sum up, why not use a FORWARD, PREDICTIVE MA?? It's a short 3 period.
DiNapoli as he said looked at 1000's of charts, tried every MA, and came to stick with
a FORWARD displace MA.
I've tried searching on Google and found a bit more info on these.
To be a good driver we don't need to know how a car engine works, it's [censored]ton sizes,
weight, drag coefficient etc etc to drive it well.
Same with this Colour Coded Idea to enter and exit and stay with a trend. Coloured MA Line Study, confirmed with Coloured Price Chart.
Buy Green Green, Sell Red and Red.
KISS. (Keep it simple Stupid).
That said, if this could be somehow programmed into a system tester (the 2 different Coloured MA Line Sudies Formula's,(one with the forward +3 MA, the other without), we could get some numbers and see how it pans out on a basket of stocks.
Also,, my sample size is small.
More charts need to be looked at.
Another idea is to run some systems tests that return high pts values for trending systems and use these returned stocks in conjuction with the coloured charting and line idea, as these stocks tend to trend well, or maybe on "Efficient Stocks"
I think Van Tharp done some work in this area.
Thread here; (Worth a look)
http://forum.equis.com/forums/thread/16214.aspx
So, Wabbit, I know you have quoted "Do not move the data into the future", but,,,,
I hope some of my comments might stimulate further investigation.
I hope you don't mind me disagreeing with you.
It's not about who's right or wrong. (This one sentence could lead into a great trading psychology debate :-)
But,, just try it out if you may, it is worth a look.
Again, as always,
many many thanks for your help.
I do feel this post/ your coding has some real potential as a simple, visual
PROFITABLE trading system.
Many thanks
theghost.