Is somebody able and so kind to convert this TS-Code from Pawel Kosinski (Traders' Tips 10/2919) to a working MC-PL Code?
http://technical.traders.com/content/ba ... rchive.asp
Thanks a lot
Code: Select all
PaintBar Indicator: BB with Candlesticks
inputs:
Length( 14 ),
NumDevs( 1 ),
Price( close ) ;
variables:
Sdev( 0 ),
BBUpper( 0 ),
BBMid( 0 ),
BBLower( 0 ) ;
method bool IsBullEngulfing()
begin
return ( Close > Open )
and ( Close[1] < Open[1] )
and ( Close > Open[1] )
and ( Open < Close[1] ) ;
end ;
method bool BollingerBandTrigger()
begin
return ( Close[1] < BBLower[1] )
and ( Close > BBLower )
and ( Low < BBLower ) ;
end ;
BBMid = Average( Price, Length ) ;
SDev = StandardDev( Price, Length, 1 ) ;
BBUpper = BBMid + NumDevs * SDev ;
BBLower = BBMid - NumDevs * SDev ;
if IsBullEngulfing() and BollingerBandTrigger() then
begin
PlotPB( High, Low, "Trade Signal" ) ;
Alert( "Trade Signal Long" ) ;
end ;
Code: Select all
Strategy: BB with Candlesticks
inputs:
Length( 20 ),
NumDevs( 2 ),
Price( close ) ;
variables:
Sdev( 0 ),
BBUpper( 0 ),
BBMid( 0 ),
BBLower( 0 ) ;
method bool IsBullEngulfing()
begin
return ( Close > Open )
and ( Close[1] < Open[1] )
and ( Close > Open[1] )
and ( Open < Close[1] ) ;
end ;
method bool BollingerBandTrigger()
begin
return ( Close[1] < BBLower[1] )
and ( Close > BBLower )
and ( Low < BBLower ) ;
end ;
BBMid = Average( Price, Length ) ;
SDev = StandardDev( Price, Length, 1 ) ;
BBUpper = BBMid + NumDevs * SDev ;
BBLower = BBMid - NumDevs * SDev ;
if IsBullEngulfing() then
Plot1( High ) ;
if BollingerBandTrigger() then
PLot2( Low ) ;
Plot3( BBUpper ) ;
Plot4( BBLower ) ;