Print Page | Close Window

Just a step to the right

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=394
Printed Date: 20 May 2024 at 6:02am
Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com


Topic: Just a step to the right
Posted By: blackdog
Subject: Just a step to the right
Date Posted: 15 Nov 2006 at 9:43am
I have written an indicator that shows what tomorrows price must be for MACD crossover to occur. To do this I displace the indicator plot one bar to the right using Next>Advanced>Horizontal Shift 1 so that it plots the last price on tomorrows bar. I would prefer to do it within the formula but so far all attempts result in a plot which is truncated at todays bar. Any suggestions?
 
Here is the code sofar:-
 

n1 := input("Short moving average",12,1);

n2 := input("Long moving average",26,1);

ns := input("Signal periods",9,1);

 

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);

predictor := (signal+ma26*(1-r2)-ma12*(1-r1))/(r1-r2);

[Name=MACDP; color=green]

predictor;

 

{ Fill }

{shows green for Predictor below price line = MACDH positive}

{shows red for Predictor above price line = MACDH negative}

[name=Fill; linestyle=fill]

[color=green] c;

[color=red] predictor;

[visible=true]

 

{ Markers }

[visible=false]

[name=BUY; linestyle=marker; marker=type1; tooltip="Price passed above MACD Predictor"]

cross(C,predictor);

[name=SELL; linestyle=marker; marker=type2; tooltip="Price passed below MACD Predictor"]

cross(predictor,C);




Replies:
Posted By: lmbull
Date Posted: 21 Nov 2007 at 6:52pm
Thanks for this piece of code. What I was wondering is if it is possible to do an intra day scan of stock that have met this criteria, or on the snapshot data.
 



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