Page 1 of 1

Power Language Issue - comparing averages within the code?

Posted: 23 Feb 2010
by FireWorkz
Why doesn't this code work properly?

Code: Select all

Vars: OverSold(25),
Price(Close),
AVGLength(66),
PRLength(6);

if Average(Price, AVGLength) < Price
and (PercentR(PRLength)) < OverSold
then
Buy("Test") Next Bar at Market;

With this code when the price is above the average price and percent R returns a value in the "oversold" range which is less then 25 it should buy the next bar.

However it does not work. Using Average(Price, AVGLength) it does not generate any order on the chart.

When I used a function that I made in place of Average() which calculates the average the same way as the built in Average() it will generate an order when percentR() is oversold regardless whether the price is above the average.

Basically power language makes no sense. Is there an issue with comparing averages within the code? Otherwise I see no reason that this code doesn't work properly.

I am super frustrated, it seems power language doesn't even function properly when applied to the MCFX charts...

Posted: 23 Feb 2010
by FireWorkz
By the way this code is for a Signal...

Posted: 23 Feb 2010
by TJ
there is no reason to feel frustrated,
technical support is only a call away.

http://www.tssupport.com/support/contacts/

Posted: 26 Feb 2010
by FireWorkz
This company has the best customer support I have ever seen! :D