Power Language problem

Questions about MultiCharts and user contributed studies.
dennisc
Posts: 32
Joined: 25 Feb 2014
Has thanked: 16 times
Been thanked: 9 times

Power Language problem

Postby dennisc » 17 Aug 2014

I'm having a problem converting EL code into Power Language (I know nothing about either); I'm trying to create Connie Brown's Composite Index (originally Andrew Cardwell's CFG Momentum Oscillator). The following is the way Brown claims it's done in TS:

First,create two functions in EasyLanguage; The first is a 9-period momentum study of RSI:

RSIDelta = MOMENTUM(RSI(CLOSE,14),9)

Then a smoothed short period RSI is created:

RSIsma = AVERAGE(RSI(CLOSE,3)3)

The indicator code will then be:

Plot1(RSIdelta+RSIsma,"Plot1");
Plot2(average((plot1),13),"Plot2");
Plot3(average((plot1),33),"Plot3");

The first function for the RSIDelta compiles just fine.

: )

But when I try to compile the second function in the PowerLanguage Editor, I get the following error:

"syntax error, expecting 'bars'
line 1, column 29", which refers to the last "3" in the line of code for the "RSIsma".

: (

I have absolutely no idea what it needs to make this work.

Can someone please provide the correct coding so that it will work in MultiCharts?

Thanks,

DC

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: Power Language problem

Postby sptrader » 17 Aug 2014

Try this:

Code: Select all


vars:rsidelta(0),rsisma(0);

rsidelta = MOMENTUM(RSI(CLOSE,14),9);

//Then a smoothed short period RSI is created:

rsisma = average(RSI(CLOSE,3),3);

//The indicator code will then be:

Plot1(rsidelta+rsisma,"Plot1");
Plot2(average((plot1),13),"Plot2");
Plot3(average((plot1),33),"Plot3");

dennisc
Posts: 32
Joined: 25 Feb 2014
Has thanked: 16 times
Been thanked: 9 times

Re: Power Language problem

Postby dennisc » 18 Aug 2014

Still get the same syntax error:

RSIsma = AVERAGE(RSI(CLOSE,3)3);

------ Compiled with error(s): ------
syntax error, expecting 'bars'
line 3, column 29

User avatar
CrazyNasdaq
Posts: 319
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 97 times
Been thanked: 86 times

Re: Power Language problem

Postby CrazyNasdaq » 18 Aug 2014

You miss the comma after the RSI(close,3) , 3);

RSIsma = AVERAGE(RSI(CLOSE,3) , 3);

This will work !!!

dennisc
Posts: 32
Joined: 25 Feb 2014
Has thanked: 16 times
Been thanked: 9 times

Re: Power Language problem

Postby dennisc » 18 Aug 2014

You miss the comma after the RSI(close,3) , 3);

RSIsma = AVERAGE(RSI(CLOSE,3) , 3);

This will work !!!
DOH!!!!

OK Crazy, thanks for that...

Everything compiles OK, BUT... all the indicator values display as zero. Something is missing in the indicator's plotting code, but I'd have no idea what it is...

Here again is Brown's description/code for the indicator, with the PL mods provided so far:

-Create two functions in EasyLanguage first. The first is a 9-period momentum study of RSI. This can be written as:
RSIDelta = MOMENTUM(RSI(CLOSE,14),9)

-Then a smoothed short period RSI is created,
RSIsma = AVERAGE(RSI(CLOSE,3),3)

-The indicator can then be created:
vars:rsidelta(0),rsisma(0);
Plot1(RSIdelta+RSIsma,"Plot1");
Plot2(average((plot1),13),"Plot2");
Plot3(average((plot1),33),"Plot3");


Regards,

DC

User avatar
CrazyNasdaq
Posts: 319
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 97 times
Been thanked: 86 times

Re: Power Language problem

Postby CrazyNasdaq » 18 Aug 2014

it Works fine to me (SPtrader code copy and paste)

Image

try to manage the scaling setting with 3 or more decimals

dennisc
Posts: 32
Joined: 25 Feb 2014
Has thanked: 16 times
Been thanked: 9 times

Re: Power Language problem

Postby dennisc » 18 Aug 2014

Someone on another forum pointed out that I had to include the calculations for RSIDelta and RSIsma in the indicator code itself instead of creating them in two separate functions.

So it's all good after doing that!

: )

Thanks for the help!

DC

dennisc
Posts: 32
Joined: 25 Feb 2014
Has thanked: 16 times
Been thanked: 9 times

Re: Power Language problem

Postby dennisc » 18 Aug 2014

Try this:

Code: Select all


vars:rsidelta(0),rsisma(0);

rsidelta = MOMENTUM(RSI(CLOSE,14),9);

//Then a smoothed short period RSI is created:

rsisma = average(RSI(CLOSE,3),3);

//The indicator code will then be:

Plot1(rsidelta+rsisma,"Plot1");
Plot2(average((plot1),13),"Plot2");
Plot3(average((plot1),33),"Plot3");
Hi SPtrader,

I just realized I didn't correct the problem line with the comma correction you provided; I only added the "vars" codeline you added.

Sorry for not acknowledging that after your post - I just now realized my error.

Mea culpa,

DC


Return to “MultiCharts”