Shift DataSeries forward and back
Author: sofia
Creation Date: 1/5/2014 3:52 PM
profile picture

sofia

#1
Hello,

Would like to know if "<<" can be used to stop the signal for given bar numbers.

Example,

CODE:
Please log in to see this code.


similar to

CODE:
Please log in to see this code.



The trigger will not be in real time, but when it does trigger after certain time, the trend has already begun.

What will be the value of highB[bar] at given time. Would it be "0" or "1" or undefined.

Thanks,

Sofia

profile picture

Eugene

#2
QUOTE:
Would like to know if "<<" can be used to stop the signal for given bar numbers.


I don't see any connection between stopping some signal and making future data available on past bars by shifting the DataSeries back. Let's rephrase the question: what do you mean by "stop the signal for given bar numbers", precisely? Chances are, something else might do rather than the offset operators.

QUOTE:
What will be the value of highB[bar] at given time. Would it be "0" or "1" or undefined.


Check it out for yourself with PrintDebug.
profile picture

sofia

#3
I want to mask my dataseries with binary pattern series,
CODE:
Please log in to see this code.


I thought, using "<<" operator would do, but "<<" is not a correct method, because we cannot process data that does not exist.

Is there any other way to generate a binary series?

Thanks.
profile picture

Eugene

#4
Both ! and && operators apply to boolean values, and DataSeries contain double values. Could you tell me rather what are you trying to accomplish with this, illustrating it with real example code? Like I said above, if you show where and how you need to "stop the signal for given bar numbers", we might suggest a working design pattern for that.
profile picture

sofia

#5
Ok, here is an example .
CODE:
Please log in to see this code.


Thanks,

Sofia
profile picture

Eugene

#6
OK, since there seems to be a disconnect between us let's rephrase. I'm not proposing to help you build any "binary series". It makes no sense to me. What I'm trying to do is to understand the purpose of its application to your real task. What your task is in plain English, precisely, without referring to any "binary series" or shift operators? What kind of trade signal are you trying to stop for given bar numbers? Please clarify this.
profile picture

sofia

#7
Sorry for the confusion. I want to use the signal in the future using "<<" shift .
Would like to know if this.

CODE:
Please log in to see this code.


is same as

CODE:
Please log in to see this code.




I am trying to code following condition.

CODE:
Please log in to see this code.

Thanks,

Sofia
profile picture

Eugene

#8
QUOTE:
I want to use the signal in the future using "<<" shift .

Would like to know if this.
is same as

You're right, these are different styles of building the same DataSeries.
profile picture

Cone

#9
Sophia (and anyone else reading this), you do know that shifting data to the left (from the future to the past) using the << operator is peeking, right?

The only valid shift is to take data in the past and shift it to the right using the >> operation.
profile picture

sofia

#10
Hello Another question regarding shift Operator.

Is this
CODE:
Please log in to see this code.


same as

CODE:
Please log in to see this code.


Thanks,

Sofia
profile picture

Eugene

#11
Of course they are not. And you can make sure of that by plotting them, aren't you?

In the 1st fragment, you shift the series on 30-minute scale. On the 2nd, the compressed series are being shifed one bar forward on the chart's native scale (which can be as small as 1-minute).
profile picture

sofia

#12
Hello,

Another question regarding shift signal to left i.e shift using " << " operator.
Is it possible to capture data into separate dataseries for future use at that particular instance whatever the value is.
It might change in the future because of peeking, but is it possible to save the instantaneous value.


CODE:
Please log in to see this code.


Does the dataseries "datap" store the instantaneous values ?

Thanks,

Sofia
profile picture

Eugene

#13
Although it doesn't make sense to me to copy one series into another (at least in this context), but have you tried using PrintDebug or PlotSeries to answer your own question? In Wealth-Lab, strike F11 key and start typing in the first characters to find out more. Hope that helps.
profile picture

innertrader

#14
@Cone (ref. #9 above)

Your post fixed helped me fix the problem I was having. I understand what you are saying, practically. Does that mean that in my code below (you;ll see where I modified to follow your post) I am actually shifting DS sp500LastYear one year forward, **instead of** what I thought I was doing originally: shifting DS sp500Today one year back? In other words the >> and << operators are manipulating the new DS being created, not the data in the one it was derived from?

CODE:
Please log in to see this code.
profile picture

Eugene

#15
QUOTE:
In other words the >> and << operators are manipulating the new DS being created, not the data in the one it was derived from?

Yes, your understanding is correct.
profile picture

innertrader

#16
Thanks.

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