Can a spike at the start of plotted series be removed?
Author: grtrader
Creation Date: 8/5/2014 2:58 PM
profile picture

grtrader

#1
For the following script, I want to plot the difference between today's close and yesterday's close. It works, but there is a large spike on the first bar since it subtracts 0. The chart's vertical span is then so large that the actual data can hardly be seen. Can this series be started a few bars in to eliminate this?

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

Eugene

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

grtrader

#3
Thanks - that was a quick response.

I am not familiar with the following code:
dif[bar] = ( bar <= 2 ) ? 0 : Close[bar] - Close[bar - 2];

Could you describe what this means in words - specifically "bar <= 2 ) ? 0 :".
profile picture

Eugene

#4
This is a so called ternary operator. To find out more, look it up in MSDN. Additionally, you may find this collection of free online C# 101 tutorials useful:

How do I start with C# ?
profile picture

grtrader

#5
Thanks - I will look that up.
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).