- This topic has 1 reply, 2 voices, and was last updated 4 weeks ago by .
- You must be logged in to reply to this topic.
I want to code a condition in which MACD is above 0 for six consecutive bars. Below is the script.
Its doesnt seem working.
V1=MACD(BAR2=34); V2=V1 CrossesAbove 0; TIMESINCESIGNAL(V2)==6
Thanks Deepak. Your formula is counting how many days since the MACD-H crossed above zero – not how may days it has been above zero. To see the difference put your formula (without the ==6 so the value will display) in a watchlist column.
This example shows correctly that it has been 50 days since the MACD crossed above zero for STE, but its not what you are looking for as the MACD is currently below zero:
Instead, change the logic to count the number of days since the MACD-H was last below zero:
V1=MACD(BAR2=34) < 0;
Out of the S&P500 stocks, only CME has had 6 days above zero (but change to >=6 for at least 6 days and there are 44 stocks):
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.