BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullCharts discussion
  New Posts New Posts RSS Feed: Bullcharts code for Metastock formula
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Bullcharts code for Metastock formula

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

Joined: 05 Oct 2005
Posts: 27
Post Options Post Options   Quote zzkazu Quote  Post ReplyReply Direct Link To This Post Topic: Bullcharts code for Metastock formula
    Posted: 05 Oct 2005 at 12:41pm
Can somebody convert this Metastock code to Bullcharts..

"HighDays := Input("Enter # days to cover lastHIGH for CBL calc'n:", 3, 55, 13);

If(HIGH < HHV(HIGH, HighDays), {then ...}PREV, {previous CBLhi, else...} If(Ref(L,-2) < Ref(L,-1) AND
Ref(L,-2) < L AND
Ref(L,-1) < L, {then ...} Ref(L,-2),{2nd day back low, else...}
If((Ref(L,-3)< Ref(L,-2) AND
Ref(L,-3) <Ref(L,-1) AND
Ref(L,-3) < L) AND
(Ref(L,-2)< L OR
Ref(L,-1) < L),{then ... } Ref(L,-3), {3rd day back low, else...}
If((Ref(L,-4)<Ref(L,-3) AND
Ref(L,-4) < Ref(L,-2) AND
Ref(L,-4)< Ref(L,-1) AND
Ref(L,-4) < L) AND
(Ref(L,-3)< L OR
Ref(L,-2)< L OR
Ref(L,-1) < L), {then... }
Ref(L,-4), {4th day back low, else...}
If((Ref(L,-5)<Ref(L,-4) AND
Ref(L,-5) < Ref(L,-3) AND
Ref(L,-5) < Ref(L,-2) AND
Ref(L,-5) < Ref(L,-1) AND
Ref(L,-5) < L) AND
(Ref(L,-4)< L OR
Ref(L,-3) < L OR
Ref(L,-2) < L OR
Ref(L,-1) < L), {then ...}Ref(L,-5), {5th day back low, else...} PREV )))))"


and

"{Market closing above is a buy signal}
LowDays := Input("Enter # days to cover lastLOW for CBL calc'n:", 3, 55, 13);

If(LOW > LLV(LOW, LowDays), {then ...} PREV,{previous CBLlo, else...}
If(Ref(H,-2) > Ref(H,-1) AND
Ref(H,-2)> H AND
Ref(H,-1) > H, {then ...} Ref(H,-2), {2ndday back high,else...}
If((Ref(H,-3)> Ref(H,-2) AND
Ref(H,-3) > Ref(H,-1) AND
Ref(H,-3) > H) AND
(Ref(H,-2)> H OR
Ref(H,-1)> H),{then ... } Ref(H,-3), {3rd day back high,else...}
If((Ref(H,-4)>Ref(H,-3) AND
Ref(H,-4) > Ref(H,-2) AND
Ref(H,-4) >Ref(H,-1) AND
Ref(H,-4) > H) AND
(Ref(H,-3)> H OR
Ref(H,-2) > H OR
Ref(H,-1)> H), {then... }
Ref(H,-4), {4th day back high,else...}
If((Ref(H,-5)>Ref(H,-4) AND
Ref(H,-5) > Ref(H,-3) AND
Ref(H,-5) > Ref(H,-2) AND
Ref(H,-5)> Ref(H,-1) AND
Ref(H,-5) > H) AND
(Ref(H,-4)> H OR
Ref(H,-3)> H OR
Ref(H,-2) > H OR
Ref(H,-1) > H), {then ...} Ref(H,-5), {5th dayback high,else...} PREV )))"


Have yet to investigate keys differences..


thanks in advance

greg
Back to Top
pipsqueek View Drop Down
Regular
Regular
Avatar

Joined: 03 Jan 2005
Location: Australia
Posts: 34
Post Options Post Options   Quote pipsqueek Quote  Post ReplyReply Direct Link To This Post Posted: 06 Oct 2005 at 8:02pm

Hi

I've changed the input functions to Bullscript, added in a few closing brackets (hope I've put 'em in the right place), deleted some quote marks, made each plot a different colour and basically left the code alone.

The resulting effort certainly plots 2 lines on chart .... does it do what you were expecting????

...and how do you use it??

 

[target=price;color=red]

HighDays := input("Enter # days to cover lastHIGH for CBL calc'n:", 13, 3, 55);

If(HIGH < HHV(HIGH, HighDays), {then ...}PREV, {previous CBLhi, else...} If(Ref(L,-2) < Ref(L,-1) AND

Ref(L,-2) < L AND

Ref(L,-1) < L, {then ...} Ref(L,-2),{2nd day back low, else...}

If((Ref(L,-3)< Ref(L,-2) AND

Ref(L,-3) <Ref(L,-1) AND

Ref(L,-3) < L) AND

(Ref(L,-2)< L OR

Ref(L,-1) < L),{then ... } Ref(L,-3), {3rd day back low, else...}

If((Ref(L,-4)<Ref(L,-3) AND

Ref(L,-4) < Ref(L,-2) AND

Ref(L,-4)< Ref(L,-1) AND

Ref(L,-4) < L) AND

(Ref(L,-3)< L OR

Ref(L,-2)< L OR

Ref(L,-1) < L), {then... }

Ref(L,-4), {4th day back low, else...}

If((Ref(L,-5)<Ref(L,-4) AND

Ref(L,-5) < Ref(L,-3) AND

Ref(L,-5) < Ref(L,-2) AND

Ref(L,-5) < Ref(L,-1) AND

Ref(L,-5) < L) AND

(Ref(L,-4)< L OR

Ref(L,-3) < L OR

Ref(L,-2) < L OR

Ref(L,-1) < L), {then ...}Ref(L,-5), {5th day back low, else...} PREV )))));

 

{and}

[color=green]

{Market closing above is a buy signal}

LowDays := input("Enter # days to cover lastLOW for CBL calc'n:", 13, 3, 55);

If(LOW > LLV(LOW, LowDays), {then ...} PREV,{previous CBLlo, else...}

If(Ref(H,-2) > Ref(H,-1) AND

Ref(H,-2)> H AND

Ref(H,-1) > H, {then ...} Ref(H,-2), {2ndday back high,else...}

If((Ref(H,-3)> Ref(H,-2) AND

Ref(H,-3) > Ref(H,-1) AND

Ref(H,-3) > H) AND

(Ref(H,-2)> H OR

Ref(H,-1)> H),{then ... } Ref(H,-3), {3rd day back high,else...}

If((Ref(H,-4)>Ref(H,-3) AND

Ref(H,-4) > Ref(H,-2) AND

Ref(H,-4) >Ref(H,-1) AND

Ref(H,-4) > H) AND

(Ref(H,-3)> H OR

Ref(H,-2) > H OR

Ref(H,-1)> H), {then... }

Ref(H,-4), {4th day back high,else...}

If((Ref(H,-5)>Ref(H,-4) AND

Ref(H,-5) > Ref(H,-3) AND

Ref(H,-5) > Ref(H,-2) AND

Ref(H,-5)> Ref(H,-1) AND

Ref(H,-5) > H) AND

(Ref(H,-4)> H OR

Ref(H,-3)> H OR

Ref(H,-2) > H OR

Ref(H,-1) > H), {then ...} Ref(H,-5), {5th dayback high,else...} PREV )))))

failing to plan is planning to fail.
Back to Top
zzkazu View Drop Down
Regular
Regular
Avatar

Joined: 05 Oct 2005
Posts: 27
Post Options Post Options   Quote zzkazu Quote  Post ReplyReply Direct Link To This Post Posted: 07 Oct 2005 at 5:51pm
Thanks for doing that pipsqueek.  I use it to confirm entry and exit based on countback theory.  It is only one of the few indicators I use to confirm trends.

zzkazu

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