Power Language Issue - comparing averages within the code?

Questions about MCFX and MCFX Data Feed.
FireWorkz
Posts: 3
Joined: 23 Feb 2010

Power Language Issue - comparing averages within the code?

Postby FireWorkz » 23 Feb 2010

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...

FireWorkz
Posts: 3
Joined: 23 Feb 2010

Postby FireWorkz » 23 Feb 2010

By the way this code is for a Signal...

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Postby TJ » 23 Feb 2010

there is no reason to feel frustrated,
technical support is only a call away.

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

FireWorkz
Posts: 3
Joined: 23 Feb 2010

Postby FireWorkz » 26 Feb 2010

This company has the best customer support I have ever seen! :D


Return to “MCFX”