Print Page | Close Window

Index filter as ribbon

Printed From: BullCharts Forum
Category: BullCharts
Forum Name: BullScript
Forum Discription: Technical discussion related specifically to the BullScript programming language.
URL: http://www.bullcharts.com.au/forum/forum_posts.asp?TID=981
Printed Date: 19 May 2024 at 6:51am
Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com


Topic: Index filter as ribbon
Posted By: jakethedog
Subject: Index filter as ribbon
Date Posted: 13 Dec 2014 at 5:19pm
Hi all,

I must admit firstly that coding has me beat! I was wondering if there was a code for an index filter to be placed at the bottom of a chart as a ribbon.
Eg.

If 10 day moving average of XJO is up then ribbon green.
If 10 day moving average of XJO is down the ribbon red.

This ribbon is specific to XJO which I want to place on various different stocks with the idea that the stock won't be bought if the broader market trend (XJO) is red.

Thanks in advance for any ideas.

Jake



Replies:
Posted By: Niftyg
Date Posted: 13 Dec 2014 at 6:24pm
Hi Jake,

This isn't exactly what you asked for but is a ribbon for XJO with price above or below its moving average. The number of days and type of moving average is adjustable.

Regards

Nifty

{ 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]
ref(P,1)>ref(MA(P,n,method),1);
[color=Red; name=Below]
ref(P,1)<ref(MA(P,n,method),1);


Posted By: jakethedog
Date Posted: 15 Dec 2014 at 11:11am
Thanks Nifty,

Works a treat!!!!

Jake



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums® version 9.69 - http://www.webwizforums.com
Copyright ©2001-2010 Web Wiz - http://www.webwiz.co.uk