%boilinger bands

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
Mobiius
Posts: 60
Joined: 11 Mar 2010
Location: Victoria, BC, Canada
Has thanked: 4 times

%boilinger bands

Postby Mobiius » 01 Jul 2010

hi im trying to create an indicator i found in a magazine.

the code is TS code so I suppose that's where the problem lies.

i try to compile but it gives an error:

Code: Select all

Once( CurrentBar > Period + TEMA_Period )
OkToPlot = true ; (THIS IS WHERE IT SAYS THERE'S AN ERROR, WITH THE OKTOPLOT)
THE ERROR STATES:
syntax error, unexpected 'identificator'
effline 22, errColumn 1, errLineEnd22, errColumnEnd1
causal study: (Function)
is this something i can fix?
Last edited by Mobiius on 01 Jul 2010, edited 1 time in total.

User avatar
Mobiius
Posts: 60
Joined: 11 Mar 2010
Location: Victoria, BC, Canada
Has thanked: 4 times

SORRY Wrong code.

Postby Mobiius » 01 Jul 2010

sorry, wrong code. this is it:

Code: Select all

inputs:
TEMA_Period( 8 ),
Period( 18 ),
UpperBandDev( 1.6 ),
LowerBandDev( 1.6 ),
StandardDevPeriod( 63 ),
BandColor( Cyan ),
SignalLineColor( Magenta ),
MidPointColor( White ) ;

variables:
OkToPlot( false ),
haOpen( 0 ),
haC( 0 ),
TMA1( 0 ),
TMA2( 0 ),
Diff( 0 ),
Z1HA( 0 ),
TMAZ1HA( 0 ),
SD_TMAZ1HA( 0 ),
SVEPerB( 0 ),
SDPerB( 0 ),
PerBUpperBand( 0 ),
PerBLowerBand( 0 ) ;

Once( CurrentBar > StandardDevPeriod )
OkToPlot = true ;

haOpen = 0.5 * ( AvgPrice + haOpen[1] ) ;
haC = 0.25 * ( AvgPrice + haOpen + MaxList( High,
haOpen ) + Minlist( Low, haOpen ) ) ;
TMA1 = TEMA( haC, TEMA_Period ) ;
TMA2 = TEMA( TMA1, TEMA_Period ) ;
Diff = TMA1 - TMA2 ;
Z1HA = TMA1 + Diff ;
TMAZ1HA = TEMA( Z1HA, TEMA_Period ) ;
SD_TMAZ1HA = StandardDev( TMAZ1HA, Period, 1 ) ;

if SD_TMAZ1HA <> 0 then
SVEPerB = 25 * ( TMAZ1HA + 2 * SD_TMAZ1HA -
WAverage( TMAZ1HA, Period ) ) / SD_TMAZ1HA ;

SDPerB = StandardDev( SVEPerB, StandardDevPeriod, 1 ) ;

PerBUpperBand = 50 + UpperBandDev * SDPerB ;
PerBLowerBand = 50 - LowerBandDev * SDPerB ;

if OkToPlot then
begin
Plot1( SVEPerB, "SVE_%b", SignalLineColor ) ;
Plot2( PerBUpperBand, "PerBUpBand", BandColor ) ;
Plot3( PerBLowerBand, "LowerBand", BandColor ) ;
Plot4( 50, "MidPoint", MidPointColor ) ;
end ;
thanks.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Postby TJ » 01 Jul 2010

try this:
Attachments
BB.txt
% Bollinger Bands (MultiCharts version)
(1.44 KiB) Downloaded 512 times

tekram
Posts: 96
Joined: 26 May 2009
Has thanked: 6 times
Been thanked: 18 times

Re: %boilinger bands

Postby tekram » 01 Jul 2010

MC requires the syntax:
Once( CurrentBar > StandardDevPeriod )
begin
OkToPlot = true ;
end;

while TS EL allows a single statement without the begin/end statement block.
Once( CurrentBar > Period + TEMA_Period )
OkToPlot = true ; (THIS IS WHERE IT SAYS THERE'S AN ERROR, WITH THE OKTOPLOT)

THE ERROR STATES:

syntax error, unexpected 'identificator'
effline 22, errColumn 1, errLineEnd22, errColumnEnd1
causal study: (Function)

is this something i can fix?

User avatar
Mobiius
Posts: 60
Joined: 11 Mar 2010
Location: Victoria, BC, Canada
Has thanked: 4 times

Postby Mobiius » 01 Jul 2010

thanks!


Return to “User Contributed Studies and Indicator Library”