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
Power Language problem
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: Power Language problem
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");
- CrazyNasdaq
- Posts: 321
- Joined: 02 Sep 2009
- Location: ITALY
- Has thanked: 98 times
- Been thanked: 89 times
Re: Power Language problem
You miss the comma after the RSI(close,3) , 3);
RSIsma = AVERAGE(RSI(CLOSE,3) , 3);
This will work !!!
RSIsma = AVERAGE(RSI(CLOSE,3) , 3);
This will work !!!
Re: Power Language problem
DOH!!!!You miss the comma after the RSI(close,3) , 3);
RSIsma = AVERAGE(RSI(CLOSE,3) , 3);
This will work !!!
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
- CrazyNasdaq
- Posts: 321
- Joined: 02 Sep 2009
- Location: ITALY
- Has thanked: 98 times
- Been thanked: 89 times
Re: Power Language problem
it Works fine to me (SPtrader code copy and paste)
try to manage the scaling setting with 3 or more decimals
try to manage the scaling setting with 3 or more decimals
Re: Power Language problem
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
So it's all good after doing that!
: )
Thanks for the help!
DC
Re: Power Language problem
Hi SPtrader,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");
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