Last X bars  [SOLVED]

Questions about MultiCharts and user contributed studies.
stefanols
Posts: 51
Joined: 01 Jan 2014
Has thanked: 14 times
Been thanked: 2 times

Last X bars

Postby stefanols » 30 Mar 2016

Hi,

I wonder if it is possible to

Instead of writing e.g.

Code: Select all

If value12[10] <= -1000 or value12[9] <= -1000 or value12[8] <= -1000
or value12[7] <= -1000 or value12[6] <= -1000 or value12[5] <= -1000 or value12[4] <= -1000 or value12<= -1000[3] or value12[2] <= -1000 or value12[1] <= -1000 or value12[0] <= -1000) then
I would like to make it like.

If (Value12, any of the last 10 bars) <=-1000 then

I have looked around but have not found anything.

Best regards

Stefan
Last edited by stefanols on 30 Mar 2016, edited 1 time in total.

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

Re: Last X bars

Postby TJ » 30 Mar 2016

Look up the following keywords:

Highest
Lowest


While you are at it, you should also know these keywords. They will come in handy one day.

MaxList
MinList

stefanols
Posts: 51
Joined: 01 Jan 2014
Has thanked: 14 times
Been thanked: 2 times

Re: Last X bars

Postby stefanols » 30 Mar 2016

Hi TJ,

Thanks for your answer.

These two I am aware of.

But I can not see how they could do what I need.

What I meant was a way to avoid my crude programming like
below. When I e.g. have 2-5 parameters that can happen whithin the last 30-50 bars in
a random order.

If (value12[3] <= -1000 or value12[2] <= -1000 or value12[1] <= -1000) then

I have another charting program and there you can use:

value1 := (anytrue(_var1 < -1000,3));
Is something like this possible in Multicharts?

Thanks in advance.

Best regards

Stefan

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

Re: Last X bars

Postby TJ » 30 Mar 2016

see post #1 & #2
[FAQ] How to Post Codes (... so that people can read)
viewtopic.php?f=16&t=11713

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

Re: Last X bars

Postby TJ » 30 Mar 2016

Do this

Code: Select all


If Lowest ( Value12, 10 ) <= -1000 then

stefanols
Posts: 51
Joined: 01 Jan 2014
Has thanked: 14 times
Been thanked: 2 times

Re: Last X bars  [SOLVED]

Postby stefanols » 30 Mar 2016

Ok I will try thanks.

Stefan


Return to “MultiCharts”