Pairs Cointegration code error

Hi Diego,

Great job getting the logic in place and starting to debug the strategy — you’re on the right track!

I’d recommend checking out this blog by QuantInsti:
https://blog.quantinsti.com/algorithmic-trading-chatgpt/

It explains how to use ChatGPT effectively for coding and debugging in algorithmic trading workflows. The approach is quite intuitive — you describe what you want in plain English, and ChatGPT helps generate or fix the code accordingly.

This is also known as the “vibe‑coding” approach — where we express our intentions in natural language and let ChatGPT translate them into quality code, refining it through conversation.

What’s crucial in this process is validating what the AI generates — by carefully checking variable usage, logic, and flow — while letting the LLM handle syntax and error correction.

Let’s apply this:

  • Prompt ChatGPT to correct the zscore, indexing, and PnL errors
  • Have it produce clean, working implementations of the cointegration strategy (KO vs PEP)
  • Iterate via chat to fine‑tune, test, and integrate plots and files

I’m confident this will streamline your debugging process and make the workflow more efficient and intuitive.

Let me know your thoughts!

Best,
Ajay