- This topic has 1 reply, 2 voices, and was last updated 4 months ago by .
- You must be logged in to reply to this topic.
is it possible to plot first 15 days average till Jun and first 15days of July for rest of the year on chart.
below is the formula i am looking for
value = (1stday open(first bar open in year) + last day close(last bar close in 15days) + high in 15 days + low in 15 days) /4
I believe you can achieve what you are after with the following script:
V1 = MONTHNUM() ;
//Find Change from December to Jan
V2 = V1 == 1 and V1 == 12;
//Find 15 Bars into Jan
V3 = TIMESINCESIGNAL(V2) == 15;
//Find Change from June to July
V4 = V1 == 7 and V1 == 6;
//Find 15 Bars into July
V5 = TIMESINCESIGNAL(V4) == 15;
//Set 15 Day Moving Average
V6 = MA(BARS=15, CALC=OHLC) ;
//Set Switch between the two Date Zones
V7 = SWITCH(V3,V5);
//Find 15SMA Value for each zome
RES1 = VALUEWHEN(V6,V3);
RES2 = VALUEWHEN(V6,V5);
//Show MA Value based on which Date Zone we are in
IF(V7 == 1,RES1,RES2)
Here is how it looks on a chart:
The plot shows the average of the first 15 days of Jan and July each year.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
|cookielawinfo-checbox-analytics||11 months||This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".|
|cookielawinfo-checbox-functional||11 months||The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".|
|cookielawinfo-checbox-others||11 months||This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.|
|cookielawinfo-checkbox-necessary||11 months||This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".|
|cookielawinfo-checkbox-performance||11 months||This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".|
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.