Помогите написать индикатор в Meta Trader4

 
' 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
 
круто
Причина обращения: