whats wrong here, easy language  [SOLVED]

Questions about MultiCharts and user contributed studies.
rbn60604@yahoo.com
Posts: 24
Joined: 13 Mar 2012
Has thanked: 11 times

whats wrong here, easy language

Postby rbn60604@yahoo.com » 01 Sep 2012

ok, i give....can someone explain why this doesn't work and tell me what will actually work?

so, I'm trying to compare the close of 30 days ago to the last 29 closes....eg.

Code: Select all

if close[30] < lowest(close,29)[1] then....
I thought this statement would be true if the close of 30 days ago..... was lower that the previous 29 closes, but it doesn't work, it shows charts that have lower closes that the 30 day ago close.

not sure why, please help.

thanks

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

Re: whats wrong here, easy language

Postby TJ » 01 Sep 2012

ok, i give....can someone explain why this doesn't work and tell me what will actually work?

so, I'm trying to compare the close of 30 days ago to the last 29 closes....eg.

Code: Select all

if close[30] < lowest(close,29)[1] then....
I thought this statement would be true if the close of 30 days ago..... was lower that the previous 29 closes, but it doesn't work, it shows charts that have lower closes that the 30 day ago close.

not sure why, please help.

thanks
What is your chart resolution?

What is wrong? What is your result? What is your observation?

Can you draw a chart illustrating the timeline of the code above?

rbn60604@yahoo.com
Posts: 24
Joined: 13 Mar 2012
Has thanked: 11 times

Re: whats wrong here, easy language

Postby rbn60604@yahoo.com » 01 Sep 2012

What is your chart resolution?

I was looking at a standard multicharts 1 day chart (each bar is one day going back 90 days)....in this case a custom future of wheat


What is wrong? What is your result? What is your observation?

whats wrong is that its set to alert if the comparison is true, so if the close of 30 days ago is lower than the last 29[1], then it should alert. It alerts but the close of 30 days ago is higher than the lowest close of previous 29, so my result/observation is that it alerts when it shouldn't, but obviously i'm wrong in the code.

Can you draw a chart illustrating the timeline of the code above?

I'm honestly not sure how to 'draw' a chart but the chart I'm looking at ZW SEP 12, sep wheat

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

Re: whats wrong here, easy language

Postby TJ » 01 Sep 2012

you can try this debug method: plot the variables:

Code: Select all

plot10( close[30], "C[30]");
plot20( lowest(close,29)[1], "Lowest29");
Plot them as lines, you can then visually inspect where the variables sit at the end of each day.

rbn60604@yahoo.com
Posts: 24
Joined: 13 Mar 2012
Has thanked: 11 times

Re: whats wrong here, easy language  [SOLVED]

Postby rbn60604@yahoo.com » 01 Sep 2012

tried to 'thank' you but it says invalid thanks FYI.

But thanks for that, not sure it works yet but ill keep plugging away, probably have to come back.

Appreciate it.


Return to “MultiCharts”