Offset method
Author: wmrgrove
Creation Date: 10/7/2012 1:45 PM
profile picture

wmrgrove

#1
"NEWBE" Trying to learn more about doing offset / lookback and need some help;

I have learned from doc. that we can do offset of a dataseries like this;

Note; I am working on a modified Rotation strategy

CODE:
Please log in to see this code.


MY Questions;

1. Is this also valid????? holder.rsi = ATRP.Series(Bars,slider4.ValueInt [bar-10] -ATRP.Series(Bars,10)[bar]

2. What happens when you use [bar-10]???

3. Will it give the same result as; holder.rsi = ATPRdif[bar] -ATRP.Series(Bars,10)[bar]

Thanks for any help!



profile picture

Eugene

#2
CODE:
Please log in to see this code.

i.e. subtract today's ATRP value from the ATRP value 11 bars ago? How can that be?
QUOTE:
1. Is this also valid????? holder.rsi = ATRP.Series(Bars,slider4.ValueInt [bar-10] -ATRP.Series(Bars,10)[bar]

Depends on what your objective is, but it's known at the moment only to you. At any rate, the syntax is invalid and it doesn't make sense.
QUOTE:
2. What happens when you use [bar-10]???

You access the value of the DataSeries 10 bars ago.
QUOTE:
3. Will it give the same result as; holder.rsi = ATPRdif[bar] -ATRP.Series(Bars,10)[bar]

Offsetting a DataSeries to the right (>>) for N bars and accessing the value of the resulting DataSeries at the current bar is equivalent to accessing the value of the original DataSeries at bar-N.
profile picture

wmrgrove

#3
Ok, I will try to be more specific;

The 2 lines below create a dataseries that shows the ATRP in the last 10 days compared to the 70 day period offset 10 days. or Is volatility increasing or decreasing in the last 10 days versus the 70 day prior period.

Is that correct?

DataSeries ATPR70d = ATRP.Series(Bars,70)>>11;

DataSeries ATPRdif = ATPR70d - ATRP.Series(Bars,10);


Now in my Rotation Strategy I am using this volatility as part of my Rotation Ranking.

I was trying to learn if the line below is also valid and would give the same result?

= ATRP.Series(Bars,slider4.ValueInt [bar-10] -ATRP.Series(Bars,10)[bar]

If not what is a valid use of [bar-10] or some number? Could not find any documentation on this?

Thanks for your patience! Bill


profile picture

Eugene

#4
QUOTE:
I was trying to learn if the line below is also valid and would give the same result?

It's missing a closing bracket ")".
CODE:
Please log in to see this code.

QUOTE:
If not what is a valid use of [bar-10] or some number? Could not find any documentation on this?

WealthScript Programming Guide: DataSeries > Accessing a Single Value from a DataSeries.
profile picture

wmrgrove

#5
Eugene, Thanks for your timely response. I know this is all 2nd nature to you but it is hard to learn for some of us!
Yes I did leave out the ) on my post, but not my strategy.

I have read all the help including

"WealthScript Programming Guide: DataSeries > Accessing a Single Value from a DataSeries." I could not find any use/example of [bar-10] or any [bar-number] example offset.

So I'll ask my question a little differently;
Is this dataseries method below: (used in a Rotation Strategy)

DataSeries ATPR70d = ATRP.Series(Bars,70)>>11;

DataSeries ATPRdif = ATPR70d - ATRP.Series(Bars,10);

holder.ATRP = ATPRdif [bar];


Going to give the same result , as this method


holder.ATRP = ATRP.Series(Bars,70) [bar-10] - ATRP.Series(Bars,10)[bar];


Maybe a simpler way to ask

does this line below return the EMA modern, 60 period ROC value, from 79 periods ago??

EMA.Series(ROC.Series(Close,1),60,EMACalculation.Modern)[bar-80]

Could you simply explain the advantage of using either method??

Thanks, Bill


profile picture

Eugene

#6
QUOTE:
Going to give the same result , as this method

Here's a little test:
CODE:
Please log in to see this code.

Now change the first line to:
CODE:
Please log in to see this code.

Hope that helps.
profile picture

wmrgrove

#7
Eugene; That helps a lot! Thanks

I did not know how to use print debug before, will do some work with that.

The example in the programming guide also shows how to label the Debug Line Data, great!


The last, last, part of my question was, Could you simply explain the advantage of using either method??

Is there an advantage or a preferred method????


profile picture

Eugene

#8
Every tool has its purpose. Use what fits the task. Best of luck.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).