<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Petra on Programming: The Correlation Cycle Indicator	</title>
	<atom:link href="https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/feed/" rel="self" type="application/rss+xml" />
	<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/</link>
	<description>A new view on algorithmic trading</description>
	<lastBuildDate>Fri, 24 Nov 2023 15:00:54 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Tom Pham		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-97086</link>

		<dc:creator><![CDATA[Tom Pham]]></dc:creator>
		<pubDate>Fri, 24 Nov 2023 15:00:54 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-97086</guid>

					<description><![CDATA[Thank you.  I will look into that.]]></description>
			<content:encoded><![CDATA[<p>Thank you.  I will look into that.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Petra Volkova		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-97084</link>

		<dc:creator><![CDATA[Petra Volkova]]></dc:creator>
		<pubDate>Fri, 24 Nov 2023 14:32:08 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-97084</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-97079&quot;&gt;Tom Pham&lt;/a&gt;.

I am no Python expert, but the begin - the Real and Imag calculation - does not look right to me. Also Python might have some subtle differences that affect the result.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-97079">Tom Pham</a>.</p>
<p>I am no Python expert, but the begin &#8211; the Real and Imag calculation &#8211; does not look right to me. Also Python might have some subtle differences that affect the result.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Tom Pham		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-97079</link>

		<dc:creator><![CDATA[Tom Pham]]></dc:creator>
		<pubDate>Fri, 24 Nov 2023 06:09:27 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-97079</guid>

					<description><![CDATA[Thanks.  I used ChatGPT to do the conversion of your code to Python but somehow the correlation angles and market states results do not come out right.  In case if you are familiar with Python, below is the Python&#039;s version of your CCYState().  The variable &#039;previous_angle&#039; is initialized to 0 on the outer loop where each bar is step through.  At the end of each bar cycle,  &#039;previous_angle&#039; is updated to have the &#039;current_angle&#039; value.   Do you see anything in the code that might not be correct or have a suggestion on how to convert your code to Python?  Thank you.  

def CCYState(Data, Length, Threshold, previous_angle):
    Real = correl(Data, Length, cosFunc)               
    Imag = correl(Data, Length, sinFunc)                
    
 # Compute the angle as an arctangent function and resolve 
 ambiguity
    if Imag == 0:
        current_angle = 0
    else:
        current_angle = 90 + math.degrees(np.arctan(Real/Imag))             
    if Imag &#062; 0:
        current_angle -= 180

    # Do not allow the rate change of angle to go negative
    if previous_angle - current_angle &#060; 270 and current_angle &#060; 
    previous_angle:
        current_angle = previous_angle
        
    # Compute market state
    if abs(current_angle - previous_angle) &#060; Threshold:
        if current_angle = 0:
            state = 1
    else:
        state = 0
    
    return state, current_angle]]></description>
			<content:encoded><![CDATA[<p>Thanks.  I used ChatGPT to do the conversion of your code to Python but somehow the correlation angles and market states results do not come out right.  In case if you are familiar with Python, below is the Python&#8217;s version of your CCYState().  The variable &#8216;previous_angle&#8217; is initialized to 0 on the outer loop where each bar is step through.  At the end of each bar cycle,  &#8216;previous_angle&#8217; is updated to have the &#8216;current_angle&#8217; value.   Do you see anything in the code that might not be correct or have a suggestion on how to convert your code to Python?  Thank you.  </p>
<p>def CCYState(Data, Length, Threshold, previous_angle):<br />
    Real = correl(Data, Length, cosFunc)<br />
    Imag = correl(Data, Length, sinFunc)                </p>
<p> # Compute the angle as an arctangent function and resolve<br />
 ambiguity<br />
    if Imag == 0:<br />
        current_angle = 0<br />
    else:<br />
        current_angle = 90 + math.degrees(np.arctan(Real/Imag))<br />
    if Imag &gt; 0:<br />
        current_angle -= 180</p>
<p>    # Do not allow the rate change of angle to go negative<br />
    if previous_angle &#8211; current_angle &lt; 270 and current_angle &lt;<br />
    previous_angle:<br />
        current_angle = previous_angle</p>
<p>    # Compute market state<br />
    if abs(current_angle &#8211; previous_angle) &lt; Threshold:<br />
        if current_angle = 0:<br />
            state = 1<br />
    else:<br />
        state = 0</p>
<p>    return state, current_angle</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Petra Volkova		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-97026</link>

		<dc:creator><![CDATA[Petra Volkova]]></dc:creator>
		<pubDate>Mon, 20 Nov 2023 08:07:12 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-97026</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-97011&quot;&gt;Tom Pham&lt;/a&gt;.

C.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-97011">Tom Pham</a>.</p>
<p>C.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Tom Pham		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-97011</link>

		<dc:creator><![CDATA[Tom Pham]]></dc:creator>
		<pubDate>Sun, 19 Nov 2023 17:28:24 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-97011</guid>

					<description><![CDATA[What programming language is for your code above.  Is it in Pine Script?  Thanks.]]></description>
			<content:encoded><![CDATA[<p>What programming language is for your code above.  Is it in Pine Script?  Thanks.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Petra Volkova		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-90622</link>

		<dc:creator><![CDATA[Petra Volkova]]></dc:creator>
		<pubDate>Thu, 06 Apr 2023 14:12:50 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-90622</guid>

					<description><![CDATA[No, because it&#039;s a walk forward optimization. Lengths and periods change all the time.]]></description>
			<content:encoded><![CDATA[<p>No, because it&#8217;s a walk forward optimization. Lengths and periods change all the time.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Alberto		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-90604</link>

		<dc:creator><![CDATA[Alberto]]></dc:creator>
		<pubDate>Tue, 04 Apr 2023 23:35:19 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-90604</guid>

					<description><![CDATA[Hi, Can I have the definitive Period and Threshold/Length Optimized In your test? Thank you]]></description>
			<content:encoded><![CDATA[<p>Hi, Can I have the definitive Period and Threshold/Length Optimized In your test? Thank you</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Arnis Lapsa		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-73343</link>

		<dc:creator><![CDATA[Arnis Lapsa]]></dc:creator>
		<pubDate>Sat, 07 Aug 2021 01:19:51 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-73343</guid>

					<description><![CDATA[Why did I found this blog?!! Can&#039;t stop reading... I should be sleeping... argh...]]></description>
			<content:encoded><![CDATA[<p>Why did I found this blog?!! Can&#8217;t stop reading&#8230; I should be sleeping&#8230; argh&#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Petra Volkova		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-71489</link>

		<dc:creator><![CDATA[Petra Volkova]]></dc:creator>
		<pubDate>Mon, 07 Jun 2021 10:13:19 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-71489</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-71470&quot;&gt;James&lt;/a&gt;.

I have just converted his code without giving it much consideration. But you are right, from math in school I remember that a phase angle is atan(sin/cos), not atan(cos/sin) as in the code. But swapping sin and cos is a 90 degrees rotation and I think that&#039;s why Ehlers adds 90 to the result.  The end result is anyway based on angle difference, not on absolute angle. Maybe Ehlers can explain why he has calculated it in this way.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-71470">James</a>.</p>
<p>I have just converted his code without giving it much consideration. But you are right, from math in school I remember that a phase angle is atan(sin/cos), not atan(cos/sin) as in the code. But swapping sin and cos is a 90 degrees rotation and I think that&#8217;s why Ehlers adds 90 to the result.  The end result is anyway based on angle difference, not on absolute angle. Maybe Ehlers can explain why he has calculated it in this way.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: James		</title>
		<link>https://financial-hacker.com/petra-on-programming-the-correlation-cycle-indicator/#comment-71470</link>

		<dc:creator><![CDATA[James]]></dc:creator>
		<pubDate>Sun, 06 Jun 2021 11:49:18 +0000</pubDate>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3447#comment-71470</guid>

					<description><![CDATA[Hi

In both your code above and the Ehlers paper the arctangent is described in terms of a the ratio of real to imaginary. Isn&#039;t this, in fact, the reciprocal of the arctangent? If we think of the phasor diagram with the Imaginary axis being the &#039;y-axis&#039; and the real axis being the &#039;x-axis&#039;, then tan of the phase angle would be y/x.
In addition, this definition is at odds with Ehler&#039;s own &#039;rocket science of traders&#039; book where he uses the same process to derive the phase angle via the Hilbert Transform.]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>In both your code above and the Ehlers paper the arctangent is described in terms of a the ratio of real to imaginary. Isn&#8217;t this, in fact, the reciprocal of the arctangent? If we think of the phasor diagram with the Imaginary axis being the &#8216;y-axis&#8217; and the real axis being the &#8216;x-axis&#8217;, then tan of the phase angle would be y/x.<br />
In addition, this definition is at odds with Ehler&#8217;s own &#8216;rocket science of traders&#8217; book where he uses the same process to derive the phase angle via the Hilbert Transform.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
