Hi Jason,
Success! I finally understand it. Just to be sure, I ran all four versions of the 10ema efs on a chart today and they did what I expected.
1. Using return ema10.getValue(0);
per the efs at the top of your last note, produced the red line, showing todays real time daily ema10 values calculated and plotted based on the close of each 10 minute bar. The prior day, the red line is flat and underneath the cyan line (as only the final close value from the series is used). And as expected, if I changed the symbol or time interval mid-day, the red line became flat until that point, then a curve from then onwards.
2. Using return getSeries(sma10);
produced the cyan line, (which is the red line flattened to the last value of the cyan line).
3. Using return ema10.getValue(-1);
produced a lime line, not seen because it is underneath the white line. Since it plots the ema based on the close of the previous day, it aligns with cyan line of the previous day.
4. Using return ema(10, inv("D"), -1);
with no if statements (the two line PHP in your last note) produced the white line (yesterdays closing ema).
-----------------------------------------------------------------
So, now that I know what each option does, I will definitely use 4. above to plot yesterdays daily 50 and 200 MA's in intraday charts, since 4. does least processing, and since these MA's usually change so little in one day. And I'll probably use it for the faster 10 and 20 MA's as well, since the white line (yesterdays closing ema) isn't so much different from the cyan line (the real time daily ema... sma's would change even less). I'll see next week if changing these efs to option 4 makes a noticeable difference in CPU loading, or maybe relative to all my other efs's, alerts and quote lists, it won't make a noticeable difference.
I beleive we said earlier that options 1 and 2 above look at every tick. I assume I could use setComputeOnClose in 1. or 2. which should greatly reduce their CPU requirements?
In retrospect, I was thinking the If statement was loading a cast-in-stone series, and I wasn't understanding that the return statement was updating the latest value in that series. So thanks for all your help in breaking my mental block.
Regards
shaeffer
Success! I finally understand it. Just to be sure, I ran all four versions of the 10ema efs on a chart today and they did what I expected.
1. Using return ema10.getValue(0);
per the efs at the top of your last note, produced the red line, showing todays real time daily ema10 values calculated and plotted based on the close of each 10 minute bar. The prior day, the red line is flat and underneath the cyan line (as only the final close value from the series is used). And as expected, if I changed the symbol or time interval mid-day, the red line became flat until that point, then a curve from then onwards.
2. Using return getSeries(sma10);
produced the cyan line, (which is the red line flattened to the last value of the cyan line).
3. Using return ema10.getValue(-1);
produced a lime line, not seen because it is underneath the white line. Since it plots the ema based on the close of the previous day, it aligns with cyan line of the previous day.
4. Using return ema(10, inv("D"), -1);
with no if statements (the two line PHP in your last note) produced the white line (yesterdays closing ema).
-----------------------------------------------------------------
So, now that I know what each option does, I will definitely use 4. above to plot yesterdays daily 50 and 200 MA's in intraday charts, since 4. does least processing, and since these MA's usually change so little in one day. And I'll probably use it for the faster 10 and 20 MA's as well, since the white line (yesterdays closing ema) isn't so much different from the cyan line (the real time daily ema... sma's would change even less). I'll see next week if changing these efs to option 4 makes a noticeable difference in CPU loading, or maybe relative to all my other efs's, alerts and quote lists, it won't make a noticeable difference.
I beleive we said earlier that options 1 and 2 above look at every tick. I assume I could use setComputeOnClose in 1. or 2. which should greatly reduce their CPU requirements?
In retrospect, I was thinking the If statement was loading a cast-in-stone series, and I wasn't understanding that the return statement was updating the latest value in that series. So thanks for all your help in breaking my mental block.
Regards
shaeffer
Comment