Momentum and Trend Strategies
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=585
Printed Date: 24 Apr 2025 at 2:03am Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com
Topic: Momentum and Trend Strategies
Posted By: maximo
Subject: Momentum and Trend Strategies
Date Posted: 13 Oct 2009 at 5:33am
Paint bars according to agreement of Momentum and RSI. shows pivot highs and lows in the direction of the trend. IB = inside bar, another method of entry into a trend.
[description ="Trading in the direction of Momentum, Max"]
[target =price]
period := input("RSI period",21,1);
RS := RSI( C,period);
n := input("MOM period",10,1);
MOM:=100*( ma((C-Ref(LLV(C,n),-n)),5,E) / ma((HHV(C,n)-LLV(C,n)),5,E));
method := inputma("Method",S);
[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 =black]
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);
{ inside day }
insidebar:= if(H<hist(H,1) and L>hist(L,1),1,0);
MAup:= ma(C,period,S)>hist(ma(C,period,S),2)
[linestyle =marker; marker=type1; name=IB]
if (MOM > 0 and RS > 50 and inside and MAup,1,0);
[linestyle =marker; marker=type2; name=IB]
if (MOM < 0 and RS < 50 and inside and not MAup,1,0);
{ Pivot highs }
[linestyle =points; color=blue; width=2]
PHl:= if(ref(MAup,1) and ref(H,1)>H and ref(H,1)>ref(H,2),H*1.003,undefined);
PHi:= if(MAup and H>ref(H,-1) and ref(H,1)<H,H*1.003,undefined);
PHiR:= if(ref(PHi,-1),H*1.003,undefined);
PHi;
{ Pivot lows }
[color =red]
PLl:= if(not ref(MAup,1) and ref(L,1)<L and ref(L,1)<ref(L,2),L*0.997,undefined);
PLo:= if(not MAup and L<ref(L,-1) and ref(L,1)>L,L*0.997,undefined);
PLoR:= if(ref(PLo,-1),L*0.997,undefined);
PLo;
[drawundefined =gap]
[linestyle =solid; color=blue; width=1]
if (PHl,PHl,if(PHi,PHi,if(PHiR,PHiR,undefined)));
[color =red]
if (PLl,PLl,if(PLo,PLo,if(PLoR,PLoR,undefined)));
|
Replies:
Posted By: magpie
Date Posted: 18 Oct 2009 at 11:16am
Hi Maximo,
Many thanks for your excellent posts-appreciated!
I decided to place your Mom.trend into my custom bar,however the price bar colours revert to black after one 'useage.Any thoughts?
|
Posted By: maximo
Date Posted: 18 Oct 2009 at 2:44pm
The only answer I have to that is to click on the DEFault template or any other template. That reverts the colors.
|
|