Page 1 of 1

%boilinger bands

Posted: 01 Jul 2010
by Mobiius
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?

SORRY Wrong code.

Posted: 01 Jul 2010
by Mobiius
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.

Posted: 01 Jul 2010
by TJ
try this:

Re: %boilinger bands

Posted: 01 Jul 2010
by tekram
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?

Posted: 01 Jul 2010
by Mobiius
thanks!