BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Just a step to the right
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Just a step to the right

 Post Reply Post Reply
Author
Message / View First Unread Post
blackdog View Drop Down
Regular
Regular
Avatar

Joined: 14 Nov 2006
Location: Vatican City State
Posts: 43
Post Options Post Options   Quote blackdog Quote  Post ReplyReply Direct Link To This Post Topic: Just a step to the right
    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);

Back to Top
lmbull View Drop Down
Newbie
Newbie


Joined: 08 Dec 2006
Posts: 11
Post Options Post Options   Quote lmbull Quote  Post ReplyReply Direct Link To This Post 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.
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.69
Copyright ©2001-2010 Web Wiz