Impulse |
Post Reply | Page 12> |
Author | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Bana
Regular Joined: 02 Jan 2007 Location: Australia Posts: 46 |
Post Options
Quote Reply
Topic: Impulse Posted: 18 May 2010 at 10:51pm |
|||||||||||||||||||||||||||||||||||||||||||||||||||||
Its getting hot in here............. Hats off to Maximo. I have found no exceptions for following the impulse transitions - bear -> bull
bear -> neutral bull -> bear
bull -> neutral
Exception - Some neutral impulse dont confirm the indicator (some examples 29/7/02, 05/08/02, 05/05/03 five bars, 15/02/10 etc). This happened only where the EMA (second ingredient of impluse) did not confirm the MACDH direction.
However, for the purpose of using this indicator, this exception is not consequential, because once entered I am happy to stay in a neutral zone. Impulse is not a stand alone trading system. Its just an entry criteria. I would have my overall trading strategy guiding the trade management.
Cheers Max....you have done it again!!!!!!
Edited by Bana - 18 May 2010 at 10:53pm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 18 May 2010 at 7:49pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||
I have made an adjustment to those indicators and reposted them. The Change of angle percentage 0.48 value needed to be smaller for indicies for example, XKO. Due to the extra digits of precision required. The number is a factor of change in the angle of the MACD histogram. Rather simple %change without factoring in any momentum. However you'll often see that the line needs to be projected/extended forward from its current angle onto the next future bar. This is where momentum from the previous few bars needs to be accounted for.
Edited by maximo - 18 May 2010 at 10:38pm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Bana
Regular Joined: 02 Jan 2007 Location: Australia Posts: 46 |
Post Options Quote Reply Posted: 18 May 2010 at 4:22pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Its definately getting warmer (and the oscillator is cool), but still some piece is missing. I found quite a few instances of impulse change not complying with the above indicator. Some example of different type of impulse changes are:
Non-conforming bars following signal of:
19/04/10 - neutral to bear
08/02/10 - bear to neutral
06/07/09 - bear to bull
16/03/09 - neutral to bull
03/12/07 - bull to bear
I will look through in detail to see if there is anything common in these non-compliant bars.
By the way, what is the purpose of the different % of '48' you have used in above formula?
Edited by Bana - 18 May 2010 at 4:30pm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 18 May 2010 at 5:44am | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Here's a MACDH on price indicator to see where price must close in order to maintain or change impulse.
[target =price][description =MACDH impulse on price, Max][color =dodger blue; category=Momentum; linestyle=solid]mdha := (( ma(C,12,E)-ma(C,26,E)) - ma(ma(C,12,E)-ma(C,26,E),9,E));[color =dodger blue]if (C<100,C - ((mdha-ref(mdha,-1))*0.48*C),if(C<1000,C - ((mdha-ref(mdha,-1))*0.048*C),C - ((mdha-ref(mdha,-1))*0.0018*C)));This is the oscillator of the above to measure how much the price must change in dollars & cents or points in order to maintain or change impulse.
[description =MACDH impulse point change, Max][color =dodger blue; category=Momentum; linestyle=solid]mdm := (( ma(C,12,E)-ma(C,26,E)) - ma(ma(C,12,E)-ma(C,26,E),9,E));[color =indian red]if (C<100,(mdm-ref(mdm,-1))*0.48*C,if(C<1000,(mdm-ref(mdm,-1))*0.048*C,(mdm-ref(mdm,-1))*0.0018*C));[color =gray]0; Edited by maximo - 18 May 2010 at 8:15pm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Bana
Regular Joined: 02 Jan 2007 Location: Australia Posts: 46 |
Post Options Quote Reply Posted: 16 May 2010 at 9:58pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Maximo, I really appreciate the great effort you have put above. But we are not there yet.
I promised the mathematical representation, so here it goes - Below is the weekly data of XKO - last 6 weeks shown and 1 future forecast (last line).
I have calculated the weekly values of 12 period EMA, the MACDH (12,26,9) and the impulse, on a spreadsheet. The last column shows the price % move for the week. I have cross-checked all values against bullcharts to ensure they are accurate.
Say I want to trade on the long side but rules dont allow me to enter when impluse is bearish. The impulse for last week (20100510) is bearish and the MACDH value is -39.503.
For the impulse to stop being bearish, the MACDH has to reverse direction by at least 1 point (primary condition). I want to know at what minimum price this will happen. Since MACDH is a direct derivation of price, I should be able to forecast this with mathematical precision. Microsoft excel has a great function called "goal seek". I used this function to derive value of -39.502 for MACDH , by recalculating the price. It popped the answer = 4663.760.
At this price the MACDH will have risen by at least 1 point, thus terminating the bearish condition (so as to speak in terms of the indicator). Whether the impulse will become neutral or bullish, is secondary because my key concern is cessation of bearish impluse.
Now if i were to trade this under impulse system, I know I have to wait for the price to rise 1.26% to at least 4663.76 to go long.
Based on the spreadsheet formulas, the forecast 12 period EMA on this price is also calculated (secondary condition). Now I can determine that at a close of 4663.76 would EMA rise or decline. In this case, the answer is 'decline', so the forecast impluse is neutral.
Can this be achieved in bullscript?
cheers
Bana
PS: please substitute 'price' with 'close' when reading the above.
Edited by Bana - 17 May 2010 at 9:51am |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 16 May 2010 at 5:20pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||
{ MACD indicator with histogram } [description ="One of the simplest and most reliable indicators, MACD uses 2 moving averages.compares two moving averages of prices, with 9 day Exponential Moving average as a signal." ][target =Default; category=Moving Average; dp=4][horzline =0]n1 := input("Short moving average",12,1);n2 := input("Long moving average",26,1);ns := input("Signal periods",9,1);{Note: The true MACD is not quite a 12 & 26 exponential moving average } r1 := 2/(n1+1); r2 := 2/(n2+1); ma12 := C*r1 + previous(C)*(1-r1);ma26 := C*r2 + previous(C)*(1-r2);res := wait(ma12 - ma26,25);signal := ma(res,ns,E);[Name =MACD; color=dodger blue]res; [name =Signal; linestyle=solid; color=red]signal; [Name =Histogram; linestyle=Histogram; color=black]histogram:=res - signal; histogram; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 16 May 2010 at 3:42pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Here is the Rate of Change indicator for it.
[Description ="Rate of Change of EMA"]EMA := input("EMA period", 13, 1, 40);[color =lime green]roc (ma(C,EMA,E),1,%) * (0.0048*EMA) * Close;[color =gray]0; Edited by maximo - 16 May 2010 at 4:48pm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 16 May 2010 at 3:38pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||
G'day Bana
I've managed to reduce the margin of error to nearly zero.
The only time a bar remains a neutral colour is when the MACDH is not
confirming the current trend or change of trend.
[description ="Elder Impulse."][citation ="Dr. Elder - Come Into My Trading Room, p.157-162 Copyright (c) 2002, John Bruns and Financial Trading Inc."][target =Price; linestyle=PriceColor]macShort := input("MACD Short MA", 12, 1, 100);macLong := input("MACD Long MA", 26, 1, 100);macSmooth := input("MACD Smoothing Period", 9, 1, 100);EMA := input("Short EMA", 13, 1, 40);macTime := input("Time Ratio", 1, 1, 22);macShort2 := macShort*macTime; macLong2 := macLong*macTime; macSmooth2 := macSmooth*macTime; EMA2 := EMA*MacTime; mac := ma(C,macShort2,E) - ma(C,macLong2,E);macSig := ma(mac,macSmooth2,E);macplot:= (mac-macSig); impulse2 := if(macplot >= hist(macplot, macTime), 1,0) + if(C > ma(C,EMA2,E),1,0)-1;[color =Blue; name=Zone 1]impulse2>0; [color =Red; name=Zone 2]impulse2<0; [color =Black; name=Zone 3]true; {Come Into My Trading Room page 157-162} [color =lawn green; linestyle=solid]ma (C,EMA,E);{ Plot a dot where price would have to move in order to change bar colour, Max} dota:= roc(ma(C,EMA,E),1,%) * (0.0049*EMA) * Close;dotd:= roc(ma(C,EMA,E),1,%) * (0.0047*EMA) * Close;[linestyle =points; color=dodger blue]if (dota < 0 ,C-dota,undefined);[linestyle =points; color=coral]if (dotd > 0 ,C-dotd,undefined);Edited by maximo - 16 May 2010 at 8:23pm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Bana
Regular Joined: 02 Jan 2007 Location: Australia Posts: 46 |
Post Options Quote Reply Posted: 15 May 2010 at 9:16pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||
"worth noting that predictions are not certainties"
Hello Max
Apologies if I have unintentionally conveyed that I am trying to 'predict' price movement. I am not.
Since EMA and MACDH are both mathematical derivation of price, it should be a matter of using the same mathematical principle to 'forecast' the likely movement in EMA based on price. Sounds simple when I say it, but I acknowledge it is a complex mathematical problem.
I will try to illustrate this by using numerical data in spreadsheets.
Thanks for your time.
Cheers
Bana Edited by Bana - 15 May 2010 at 9:18pm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 14 May 2010 at 1:57pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||
I will have a look with those indicator settings. It seems we are missing something though, like the predicted value is being calculated and displayed from the current bar EMA and it's position will change the very next bar due to recalculation of the EMA with 1 more bar being added. For example if the trend is rising, the next actual dot would be carried slightly higher, depending on the strength of the trend. We can't actually see the current dot value either, since it's a predicted value for the next bar.
I based the predicited value on half the current bars exponent percentage. A median calculation of this is the best we can achieve, since price can go either way. You can define the margin of error as half the exponent. This would be half the distance between a dot and the EMA. Not a lot, but worth noting that predictions are not certainties.
Max Edited by maximo - 14 May 2010 at 10:20pm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Post Reply | Page 12> |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |