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.
Size:
Color:
CODE:
Please log in to see this code.
Size:
Color:
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 :".
Size:
Color:
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# ?
Size:
Color:
Thanks - I will look that up.
Size:
Color: