Traders Tips from TASC

Questions about MultiCharts and user contributed studies.
canaussieuck
Posts: 25
Joined: 13 Mar 2012
Has thanked: 2 times

Traders Tips from TASC

Postby canaussieuck » 21 Apr 2012

Can you reproduce this EL Code to use in MultiCharts please?

Code: Select all

_TEMA (Function - set Return Type to double)

{ TASC May 2012 }
{ Sentiment Zone Oscillator }

inputs:
Price( numericseries ), { value to average }
Length( numericsimple ) ; { length of average }

variables:
EMA1( 0 ),
EMA2( 0 ),
EMA3( 0 ) ;

EMA1 = XAverage( Price, Length ) ;
EMA2 = XAverage( EMA1, Length ) ;
EMA3 = XAverage( EMA2, Length ) ;

_TEMA = 3 * EMA1 - 3 * EMA2 + EMA3 ;


_SZO (Indicator)

{ TASC May 2012 }
{ Sentiment Zone Oscillator }
{ Walid Khalil, MFTA, CFTe }

inputs:
Period( 14 ),
LongPeriod( 30 ),
OverBought( 7 ),
OverSold( -7 ),
PlotZeroLine( true ),
PlotDynamicOBandOS( true ) ;

variables:
R( 0 ),
SP( 0 ),
SZO( 0 ),
HighestSZO( 0 ),
LowestSZO( 0 ),
SZORange( 0 ),
DynamicOB( 0 ),
DynamicOS( 0 ) ;

if Close > Close[1] then
R = 1
else
R = -1 ;

SP = _TEMA( R, Period ) ;
SZO = 100 * SP / Period ;

HighestSZO = Highest( SZO, LongPeriod ) ;
LowestSZO = Lowest( SZO, LongPeriod ) ;
SZORange = HighestSZO - LowestSZO ;

DynamicOB = LowestSZO + SZORange * 0.95 ;
DynamicOS = HighestSZO - SZORange * 0.95 ;

Plot1( SZO, "SZO" ) ;
if PlotZeroLine then
Plot2( 0, "Zero" ) ;
Plot3( OverBought, "OB" ) ;
Plot4( OverSold, "OS" ) ;
if PlotDynamicOBandOS then
begin
Plot5( DynamicOB, "DynOB" ) ;
Plot6( DynamicOS, "DynOS" ) ;
end ;

{ Alerts }
if AlertEnabled then
begin
if SZO crosses above OverSold then
Alert( "SZO cross above OS" )
else if SZO crosses above DynamicOS then
Alert( "SZO cross above DynamicOS" )
else if SZO crosses below OverBought then
Alert( "SZO cross below OB" )
else if SZO crosses below DynamicOB then
Alert( "SZO cross below DynamicOB" ) ;
end ;

_SZO_Strategy (Strategy)

{ TASC May 2012 }
{ Sentiment Zone Oscillator }
{ Walid Khalil, MFTA, CFTe }

inputs:
SZOPeriod( 14 ), { length for SZO calculations }
LongPeriod( 30 ), { used for dynamic OB and OS
levels }
SZOAvgLen( 30 ), { moving average length of SZO -
for entry/exit }
TrendEMALen( 60 ), { length for trend EMA }
OverBought( 7 ),
OverSold( -7 ) ;

variables:
R( 0 ),
SP( 0 ),
SZO( 0 ),
SZO_SMA( 0 ),
TrendEMA( 0 ),
HighestSZO( 0 ),
LowestSZO( 0 ),
SZORange( 0 ),
DynamicOB( 0 ),
DynamicOS( 0 ),
BuyCondition1( false ),
BuyCondition2( false ),
BuyCondition3( false ),
SellCondition1( false ),
SellCondition2( false ) ;

if Close > Close[1] then
R = 1
else
R = -1 ;

SP = _TEMA( R, SZOPeriod ) ;
SZO = 100 * SP / SZOPeriod ;
TrendEMA = XAverage( Close, TrendEMALen ) ;
SZO_SMA = Average( SZO, SZOAvgLen ) ;

HighestSZO = Highest( SZO, LongPeriod ) ;
LowestSZO = Lowest( SZO, LongPeriod ) ;
SZORange = HighestSZO - LowestSZO ;

DynamicOB = LowestSZO + SZORange * 0.95 ;
DynamicOS = HighestSZO - SZORange * 0.95 ;

{ Buy Rules/Conditions }
BuyCondition1 = SZO_SMA crosses above 0 and
Close > TrendEMA ;
BuyCondition2 = Close > TrendEMA and
SZO_SMA > SZO_SMA[1] and SZO < DynamicOS ;
BuyCondition3 = SZO_SMA > 0 and SZO crosses above
DynamicOS and TrendEMA > TrendEMA[1] ;

{ Sell Rules/Conditions }
SellCondition1 = SZO_SMA crosses above 0 ;
SellCondition2 = SZO crosses below OverBought and
SZO_SMA < SZO_SMA[1] ;

{ Long Entry }
if BuyCondition1 or BuyCondition2 or BuyCondition3 then
Buy ( "SZO LE" ) next bar market ;

{ Long Exit }
if SellCondition1 or SellCondition2 then
Sell ( "SZO LX" )

User avatar
TJ
Posts: 7238
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Re: Traders Tips from TASC

Postby TJ » 21 Apr 2012

Can you reproduce this EL Code to use in MultiCharts please?
You have more than one code in the post.
I have separated them for you; they should run in MultiCharts with no problem.

Code: Select all

// _TEMA (Function - set Return Type to double)

{ TASC May 2012 }
{ Sentiment Zone Oscillator }

inputs:
Price( numericseries ), { value to average }
Length( numericsimple ) ; { length of average }

variables:
EMA1( 0 ),
EMA2( 0 ),
EMA3( 0 ) ;

EMA1 = XAverage( Price, Length ) ;
EMA2 = XAverage( EMA1, Length ) ;
EMA3 = XAverage( EMA2, Length ) ;

_TEMA = 3 * EMA1 - 3 * EMA2 + EMA3 ;

Code: Select all

// _SZO (Indicator)

{ TASC May 2012 }
{ Sentiment Zone Oscillator }
{ Walid Khalil, MFTA, CFTe }

inputs:
Period( 14 ),
LongPeriod( 30 ),
OverBought( 7 ),
OverSold( -7 ),
PlotZeroLine( true ),
PlotDynamicOBandOS( true ) ;

variables:
R( 0 ),
SP( 0 ),
SZO( 0 ),
HighestSZO( 0 ),
LowestSZO( 0 ),
SZORange( 0 ),
DynamicOB( 0 ),
DynamicOS( 0 ) ;

if Close > Close[1] then
R = 1
else
R = -1 ;

SP = _TEMA( R, Period ) ;
SZO = 100 * SP / Period ;

HighestSZO = Highest( SZO, LongPeriod ) ;
LowestSZO = Lowest( SZO, LongPeriod ) ;
SZORange = HighestSZO - LowestSZO ;

DynamicOB = LowestSZO + SZORange * 0.95 ;
DynamicOS = HighestSZO - SZORange * 0.95 ;

Plot1( SZO, "SZO" ) ;
if PlotZeroLine then
Plot2( 0, "Zero" ) ;
Plot3( OverBought, "OB" ) ;
Plot4( OverSold, "OS" ) ;
if PlotDynamicOBandOS then
begin
Plot5( DynamicOB, "DynOB" ) ;
Plot6( DynamicOS, "DynOS" ) ;
end ;

{ Alerts }
if AlertEnabled then
begin
if SZO crosses above OverSold then
Alert( "SZO cross above OS" )
else if SZO crosses above DynamicOS then
Alert( "SZO cross above DynamicOS" )
else if SZO crosses below OverBought then
Alert( "SZO cross below OB" )
else if SZO crosses below DynamicOB then
Alert( "SZO cross below DynamicOB" ) ;
end ;

Code: Select all

// _SZO_Strategy (Strategy)

{ TASC May 2012 }
{ Sentiment Zone Oscillator }
{ Walid Khalil, MFTA, CFTe }

inputs:
SZOPeriod( 14 ), { length for SZO calculations }
LongPeriod( 30 ), { used for dynamic OB and OS
levels }
SZOAvgLen( 30 ), { moving average length of SZO -
for entry/exit }
TrendEMALen( 60 ), { length for trend EMA }
OverBought( 7 ),
OverSold( -7 ) ;

variables:
R( 0 ),
SP( 0 ),
SZO( 0 ),
SZO_SMA( 0 ),
TrendEMA( 0 ),
HighestSZO( 0 ),
LowestSZO( 0 ),
SZORange( 0 ),
DynamicOB( 0 ),
DynamicOS( 0 ),
BuyCondition1( false ),
BuyCondition2( false ),
BuyCondition3( false ),
SellCondition1( false ),
SellCondition2( false ) ;

if Close > Close[1] then
R = 1
else
R = -1 ;

SP = _TEMA( R, SZOPeriod ) ;
SZO = 100 * SP / SZOPeriod ;
TrendEMA = XAverage( Close, TrendEMALen ) ;
SZO_SMA = Average( SZO, SZOAvgLen ) ;

HighestSZO = Highest( SZO, LongPeriod ) ;
LowestSZO = Lowest( SZO, LongPeriod ) ;
SZORange = HighestSZO - LowestSZO ;

DynamicOB = LowestSZO + SZORange * 0.95 ;
DynamicOS = HighestSZO - SZORange * 0.95 ;

{ Buy Rules/Conditions }
BuyCondition1 = SZO_SMA crosses above 0 and
Close > TrendEMA ;
BuyCondition2 = Close > TrendEMA and
SZO_SMA > SZO_SMA[1] and SZO < DynamicOS ;
BuyCondition3 = SZO_SMA > 0 and SZO crosses above
DynamicOS and TrendEMA > TrendEMA[1] ;

{ Sell Rules/Conditions }
SellCondition1 = SZO_SMA crosses above 0 ;
SellCondition2 = SZO crosses below OverBought and
SZO_SMA < SZO_SMA[1] ;

{ Long Entry }
if BuyCondition1 or BuyCondition2 or BuyCondition3 then
Buy ( "SZO LE" ) next bar market ;

{ Long Exit }
if SellCondition1 or SellCondition2 then
Sell ( "SZO LX" )

canaussieuck
Posts: 25
Joined: 13 Mar 2012
Has thanked: 2 times

Re: Traders Tips from TASC

Postby canaussieuck » 22 Apr 2012

Thanks TJ, i should have looked closer.

CanOZ

canaussieuck
Posts: 25
Joined: 13 Mar 2012
Has thanked: 2 times

Re: Traders Tips from TASC

Postby canaussieuck » 22 Apr 2012

Did you try to compile it? It doesn't like _TEMA, say "unknown Function".

CanOz

sptrader
Posts: 710
Joined: 09 Apr 2010
Location: Colorado
Has thanked: 470 times
Been thanked: 261 times
Contact:

Re: Traders Tips from TASC

Postby sptrader » 22 Apr 2012

Did you try to compile it? It doesn't like _TEMA, say "unknown Function".

CanOz
***************************************************************
That's because you have to "Create" and "Verify" the "_Tema" Function first.

Code: Select all

// _TEMA (Function - set Return Type to double)

{ TASC May 2012 }
{ Sentiment Zone Oscillator }

inputs:
Price( numericseries ), { value to average }
Length( numericsimple ) ; { length of average }

variables:
EMA1( 0 ),
EMA2( 0 ),
EMA3( 0 ) ;

EMA1 = XAverage( Price, Length ) ;
EMA2 = XAverage( EMA1, Length ) ;
EMA3 = XAverage( EMA2, Length ) ;

_TEMA = 3 * EMA1 - 3 * EMA2 + EMA3 ;

SP
Posts: 455
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

Re: Traders Tips from TASC

Postby SP » 22 Apr 2012

Eld from the TS Forum.
Attachments
TASC 052112 SZO.ELD
(7.95 KiB) Downloaded 355 times

canaussieuck
Posts: 25
Joined: 13 Mar 2012
Has thanked: 2 times

Re: Traders Tips from TASC

Postby canaussieuck » 22 Apr 2012

Xie Xie.


Return to “MultiCharts”