BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Welles Wilder Super Trend
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Welles Wilder Super Trend

 Post Reply Post Reply
Author
Message / View First Unread Post
meldeans View Drop Down
Newbie
Newbie


Joined: 13 Feb 2009
Posts: 8
Post Options Post Options   Quote meldeans Quote  Post ReplyReply Direct Link To This Post Topic: Welles Wilder Super Trend
    Posted: 26 Nov 2020 at 3:48pm
Hi,

Can anyone help with some issues I am having with Super Trend indicators?  

I am using the indicator to trade long only in SMSF.  I only want to take signals when price is trading above the indicator.  None of my indicators with my criteria work when i include the code line:
c>Formula("Super Trend Wilders", 3, 30, Wilders, 2).

I have copied this formula I presume off here somewhere as below:

{==== BullScript ====}

[Description="SuperTrend - Max"]
[target=price]
Mult:=Input("ATR Multiplier",3,1);
Nb:=Input("Nb Periods",8,1);
method:=inputma("Method",Wilders);
price:=Input("1=Median, 2=Close",1,1);
TruRan:=ma(ATR(1),Nb,method)*Mult;
HiLimit:=if(price=1,(H+L)/2-TruRan,C-TruRan);
LoLimit:=if(price=1,(H+L)/2+TruRan,C+TruRan);
LB:=If(HiLimit>=PREV and HiLimit<C,HiLimit,If(C<PREV,HiLimit-0.1,PREV));
UB:=If(LoLimit<PREV and LoLimit>C,LoLimit,If(C>PREV,LoLimit+0.1,PREV));
Trend:=if(UB>ref(UB,-1),1,if(LB<ref(LB,-1),-1,prev));
[drawundefined=gap]
[Color=lime green]
if(Trend=1 and hist(Trend,1)=-1,LB,if(Trend=-1,UB,undefined));
[Color=red]
if(Trend=-1 ,UB,if(hist(Trend,1)=1 ,LB,undefined));
[Color=lime green]
if(Trend=1 or Trend=0,LB,undefined);

When I display the Super Trend indicator in a pane all of its own so it should show "0" when price below indicator and "1" when above.  It only shows "1" when price crosses above when it immediately does not each day that it is true.

Appreciate any help.

Thanks
Dean



Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 04 Dec 2020 at 2:12am




Edited by maximo - 06 Dec 2020 at 11:20pm
Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 04 Dec 2020 at 4:24am
It probably doesn't constantly show a 1 or 0 due to the 'undefined' output for changing the line colours.
This similar indicator is easier to adapt.   The last line should provide the digital output you're looking for.

{ Stop Trail ATR }
[Target=price]
atrper :=Input("ATR period: ",14);
atrfact:=Input("ATR multiplier: ",2);
loss:=atrfact*ATR(atrper);
trail:=
If(C>PREV and Ref(C,-1)>PREV, Max(PREV,C-loss),
If(C<PREV and Ref(C,-1)<PREV, Min(PREV,C+loss),
If(C>PREV, C-loss, C+loss)));
Trail;

{ digital signal: if close is above previous value it's in buy(1) else it's in sell(0) }
direction := if(close>prev,1,0);




Edited by maximo - 06 Dec 2020 at 11:19pm
Back to Top
meldeans View Drop Down
Newbie
Newbie


Joined: 13 Feb 2009
Posts: 8
Post Options Post Options   Quote meldeans Quote  Post ReplyReply Direct Link To This Post Posted: 09 Dec 2020 at 2:02pm
Sorry for the delay response - thought i had email notification set on my post but didn't.

Thanks Maximo - works a treat.  Really appreciate it. Clap
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