code conversion to easy language

Questions about MultiCharts and user contributed studies.
ppc
Posts: 42
Joined: 04 Nov 2014
Has thanked: 4 times

code conversion to easy language

Postby ppc » 01 Mar 2016

Hi,

I would like to ask for help to convert the following code (I guess is Metastocks) to easy language. Thanks.

VAR2:=REF( LOW, 1 ) ;
VAR3:=SMA(ABS(LOW-VAR2 ) , 3 , 1 ) / SMA(MAX(LOW-VAR2,0),3,1)*100;
VAR4:=EMA(IF( CLOSE * 1.2 , VAR3*5 , VAR3 / 5 ) , 9 ) ;
VAR5:=LLV(LOW,67 ) ;
VAR6:=HHV(VAR4,67 ) ;
VAR7:=IF(LLV(LOW,76),1,0 ) ;
VAR8:=EMA(IF(LOW<=VAR6,(VAR6+VAR7*2)/2,0),5)/548*VAR7;
ST01:STICKLINE (1, VAR8 ,0 ,4 ,1 ),COLORF000FF, NOTITLE;

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: code conversion to easy language

Postby JoshM » 01 Mar 2016

I would like to ask for help to convert the following code (I guess is Metastocks) to easy language. Thanks.
Here's a first untested attempt:

Code: Select all

value2 = Low[1];
value3 = AverageFC(AbsValue(Low - value2), 3) / AverageFC(MaxList(Low - value2, 0), 3) * 100;
value4 = XAverage(iff(Close * 1.2 ? ___, value3 * 5, value3 / 5), 9);
value5 = Lowest(Low, 67);
value6 = Highest(value4, 67);
value7 = iff(Lowest(low, 76) ? ___, 1, 0);
value8 = XAverage(iff(Low <= value6, (value6 + value7 * 2) / 2, 0), 5) / 548 * value7;
// ST01:STICKLINE (1, VAR8 ,0 ,4 ,1 ),COLORF000FF, NOTITLE; ???
Please note the question marks in 3 lines since I couldn't grasp what the code is intended to do there. The same goes for the last line. With more information that confusion might be lifted.

ppc
Posts: 42
Joined: 04 Nov 2014
Has thanked: 4 times

Re: code conversion to easy language

Postby ppc » 02 Mar 2016

Thanks JoshM, actually I have no idea about the syntax of original code. What will be the output of these 2 line code (for value4 and value7) if the test is not valid?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: code conversion to easy language

Postby JoshM » 03 Mar 2016

What will be the output of these 2 line code (for value4 and value7) if the test is not valid?
Well the point is that, the way I understand it, the original code doesn't perform a test:

Code: Select all

IF( CLOSE * 1.2 , VAR3*5 , VAR3 / 5 )
According to the Metastock documentation, the `if()` function works like this in MetaStock:

Code: Select all

IF( CLOSE * 1.2 > CLOSE , VAR3*5 , VAR3 / 5 )

Code: Select all

IF( CLOSE * 1.2 <= 100 , VAR3*5 , VAR3 / 5 )
Since I don't know what your original code should do in MetaStock, I also don't know how to translate it to PowerLanguage. (I might be overlooking something quite obvious, of course).


Return to “MultiCharts”