Jump to content

who knows how to program indicator WillStop


gani84

Recommended Posts

' Name: Simplified Larry Williams 3 bar trailing stop

' Purpose: Trailing stop sets a stop value at the lowest low

' (or highest high) over 3 periods before the current day.

' Parameters: Periods: the number of period of lookback

 

#Stop

#Param "Periods",3

 

Dim myvalue as single

Dim mystop as single

 

If signal=longsignal then ' If long signal, calculate

myvalue=LLV(periods)[3] ' lowest low value of last 3 bars

myvalue = MAX(myvalue, 1) ' & chk that todays low is greater

mystop=myvalue

if L<=mystop then ' If stop level is breached

signal=exitsignal ' send exit signal.

end if

 

Plotprice ("stop",mystop,green) ' Plot the stop in price pane

 

else if signal= shortsignal then ' If short signal, calculate

myvalue=HHV(periods)[3] ' highest high value of last 3 bars

myvalue=MIN(myvalue,1) ' & check that todays high is lower

mystop=myvalue ' than this

if H>= mystop then ' If stop level is breached

signal=exitsignal ' send exit signal.

end if

 

Plotprice ("stop",mystop,green) ' Plot the stop in the price pane

end if

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...