Market Mood ribbon |
Post Reply |
Author | |
cudderbean
Regular Joined: 02 Oct 2006 Location: Thailand Posts: 40 |
Post Options
Quote Reply
Topic: Market Mood ribbon Posted: 21 Mar 2011 at 12:39am |
I would like to create a ribbon for the “market mood” of the XAO (or any other index eg. XGD if I’m looking at gold stocks.) to place beneath different stocks so that I consider Long positions when the XAO mood is bullish and consider Shorts when XAO mood is bearish. Using the loadSymbol function. Here’s a simple example of what I mean. Please excuse my novice script writing skills. The ribbon is green if the SMA of the XAO is moving upwards, and pink when its moving downwards. [target=Ribbon; category=xxx] {some sort of input so that I can use different loadSymbols other than XAO ??} n := input("Time periods",14,1); mkttod := ma(loadSymbol("XAO",C),n,method); mktyest := hist(ma(loadSymbol("XAO",C),n,method),1); [color=LightGreen; name=up] [fillstyle=solid] mkttod >= mktyest; [color=Pink; name=dn] [fillstyle=solid] mkttod < mktyest; Ideally I’d like something a bit more comprehensive than one simple indicator to measure the XAO mood. I have in mind using several indicators with a combined calculated score: RSI moving upwards +1 (and -1 if downwards) MA (expr,n,method)moving upwards +1 (and -1 if downwards) MACD >0 +1 (and -1 if downwards) DI+ above DI- +1 (and -1 if downwards) ..to produce ultimately a traffic light ribbon of the XAO (or other index)... green, amber, white, red to be placed beneath different stocks to help me backtest and to go with the trend. The trouble is that I can’t get my head around complicated formulae such as DMI that I know uses the high and the low of the XAO, not just the close. I’m sure other members would find this sort of “poor man’s market map” useful for backtesting. . |
|
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 22 Mar 2011 at 6:23pm |
Hey Cudderbean,
Why didn't I think of that! a ribbon of overall market trend while viewing individual stocks. A very good idea and not in the least a sort of "poor man's market map" LoL.
Here's what other professionals use when considering stocks compared to overall market direction on XAO or XJO/SPI. I bet they aren't poor ;P
Allan Hull 9 x 21ema cross
HomeTrader 20ma
Jim Berg 34ema slope > 5 bars ago
Nick Radge 50ma
Ok I'll have a go at that.
|
|
cudderbean
Regular Joined: 02 Oct 2006 Location: Thailand Posts: 40 |
Post Options Quote Reply Posted: 23 Mar 2011 at 12:11am |
That's most kind of you Maximo.Thank you. I'm not so bothered about ADX in the DMI calcualtion (but of course you may be), just DI+ and DI-. From what I've read it often takes a while for the ADX to build up steam re trend strength. I don't want to throw the baby out with the bathwater by having too restrictive filters in the market mood ribbon... just a "general indicator consensus" that the trend is your friend.. and to focus on appropriate long or short opportunities. |
|
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 23 Mar 2011 at 6:58pm |
Rightyo here are the indicators to compare the index with a stock.
That should keep you busy for a while :P
{ Indicator Name: Ribbon Index Paint Bars }
[description="Ribbon Paint Bars RSI + Momentum"] [target=price] period := input("RSI period",21,1); n := input("MOM period",10,1); method := inputma("Method",E); expr := Expression("Expression",Close); symb := inputsymbol("Compare to", "XJO"); P:=LoadSymbol(symb,expr); RS := RSI(P,period); MOM:=100*(ma((P-Ref(LLV(P,n),-n)),5,E) / ma((HHV(P,n)-LLV(P,n)),5,E)); [linestyle=pricecolor] [color=Lime Green] If(MOM > 0 and RS > 50,1,0); [color=Indian Red] If(MOM < 0 and RS < 50,1,0); [color=Coral] If(MOM < 0 and RS > 50,1,0); If(MOM > 0 and RS < 50,1,0); [linestyle=solid; color=lawn green; width=2] {ma(C,period,method)} ---------------------------------------------
{ Indicator Name: Ribbon Index RSI + Momentum }
[description="RSI + Momentum ribbon of Index"]
[target=Ribbon; category=Moving Average] expr := Expression("Expression",Close); period := input("Time periods",21,1); n := input("MOM period",10,1); symb := inputsymbol("Compare to", "XJO"); P:=LoadSymbol(symb,expr); RS := RSI(P,period); MOM:=100*(ma((P-Ref(LLV(P,n),-n)),5,E) / ma((HHV(P,n)-LLV(P,n)),5,E)); [color=Coral; name=Neutral] SignalNeut:=ref(MOM,1) < 0 and ref(RS,1) > 50 or ref(MOM,1) > 0 and ref(RS,1) < 50; SignalNeut; [color=Lime Green; name=Above] SignalAbove:=ref(MOM,1) > 0 and ref(RS,1) > 50; SignalAbove; [color=Red; name=Below] SignalBelow:=ref(MOM,1) < 0 and ref(RS,1) < 50; SignalBelow; --------------------------------------------- { Indicator Name: Ribbon Index MA }
[description="Moving Average ribbon of Index"]
[target=Ribbon; category=Moving Average] expr := Expression("Expression",Close); method := inputma("Method",Exponential); n := input("Time periods",42,1); symb := inputsymbol("Compare to", "XJO"); P:=LoadSymbol(symb,expr); [color=Lime Green; name=Above] SignalAbove:=ref(P,1)>ref(MA(P,n,method),1); SignalAbove; [color=Red; name=Below]
SignalBelow:=ref(P,1)<ref(MA(P,n,method),1); SignalBelow; Edited by maximo - 24 Mar 2011 at 3:02pm |
|
cudderbean
Regular Joined: 02 Oct 2006 Location: Thailand Posts: 40 |
Post Options Quote Reply Posted: 24 Mar 2011 at 4:05pm |
Thank you very much, Maximo.
If you ever head up my way to Thailand or Perth, I owe you a beer or two mate.
Cheers.
|
|
etrader
Regular Joined: 18 Dec 2004 Posts: 63 |
Post Options Quote Reply Posted: 04 Dec 2011 at 11:23pm |
Hi cudderbean and maximo, I have just come across this post as I was searching on how to script the loadsymbol function properly. I was trying to do a very similar thing as an indicator and use to scan for stocks. Great idea as a ribbon ! and even better the extra you describe above. My main objective was to be able to scan for retraced stocks moving the same direction as the sector using a longer MACD as the sector indicator, and alternatively comparing the the XJO, XAO or whatever is appropriate. I see maximo has been doing some awesome scripts. Nice to see the true potential of Bullcharts. Great work and thanks for sharing !!! Regards etrader
Edited by etrader - 04 Dec 2011 at 11:28pm |
|
joea
Newbie Joined: 15 Nov 2011 Location: Miallo Posts: 19 |
Post Options Quote Reply Posted: 05 Jan 2012 at 10:50am |
HI.
Actually nice to see and appreciate the brilliance of a script writer. BullCharts is just the software! joea |
|
Post Reply |
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 |