Page 1 of 1

PL question

Posted: Dec 16 2012
by designer01
What would be an PL snipett for this frase:

Buy if CCI value crosses above +50
and CCI value has been below +50 for the last 100 bars minimun. (could be more than 100)

The last portion I'm not sure how to express.

In other words CCI value must never have been above 50 for the last 100 (or an X input amount of my choice) minimun. See screenshot attached.

Thanks in advance.

Re: PL question

Posted: Dec 16 2012
by TJ
What would be an PL snipett for this frase:

Buy if CCI value crosses above +50
and CCI value has been below +50 for the last 100 bars minimun. (could be more than 100)

The last portion I'm not sure how to express.

In other words CCI value must never have been above 50 for the last 100 (or an X input amount of my choice) minimun. See screenshot attached.

Thanks in advance.
you can rephrase (re-think) this line

CCI value has been below +50 for the last 100 bars minimun.

to

the highest CCI value of the previous 100 bars, has been lower than 50.

Re: PL question

Posted: Dec 16 2012
by sptrader
I think he is looking for something like:

Code: Select all

if highest(CCI(14)[1],100) <= 49 and CCI(14) crosses above 50 then buy next bar at market;

Re: PL question  [SOLVED]

Posted: Dec 16 2012
by designer01
Ok thank you both
highest
was the function/expression I was looking for...