The combination of the two formulas below will plot your MA on intra-day charts. Download and save getPrevDaysOHLC.efs to /Formulas/OHLC/. Then download and save DailyMAonIntraday.efs to any folder inside /Formulas/.
Then all you need to do is apply DailyMAonIntraday.efs to your 5 minute chart and you will see the 10 day moving average plotted as a blue line, which includes the current day's data for the MA. This formula will work on any intra-day interval. If you want to show the 10-day MA for the previous 10 trading days, enter -1 for nOffset.
DailyMAonIntraday.efs input parameters can be changed through the "Edit Studies" option.
nLength: Default is 10. (Length for moving average)
nPriceSource: Default is Close. Valid inputs are Open, High, Low and Close.
nOffset: Default is 0. (Offsets the group of data to calculate MA in terms of number of Days)
getPrevDaysOHLC.efs is a utility formula that is called from the above formula using the callFunction() function. Syntax for using callFunction() on getPrevDaysOHLC.efs follows.
var aData = callFunction("/OHLC/getPrevDaysOHLC.efs", "main", nPriceSource, nOffset, nNumDays);
Jason K.
Project Manager eSignal - an Interactive Data company
I downloaded the scripts and the moving averages show up fine but they are only as of the previous day, not the current day. I check against the moving average plotted on a daily chart. It is probably because it calls getPREVIOUSdaysOHLC. Is there a way I can get the formula to use the current days data?
Thanks.
You're observations are correct. My previous message was slightly incorrect. The getPrevDaysOHLC.efs formula does not include the current day's price. I need to make a new version of that formula for the library. For the time being, DailyMAonIntraday2.efs, should work for you. If you enter 5 for the length, the MA will be based on the current day's close plus the previous 4 days closes. In addition to getPrevDaysOHLC.efs you'll need to download, getTodayOHLC1.efs, and save it to \eSignal\Formulas\OHLC\ as well. Try it out and let me know if you have any trouble.
Jason K.
Project Manager eSignal - an Interactive Data company
You're observations are correct. My previous message was slightly incorrect. The getPrevDaysOHLC.efs formula does not include the current day's price. I need to make a new version of that formula for the library. For the time being, DailyMAonIntraday2.efs, should work for you. If you enter 5 for the length, the MA will be based on the current day's close plus the previous 4 days closes. In addition to getPrevDaysOHLC.efs you'll need to download, getTodayOHLC1.efs, and save it to \eSignal\Formulas\OHLC\ as well. Try it out and let me know if you have any trouble.
thanks! the only problem is that i want this to update on the 5-min chart every bar. you have to manually reload the script to update the value. any ideas?
Magda
The error message could suggest that you did not download the required file. Note that at the link provided there are three files with a similar name. Make sure you are downloading getPrevDaysOHLC.efs
Alex
Originally posted by Magda Hi There,
I downloaded the file as suggested and added it to the same formula folder as the 3 days rolling average formula. The error message on line 59
"formula file not found: /OHLC/getPrevDaysOHLC.efs
Double checked the downloaded formula file and it is the correct one. It opens fine on its own in the "Editor" but I am now not sure how to get the error fixed as it still prevails.
Any other fixes I could try?
Thanks for your patience.
Magda
Originally posted by Alexis C. Montenegro Magda
The error message could suggest that you did not download the required file. Note that at the link provided there are three files with a similar name. Make sure you are downloading getPrevDaysOHLC.efs
Alex
Magda
Are both formulas located in the OHLC folder in Formulas?
If not then you can do one of two things. Either move the getPrevDaysOHLC.efs to the OHLC folder or edit the calling script and change the path from the current "/OHLC/getPrevDaysOHLC.efs,..." to "getPrevDaysOHLC.efs,..."
Alex
Originally posted by Magda Alex,
Double checked the downloaded formula file and it is the correct one. It opens fine on its own in the "Editor" but I am now not sure how to get the error fixed as it still prevails.
Apologies for the late reply, but I had no time until today to review the formula again and to introduce your tips. Thanks a million for your 2nd tip = it now plots 100%!!
Many thanks again for your kindness.
Best regards,
Magda
Originally posted by Alexis C. Montenegro Magda
Are both formulas located in the OHLC folder in Formulas?
If not then you can do one of two things. Either move the getPrevDaysOHLC.efs to the OHLC folder or edit the calling script and change the path from the current "/OHLC/getPrevDaysOHLC.efs,..." to "getPrevDaysOHLC.efs,..."
Alex
Comment