<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abraham on Medium]]></title>
        <description><![CDATA[Stories by Abraham on Medium]]></description>
        <link>https://medium.com/@stalinabraham?source=rss-819a7774c34e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Abraham on Medium</title>
            <link>https://medium.com/@stalinabraham?source=rss-819a7774c34e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 14:07:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stalinabraham/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Hooked Claude Up to the Stock Market (And Here is the Full Python Code)]]></title>
            <link>https://pub.aimind.so/i-hooked-claude-up-to-the-stock-market-and-here-is-the-full-python-code-03beb1be9f14?source=rss-819a7774c34e------2</link>
            <guid isPermaLink="false">https://medium.com/p/03beb1be9f14</guid>
            <category><![CDATA[options-trading]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[algorithmic-trading]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Abraham]]></dc:creator>
            <pubDate>Sat, 16 May 2026 18:10:49 GMT</pubDate>
            <atom:updated>2026-07-26T15:22:48.238Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Python Stock Trading Signal Bot Using Claude AI and Live Market Data</h3><p><em>I built a Forex signal bot using indicators like EMA, RSI, MACD, and Bollinger Bands, but I wanted to try something different: letting AI analyze the market instead of relying on fixed trading rules. So I connected Claude, Anthropic’s AI model, to live stock market data and let it decide whether to buy, sell, or stay neutral. This article is a practical walkthrough of what I built, how it works, what I learned, and the full Python code so you can test it yourself.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pKQJg0LaXiSVQEzcztUwYA.png" /></figure><h4>Why Use an AI Model Instead of Fixed Indicators</h4><p>Traditional algorithmic trading follows rigid rules like EMA crosses, RSI ranges, and MACD signals. They are fast and easy to backtest, but markets constantly change, and fixed conditions can fail quickly. AI models like Anthropic’s Claude analyze market context dynamically, weighing multiple signals together instead of relying on simple checklists. While slower and slightly more expensive than traditional bots, they are highly practical for five-minute or swing-trading strategies where adaptability matters more than microsecond speed.</p><h4>What the Bot Actually Does</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pwyc_xfoYo7XfoIV7Q1Q3w.png" /></figure><h4>Setting Up the Environment</h4><p>Before we get into the code, here is what you need installed.</p><pre>pip install anthropic yfinance pandas numpy requests pytz</pre><p>You will also need two API keys. The first is an Anthropic API key, which you can get from console.anthropic.com after creating an account. The second is a Telegram bot token and your Telegram chat ID, which you set up using BotFather on Telegram.</p><h4>The Full Python Code</h4><pre>import time<br>import anthropic<br>import yfinance as yf<br>import pandas as pd<br>import numpy as np<br>import requests<br>from datetime import datetime, timedelta<br>import pytz<br><br># =========================================================<br># CONFIGURATION<br># =========================================================<br><br>ANTHROPIC_API_KEY = &quot;your-anthropic-api-key-here&quot;<br>TELEGRAM_BOT_TOKEN = &quot;your-telegram-bot-token-here&quot;<br>TELEGRAM_CHAT_ID = &quot;your-telegram-chat-id-here&quot;<br><br>TICKER = &quot;AAPL&quot;<br>INTERVAL = &quot;5m&quot;<br>CHECK_EVERY_SECONDS = 300  # check once every 5 minutes<br><br>dubai_tz = pytz.timezone(&quot;Asia/Dubai&quot;)<br><br># =========================================================<br># TELEGRAM HELPER<br># =========================================================<br><br>def send_telegram(text: str):<br>    url = f&quot;https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage&quot;<br>    try:<br>        r = requests.post(url, json={&quot;chat_id&quot;: TELEGRAM_CHAT_ID, &quot;text&quot;: text}, timeout=10)<br>        if r.status_code != 200:<br>            print(&quot;Telegram error:&quot;, r.text)<br>    except Exception as e:<br>        print(&quot;Telegram send failed:&quot;, e)<br><br># =========================================================<br># DATA FETCHING<br># =========================================================<br><br>def fetch_data(ticker: str, interval: str) -&gt; pd.DataFrame:<br>    try:<br>        df = yf.download(ticker, period=&quot;2d&quot;, interval=interval,<br>                         auto_adjust=False, progress=False)<br>    except Exception as e:<br>        print(&quot;Data fetch error:&quot;, e)<br>        return pd.DataFrame()<br><br>    if df is None or df.empty:<br>        return pd.DataFrame()<br><br>    if isinstance(df.columns, pd.MultiIndex):<br>        df.columns = df.columns.get_level_values(0)<br><br>    df = df[[&quot;Open&quot;, &quot;High&quot;, &quot;Low&quot;, &quot;Close&quot;, &quot;Volume&quot;]].dropna()<br>    return df<br><br># =========================================================<br># INDICATOR CALCULATIONS<br># =========================================================<br><br>def compute_rsi(close: pd.Series, period: int = 14) -&gt; pd.Series:<br>    delta = close.diff()<br>    gain = delta.clip(lower=0)<br>    loss = -delta.clip(upper=0)<br>    avg_gain = gain.ewm(alpha=1 / period, adjust=False).mean()<br>    avg_loss = loss.ewm(alpha=1 / period, adjust=False).mean()<br>    rs = avg_gain / (avg_loss + 1e-10)<br>    return 100 - (100 / (1 + rs))<br><br>def compute_macd(close: pd.Series, fast=12, slow=26, signal=9):<br>    ema_fast = close.ewm(span=fast, adjust=False).mean()<br>    ema_slow = close.ewm(span=slow, adjust=False).mean()<br>    macd = ema_fast - ema_slow<br>    signal_line = macd.ewm(span=signal, adjust=False).mean()<br>    return macd - signal_line  # histogram only<br><br>def add_indicators(df: pd.DataFrame) -&gt; pd.DataFrame:<br>    if df.empty:<br>        return df<br>    df = df.copy()<br>    close = pd.to_numeric(df[&quot;Close&quot;], errors=&quot;coerce&quot;)<br>    df[&quot;ema9&quot;]     = close.ewm(span=9,  adjust=False).mean()<br>    df[&quot;ema21&quot;]    = close.ewm(span=21, adjust=False).mean()<br>    df[&quot;rsi&quot;]      = compute_rsi(close)<br>    df[&quot;macd_hist&quot;] = compute_macd(close)<br>    return df.dropna()<br><br># =========================================================<br># BUILDING THE PROMPT FOR CLAUDE<br># =========================================================<br><br>def build_prompt(df: pd.DataFrame, ticker: str) -&gt; str:<br>    latest = df.iloc[-1]<br>    prev   = df.iloc[-2]<br><br>    price       = float(latest[&quot;Close&quot;])<br>    ema9        = float(latest[&quot;ema9&quot;])<br>    ema21       = float(latest[&quot;ema21&quot;])<br>    rsi         = float(latest[&quot;rsi&quot;])<br>    macd_hist   = float(latest[&quot;macd_hist&quot;])<br>    volume      = float(latest[&quot;Volume&quot;])<br><br>    ema9_prev   = float(prev[&quot;ema9&quot;])<br>    ema21_prev  = float(prev[&quot;ema21&quot;])<br><br>    # Describe EMA trend<br>    if ema9 &gt; ema21 and ema9_prev &lt;= ema21_prev:<br>        ema_status = &quot;EMA9 has just crossed above EMA21 (fresh bullish crossover)&quot;<br>    elif ema9 &lt; ema21 and ema9_prev &gt;= ema21_prev:<br>        ema_status = &quot;EMA9 has just crossed below EMA21 (fresh bearish crossover)&quot;<br>    elif ema9 &gt; ema21:<br>        ema_status = &quot;EMA9 is above EMA21 (uptrend)&quot;<br>    else:<br>        ema_status = &quot;EMA9 is below EMA21 (downtrend)&quot;<br><br>    # Describe RSI<br>    if rsi &gt; 70:<br>        rsi_status = f&quot;RSI is {rsi:.1f}, which is overbought territory&quot;<br>    elif rsi &lt; 30:<br>        rsi_status = f&quot;RSI is {rsi:.1f}, which is oversold territory&quot;<br>    else:<br>        rsi_status = f&quot;RSI is {rsi:.1f}, which is in a neutral zone&quot;<br><br>    # Describe MACD histogram<br>    if macd_hist &gt; 0:<br>        macd_status = f&quot;MACD histogram is positive at {macd_hist:.4f}, suggesting bullish momentum&quot;<br>    else:<br>        macd_status = f&quot;MACD histogram is negative at {macd_hist:.4f}, suggesting bearish momentum&quot;<br><br>    prompt = f&quot;&quot;&quot;You are a professional stock market analyst. You are analyzing {ticker} on the 5-minute timeframe.<br><br>Here is the current market snapshot:<br><br>- Current price: {price:.2f}<br>- {ema_status}<br>- {rsi_status}<br>- {macd_status}<br>- Current volume on this candle: {volume:.0f}<br><br>Based on this information, your job is to return exactly one of the following three signals:<br><br>BUY - if the evidence clearly supports a long entry<br>SELL - if the evidence clearly supports a short or exit signal<br>HOLD - if the setup is unclear, mixed, or not yet confirmed<br><br>Respond in this exact format:<br>SIGNAL: [BUY / SELL / HOLD]<br>REASON: [One clear sentence explaining your decision]<br><br>Do not add any extra commentary. Do not hedge. Give a direct answer.&quot;&quot;&quot;<br><br>    return prompt<br><br># =========================================================<br># CALLING CLAUDE<br># =========================================================<br><br>def ask_claude(prompt: str) -&gt; tuple[str, str]:<br>    client = anthropic.Anthropic(api_key=ANTHROPIC_API_KEY)<br>    try:<br>        message = client.messages.create(<br>            model=&quot;claude-sonnet-4-20250514&quot;,<br>            max_tokens=150,<br>            messages=[{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: prompt}]<br>        )<br>        response_text = message.content[0].text.strip()<br><br>        signal = &quot;HOLD&quot;<br>        reason = &quot;No clear reason provided.&quot;<br><br>        for line in response_text.splitlines():<br>            if line.startswith(&quot;SIGNAL:&quot;):<br>                raw_signal = line.replace(&quot;SIGNAL:&quot;, &quot;&quot;).strip().upper()<br>                if &quot;BUY&quot; in raw_signal:<br>                    signal = &quot;BUY&quot;<br>                elif &quot;SELL&quot; in raw_signal:<br>                    signal = &quot;SELL&quot;<br>                else:<br>                    signal = &quot;HOLD&quot;<br>            elif line.startswith(&quot;REASON:&quot;):<br>                reason = line.replace(&quot;REASON:&quot;, &quot;&quot;).strip()<br><br>        return signal, reason<br><br>    except Exception as e:<br>        print(&quot;Claude API error:&quot;, e)<br>        return &quot;HOLD&quot;, &quot;API error, defaulting to HOLD.&quot;<br><br># =========================================================<br># SIGNAL FORMATTING<br># =========================================================<br><br>def format_signal_message(ticker: str, signal: str, reason: str,<br>                           price: float, now: datetime) -&gt; str:<br>    expiry = now + timedelta(minutes=15)<br>    return (<br>        f&quot;AI Signal for {ticker}\n\n&quot;<br>        f&quot;Decision: {signal}\n&quot;<br>        f&quot;Price: {price:.2f}\n&quot;<br>        f&quot;Time: {now.strftime(&#39;%Y-%m-%d %H:%M:%S&#39;)} Dubai time\n&quot;<br>        f&quot;Review at: {expiry.strftime(&#39;%H:%M:%S&#39;)} Dubai time\n\n&quot;<br>        f&quot;Claude&#39;s Reason: {reason}\n\n&quot;<br>        f&quot;This is for educational purposes only. Not financial advice.&quot;<br>    )<br><br># =========================================================<br># MAIN LOOP<br># =========================================================<br><br>last_candle_time = None<br><br>def check_signal():<br>    global last_candle_time<br><br>    now = datetime.now(dubai_tz)<br>    print(f&quot;\n[{now.strftime(&#39;%H:%M:%S&#39;)}] Checking {TICKER}...&quot;)<br><br>    # Fetch and prepare data<br>    df = fetch_data(TICKER, INTERVAL)<br>    if df.empty or len(df) &lt; 30:<br>        print(&quot;Not enough data.&quot;)<br>        return<br><br>    df = add_indicators(df)<br>    if df.empty or len(df) &lt; 3:<br>        print(&quot;Not enough data after indicators.&quot;)<br>        return<br><br>    # Avoid duplicate checks on the same candle<br>    current_candle_time = df.index[-1]<br>    if last_candle_time is not None and current_candle_time &lt;= last_candle_time:<br>        print(&quot;Same candle, skipping.&quot;)<br>        return<br>    last_candle_time = current_candle_time<br><br>    # Build prompt and ask Claude<br>    prompt = build_prompt(df, TICKER)<br>    print(&quot;Sending data to Claude...&quot;)<br>    signal, reason = ask_claude(prompt)<br>    print(f&quot;Claude says: {signal} — {reason}&quot;)<br><br>    # Only send Telegram alert for BUY or SELL<br>    if signal in (&quot;BUY&quot;, &quot;SELL&quot;):<br>        price = float(df.iloc[-1][&quot;Close&quot;])<br>        msg = format_signal_message(TICKER, signal, reason, price, now)<br>        send_telegram(msg)<br>        print(&quot;Alert sent to Telegram.&quot;)<br>    else:<br>        print(&quot;HOLD signal — no alert sent.&quot;)<br><br><br>def main():<br>    print(f&quot;Starting AI Stock Signal Bot for {TICKER}&quot;)<br>    send_telegram(f&quot;AI Stock Signal Bot started for {TICKER}. Monitoring 5-minute candles.&quot;)<br>    while True:<br>        try:<br>            check_signal()<br>        except Exception as e:<br>            print(&quot;Unexpected error:&quot;, e)<br>        time.sleep(CHECK_EVERY_SECONDS)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><h3>Running the Bot</h3><p>Once you have your API keys in place, install the dependencies and run the script:</p><pre>pip install anthropic yfinance pandas numpy requests pytz<br>python your_script_name.py</pre><p>The bot will send a startup message to Telegram confirming it is active. From there, it checks the market every five minutes and alerts you whenever Claude identifies a clear BUY or SELL setup. Leave it running during market hours and observe the signals over a few sessions before drawing any conclusions about its usefulness.</p><h4>Breaking Down the Key Decisions</h4><p><strong><em>Why five-minute candles?</em></strong></p><p>Five-minute candles give Claude enough price history to make a meaningful assessment without generating too many API calls. On a fast-moving stock like AAPL during regular market hours, five minutes is enough time for a real move to develop. You could adjust this to fifteen-minute or hourly candles simply by changing the INTERVAL variable and CHECK_EVERY_SECONDS accordingly.</p><p><strong><em>Why pass indicators to Claude instead of raw prices?</em></strong></p><p>I experimented with passing raw OHLCV data directly and asking Claude to analyze it. The results were less consistent. When you pre-calculate indicators and describe them in plain language, you are giving Claude context it can reason about clearly. It understands what “RSI is in overbought territory” means in the same way a human analyst would. Raw price numbers alone carry less meaning without that context.</p><p><strong><em>Why ask for a single word signal and a one-sentence reason?</em></strong></p><p>This is the most important part of the prompt design. If you ask Claude to “analyze this stock,” you will get a long, hedged, balanced response that is hard to parse programmatically. By constraining the format strictly — SIGNAL: followed by REASON: — you get machine-parseable output every time. The one-sentence reason also forces Claude to commit to its logic rather than giving you a list of both bullish and bearish points with no conclusion.</p><h3>What This Bot Cannot Do</h3><p>This is important. The bot does not execute trades. It generates signals and sends them to Telegram. Acting on those signals is entirely your decision. This is deliberate because automated execution adds a layer of risk that belongs in a separate, more carefully controlled system with proper risk management, position sizing, and kill switches.</p><p>The bot also does not have memory between checks. Each call to Claude is independent. It does not know what signal it gave five minutes ago, and it cannot build a multi-candle view of how a setup has been developing. Adding memory is possible by passing recent signal history into the prompt, but that increases complexity and API cost.</p><p>Finally, the bot does not backtest. It is a live signal generator. Before you trust any signal, you should understand the strategy it represents and have some confidence in how that strategy performs historically. The code structure here would need a separate backtesting module to validate historical performance.</p><p><em>This article is for educational purposes only and does not constitute financial advice. Always conduct your own research before making any trading decisions.</em></p><h4>A Message from AI Mind</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*5Wm7sOfTpe5DEbhg.gif" /></figure><p>Thanks for being a part of our community! Before you go:</p><ul><li>👏 Clap for the story and follow the author 👉</li><li>📰 View more content in the <a href="https://pub.aimind.so/">AI Mind Publication</a></li><li>🧠 Improve your <a href="https://www.aimind.so/prompt-generator?utm_source=pub&amp;utm_medium=message">AI prompts effortlessly and FREE</a></li><li><strong>🧰 Discover </strong><a href="https://www.aimind.so/?utm_source=pub&amp;utm_medium=message"><strong>Intuitive AI Tools</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03beb1be9f14" width="1" height="1" alt=""><hr><p><a href="https://pub.aimind.so/i-hooked-claude-up-to-the-stock-market-and-here-is-the-full-python-code-03beb1be9f14">I Hooked Claude Up to the Stock Market (And Here is the Full Python Code)</a> was originally published in <a href="https://pub.aimind.so/">AI Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an AI Interview Cheat And What It Means for Hiring]]></title>
            <link>https://pub.aimind.so/building-an-ai-interview-cheat-and-what-it-means-for-hiring-227e56ec88a1?source=rss-819a7774c34e------2</link>
            <guid isPermaLink="false">https://medium.com/p/227e56ec88a1</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[hiring]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Abraham]]></dc:creator>
            <pubDate>Mon, 01 Dec 2025 07:27:31 GMT</pubDate>
            <atom:updated>2025-12-02T15:29:53.934Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Disclaimer:</em></strong><em> This project is for learning and awareness only. The point of this article is to show how easy this kind of tool is to build so hiring teams can design better and fairer interviews. Do not use this to cheat in real interviews.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*R1wZM9VeIlpiKGppM3OJBQ.png" /></figure><p>For a long time I was curious about one thing: how hard would it be to build a quiet AI helper that sits on my screen during an online interview, watches what is happening, and feeds me answers in real time. I wanted something that did not look like a normal app. No big window. No obvious UI. Just a small floating panel that I could move around, that blends into the screen, and that I can control with a few keyboard shortcuts. At the same time, I wanted the tool to be smart. It should read what is on the screen from screenshots, listen to audio from the interviewer, send this to an AI model, and then give back clear explanations and complete code that I can copy into the editor. In this article I explain how I built that tool. I walk through the idea, the architecture, and the main logic code. Then I finish by talking about why this matters for hiring, and what companies can do to defend against tools like this.</p><h3>The Idea and Thought Process</h3><p>My starting point was simple: if people already use AI during interview prep, it is natural that some will try to use AI during the actual interview too. I wanted to see how far a single person with normal tools could push this idea.</p><p>The high level goal was a “silent AI wingman” that does three things well:</p><ol><li>It stays out of the way visually.</li><li>It makes it easy to capture context from the screen and microphone.</li><li>It turns that context into a clear, structured answer.</li></ol><p>That led me to a few design decisions. The app should be a desktop app, not a browser extension, so it can float above Zoom, Meet, or Teams. It should use a transparent overlay window that stays always on top. It should have global shortcuts to capture screenshots, process them, and show solutions.</p><p>On the AI side, I wanted the flexibility to call a cloud model like Gemini, or a local model running through Ollama. So I needed a clean helper that could talk to both backends and return structured JSON, not just free text.</p><p>Finally, I decided to keep the UI split into two main screens: a queue of screenshots, and a solutions view that shows the problem, the reasoning, and the code. That kept the mental model simple while still being powerful. In practice, this behaves like a perfect free alternative to cluely.com that runs fully on your machine.</p><h3><strong>Big picture: How the System Works</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SciwPwns1XkzGFL712XHrA.png" /><figcaption>Flow Chart of AI Interview Cheat System</figcaption></figure><p>I press a shortcut to show or move the overlay window. The window is small, frameless, transparent, and always on top, so it looks like a floating dark panel. When the interviewer shows a coding question or an error, I press another shortcut that hides the overlay for a moment, captures a full screen screenshot, saves it, and adds it to a queue. I can repeat this to build up context. When I am ready, I press another shortcut to “process” the screenshots. The app sends the images to the AI helper, which reads the problem from the screenshots, builds a clean problem statement, and then asks the model to generate a solution and full code. The solution appears in the overlay window: a short description, some thought steps, and a code block that I can read or copy. If my code later fails and I get a new error on the screen, I can capture more screenshots and ask the app to debug the solution using those extra images. There is also optional audio capture from the microphone. The app can send a short audio clip from the interview to the same AI helper, which then extracts the question text from speech. Under the hood, this is built with Electron and React. Electron handles the desktop window, global shortcuts, file system, and IPC. React handles the UI. A custom LLMHelper class wraps Gemini or Ollama and returns JSON.</p><h3><strong>Building the AI Interview Cheat</strong></h3><p>In this section I go through the main steps and show the key logic code.</p><h4>Building the Transparent Overlay Window</h4><p>The first piece is the overlay itself. I created a helper that sets up a frameless, transparent, always-on-top window with its own preload script.</p><pre>import { BrowserWindow, screen } from &quot;electron&quot;<br>import path from &quot;node:path&quot;<br><br>const isDev = process.env.NODE_ENV === &quot;development&quot;<br><br>const startUrl = isDev<br>  ? &quot;http://localhost:5180&quot;<br>  : `file://${path.join(__dirname, &quot;../dist/index.html&quot;)}`<br><br>export class WindowHelper {<br>  private mainWindow: BrowserWindow | null = null<br>  private isWindowVisible = false<br>  private screenWidth = 0<br>  private screenHeight = 0<br><br>  public createMainWindow() {<br>    if (this.mainWindow) return<br><br>    const primaryDisplay = screen.getPrimaryDisplay()<br>    const workArea = primaryDisplay.workAreaSize<br>    this.screenWidth = workArea.width<br>    this.screenHeight = workArea.height<br><br>    const windowSettings: Electron.BrowserWindowConstructorOptions = {<br>      width: 400,<br>      height: 600,<br>      minWidth: 300,<br>      minHeight: 200,<br>      webPreferences: {<br>        preload: path.join(__dirname, &quot;preload.js&quot;),<br>        contextIsolation: true<br>      },<br>      show: false,<br>      alwaysOnTop: true,<br>      frame: false,<br>      transparent: true,<br>      fullscreenable: false,<br>      hasShadow: false,<br>      backgroundColor: &quot;#00000000&quot;,<br>      focusable: true,<br>      resizable: true,<br>      movable: true,<br>      x: 100,<br>      y: 100<br>    }<br><br>    this.mainWindow = new BrowserWindow(windowSettings)<br>    this.mainWindow.setContentProtection(true)<br>    this.mainWindow.loadURL(startUrl)<br><br>    this.mainWindow.once(&quot;ready-to-show&quot;, () =&gt; {<br>      this.mainWindow?.show()<br>      this.isWindowVisible = true<br>    })<br>  }<br><br>  public toggleVisibility() {<br>    if (!this.mainWindow) return<br>    this.isWindowVisible = !this.isWindowVisible<br>    this.isWindowVisible ? this.mainWindow.show() : this.mainWindow.hide()<br>  }<br><br>  public centerAndShow() {<br>    if (!this.mainWindow) return<br>    this.mainWindow.center()<br>    this.mainWindow.show()<br>    this.isWindowVisible = true<br>  }<br><br>  public getMainWindow() {<br>    return this.mainWindow<br>  }<br>}</pre><p>This is what gives the app its “invisible” feel. It is just a thin overlay that you can drag around without drawing much attention.</p><h4>Registering Global Shortcuts</h4><p>Next, I wired up global shortcuts so I can control the app from anywhere.</p><pre>import { globalShortcut, app } from &quot;electron&quot;<br>import { AppState } from &quot;./main&quot;<br><br>export class ShortcutsHelper {<br>  constructor(private appState: AppState) {}<br><br>  public registerGlobalShortcuts() {<br>    globalShortcut.register(&quot;CommandOrControl+Shift+Space&quot;, () =&gt; {<br>      this.appState.centerAndShowWindow()<br>    })<br><br>    globalShortcut.register(&quot;CommandOrControl+Shift+S&quot;, async () =&gt; {<br>      await this.appState.getScreenshotHelper().takeScreenshot(<br>        () =&gt; this.appState.hideWindow(),<br>        () =&gt; this.appState.showWindow()<br>      )<br>    })<br><br>    globalShortcut.register(&quot;CommandOrControl+Shift+Enter&quot;, async () =&gt; {<br>      await this.appState.processingHelper.processScreenshots()<br>    })<br><br>    globalShortcut.register(&quot;CommandOrControl+Shift+C&quot;, () =&gt; {<br>      this.appState.getScreenshotHelper().clearAll()<br>      this.appState.setView(&quot;queue&quot;)<br>      this.appState.getMainWindow()?.webContents.send(&quot;reset-view&quot;)<br>    })<br><br>    globalShortcut.register(&quot;CommandOrControl+Left&quot;, () =&gt; {<br>      this.appState.moveWindowLeft()<br>    })<br>    globalShortcut.register(&quot;CommandOrControl+Right&quot;, () =&gt; {<br>      this.appState.moveWindowRight()<br>    })<br>    globalShortcut.register(&quot;CommandOrControl+Up&quot;, () =&gt; {<br>      this.appState.moveWindowUp()<br>    })<br>    globalShortcut.register(&quot;CommandOrControl+Down&quot;, () =&gt; {<br>      this.appState.moveWindowDown()<br>    })<br><br>    app.on(&quot;will-quit&quot;, () =&gt; {<br>      globalShortcut.unregisterAll()<br>    })<br>  }<br>}</pre><p>With these hotkeys I can show the overlay, capture screenshots, run the AI, clear everything, and reposition the window without touching the mouse.</p><h4>Capturing and Managing Screenshots</h4><p>Screenshots are the main way the app “sees” the interview. I wrote a helper to capture full screen images, store them, and maintain small queues for initial context and debug context.</p><pre>import path from &quot;node:path&quot;<br>import fs from &quot;node:fs&quot;<br>import { app } from &quot;electron&quot;<br>import { v4 as uuidv4 } from &quot;uuid&quot;<br>import screenshot from &quot;screenshot-desktop&quot;<br><br>export class ScreenshotHelper {<br>  private screenshotQueue: string[] = []<br>  private extraScreenshotQueue: string[] = []<br>  private readonly MAX_SCREENSHOTS = 5<br><br>  private readonly screenshotDir: string<br>  private readonly extraScreenshotDir: string<br><br>  private view: &quot;queue&quot; | &quot;solutions&quot; = &quot;queue&quot;<br><br>  constructor(view: &quot;queue&quot; | &quot;solutions&quot; = &quot;queue&quot;) {<br>    this.view = view<br>    this.screenshotDir = path.join(app.getPath(&quot;userData&quot;), &quot;screenshots&quot;)<br>    this.extraScreenshotDir = path.join(app.getPath(&quot;userData&quot;), &quot;debug-screenshots&quot;)<br><br>    if (!fs.existsSync(this.screenshotDir)) fs.mkdirSync(this.screenshotDir, { recursive: true })<br>    if (!fs.existsSync(this.extraScreenshotDir)) fs.mkdirSync(this.extraScreenshotDir, { recursive: true })<br>  }<br><br>  public setView(view: &quot;queue&quot; | &quot;solutions&quot;) {<br>    this.view = view<br>  }<br><br>  public getScreenshotQueue() {<br>    return this.screenshotQueue<br>  }<br><br>  public getExtraScreenshotQueue() {<br>    return this.extraScreenshotQueue<br>  }<br><br>  public clearAll() {<br>    this.screenshotQueue = []<br>    this.extraScreenshotQueue = []<br>  }<br><br>  public async takeScreenshot(<br>    hideMainWindow: () =&gt; void,<br>    showMainWindow: () =&gt; void<br>  ): Promise&lt;string&gt; {<br>    try {<br>      hideMainWindow()<br>      await new Promise((r) =&gt; setTimeout(r, 120))<br><br>      const targetDir = this.view === &quot;queue&quot; ? this.screenshotDir : this.extraScreenshotDir<br>      const filePath = path.join(targetDir, `${uuidv4()}.png`)<br><br>      await screenshot({ filename: filePath })<br><br>      const queue = this.view === &quot;queue&quot; ? this.screenshotQueue : this.extraScreenshotQueue<br>      queue.push(filePath)<br><br>      if (queue.length &gt; this.MAX_SCREENSHOTS) {<br>        const removed = queue.shift()<br>        if (removed) fs.promises.unlink(removed).catch(console.error)<br>      }<br><br>      return filePath<br>    } finally {<br>      showMainWindow()<br>    }<br>  }<br>}</pre><p>This keeps a rolling window of images that show the question, the editor, and any errors.</p><h4>Audio Capture in the UI</h4><p>For audio, I kept things simple and used the MediaRecorder API in the React front end. The code records audio, converts the blob to base64, and sends it through a preload bridge to the main process.</p><pre>const [audioRecording, setAudioRecording] = useState(false)<br>const [audioResult, setAudioResult] = useState&lt;AudioResult | null&gt;(null)<br>const mediaRecorderRef = useRef&lt;MediaRecorder | null&gt;(null)<br><br>const startAudioRecording = async () =&gt; {<br>  const stream = await navigator.mediaDevices.getUserMedia({ audio: true })<br>  const mediaRecorder = new MediaRecorder(stream)<br>  mediaRecorderRef.current = mediaRecorder<br>  const chunks: BlobPart[] = []<br><br>  mediaRecorder.ondataavailable = (event) =&gt; {<br>    if (event.data.size &gt; 0) chunks.push(event.data)<br>  }<br><br>  mediaRecorder.onstop = () =&gt; {<br>    const blob = new Blob(chunks, { type: &quot;audio/webm&quot; })<br>    const reader = new FileReader()<br>    reader.onloadend = async () =&gt; {<br>      const base64Data = (reader.result as string).split(&quot;,&quot;)[1]<br>      const result = await window.electronAPI.analyzeAudioFromBase64(base64Data, &quot;audio/webm&quot;)<br>      setAudioResult(result)<br>    }<br>    reader.readAsDataURL(blob)<br>  }<br><br>  mediaRecorder.start()<br>  setAudioRecording(true)<br>}<br><br>const stopAudioRecording = () =&gt; {<br>  mediaRecorderRef.current?.stop()<br>  setAudioRecording(false)<br>}</pre><p>The important part is that the audio is treated as just another input channel that the LLM can use to understand the question.</p><h4>The AI Brain: LLM Helper</h4><p>The LLMHelper hides the complexity of talking to Gemini or Ollama. It defines a system prompt, converts files to inline data, and exposes high level methods.</p><pre>import { GoogleGenerativeAI, GenerativeModel } from &quot;@google/generative-ai&quot;<br>import fs from &quot;fs&quot;<br><br>interface OllamaResponse {<br>  response: string<br>  done: boolean<br>}<br><br>export class LLMHelper {<br>  private model: GenerativeModel | null = null<br>  private useOllama = false<br>  private ollamaModel = &quot;llama3.2&quot;<br>  private ollamaUrl = &quot;http://localhost:11434&quot;<br><br>  private readonly systemPrompt = `<br>You are a private AI assistant that quietly helps a candidate answer interview questions.<br>You see screenshots, code, and sometimes audio transcripts.<br>Your job is to:<br>1. Understand the question or error.<br>2. Summarize the problem clearly.<br>3. Propose step-by-step reasoning.<br>4. Suggest a final answer or code solution.<br>5. Include time and space complexity when code is involved.<br>Output must always be structured JSON when requested.<br>`<br><br>  constructor(apiKey?: string, useOllama = false, ollamaModel?: string, ollamaUrl?: string) {<br>    this.useOllama = useOllama<br>    if (ollamaModel) this.ollamaModel = ollamaModel<br>    if (ollamaUrl) this.ollamaUrl = ollamaUrl<br><br>    if (!useOllama &amp;&amp; apiKey) {<br>      const client = new GoogleGenerativeAI(apiKey)<br>      this.model = client.getGenerativeModel({ model: &quot;gemini-1.5-pro&quot; })<br>    }<br>  }<br><br>  private async fileToGenerativePart(filePath: string) {<br>    const data = await fs.promises.readFile(filePath)<br>    return {<br>      inlineData: {<br>        data: data.toString(&quot;base64&quot;),<br>        mimeType: &quot;image/png&quot;<br>      }<br>    }<br>  }<br><br>  private async callOllama(prompt: string): Promise&lt;string&gt; {<br>    const response = await fetch(`${this.ollamaUrl}/api/generate`, {<br>      method: &quot;POST&quot;,<br>      headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>      body: JSON.stringify({<br>        model: this.ollamaModel,<br>        prompt,<br>        stream: false,<br>        options: { temperature: 0.7, top_p: 0.9 }<br>      })<br>    })<br><br>    if (!response.ok) {<br>      throw new Error(`Ollama API error: ${response.status} ${response.statusText}`)<br>    }<br><br>    const data: OllamaResponse = await response.json()<br>    return data.response<br>  }<br><br>  private cleanJsonResponse(text: string) {<br>    const start = text.indexOf(&quot;{&quot;)<br>    const end = text.lastIndexOf(&quot;}&quot;)<br>    return text.slice(start, end + 1)<br>  }<br><br>  public async extractProblemFromImages(imagePaths: string[]) {<br>    const imageParts = await Promise.all(imagePaths.map((p) =&gt; this.fileToGenerativePart(p)))<br><br>    const prompt = `<br>${this.systemPrompt}<br>Given ONLY these screenshots, extract the problem the candidate is being asked to solve.<br>Return JSON with fields like &quot;problem_statement&quot;, &quot;input_format&quot;, &quot;output_format&quot;,<br>&quot;complexity&quot;, &quot;test_cases&quot;, &quot;validation_type&quot;, and &quot;difficulty&quot;.<br>Return ONLY JSON.<br>`<br><br>    if (this.useOllama) {<br>      const res = await this.callOllama(prompt)<br>      return JSON.parse(this.cleanJsonResponse(res))<br>    }<br><br>    if (!this.model) throw new Error(&quot;No LLM configured&quot;)<br>    const result = await this.model.generateContent([prompt, ...imageParts])<br>    const text = result.response.text()<br>    return JSON.parse(this.cleanJsonResponse(text))<br>  }<br><br>  public async generateSolution(problemInfo: any) {<br>    const prompt = `<br>${this.systemPrompt}<br>Here is the problem extracted from screenshots:<br>${JSON.stringify(problemInfo, null, 2)}<br><br>Return JSON:<br>{<br>  &quot;initial_thoughts&quot;: [],<br>  &quot;thought_steps&quot;: [],<br>  &quot;description&quot;: &quot;&quot;,<br>  &quot;code&quot;: &quot;&quot;<br>}<br>Where &quot;code&quot; is a complete, working solution.<br>Return ONLY JSON.<br>`<br><br>    if (this.useOllama) {<br>      const res = await this.callOllama(prompt)<br>      return JSON.parse(this.cleanJsonResponse(res))<br>    }<br><br>    if (!this.model) throw new Error(&quot;No LLM configured&quot;)<br>    const result = await this.model.generateContent(prompt)<br>    const text = result.response.text()<br>    return JSON.parse(this.cleanJsonResponse(text))<br>  }<br><br>  public async debugSolutionWithImages(problemInfo: any, currentCode: string, debugImagePaths: string[]) {<br>    const imageParts = await Promise.all(debugImagePaths.map((p) =&gt; this.fileToGenerativePart(p)))<br><br>    const prompt = `<br>${this.systemPrompt}<br>The candidate already tried this solution:<br>${currentCode}<br><br>Problem context:<br>${JSON.stringify(problemInfo, null, 2)}<br><br>Use the new screenshots to debug and improve the solution.<br>Return the same JSON structure as generateSolution.<br>`<br><br>    if (this.useOllama) {<br>      const res = await this.callOllama(prompt)<br>      return JSON.parse(this.cleanJsonResponse(res))<br>    }<br><br>    if (!this.model) throw new Error(&quot;No LLM configured&quot;)<br>    const result = await this.model.generateContent([prompt, ...imageParts])<br>    const text = result.response.text()<br>    return JSON.parse(this.cleanJsonResponse(text))<br>  }<br><br>  public async analyzeAudioFromBase64(data: string, mimeType: string) {<br>    if (!this.model) throw new Error(&quot;Audio analysis requires Gemini&quot;)<br><br>    const part = { inlineData: { data, mimeType } }<br><br>    const prompt = `<br>${this.systemPrompt}<br>Listen to this audio snippet from an interview.<br>Summarize the question as &quot;text&quot;.<br>Return JSON: { &quot;text&quot;: &quot;&quot;, &quot;timestamp&quot;: 0 }.<br>`<br><br>    const result = await this.model.generateContent([prompt, part])<br>    const text = result.response.text()<br>    return JSON.parse(this.cleanJsonResponse(text))<br>  }<br>}</pre><h4>Orchestrating Everything with ProcessingHelper</h4><p>To connect screenshots and solutions, I created a ProcessingHelper that decides what to do based on the current view: initial solution or debug.</p><pre>import { AppState } from &quot;./main&quot;<br>import { LLMHelper } from &quot;./LLMHelper&quot;<br><br>export class ProcessingHelper {<br>  constructor(private appState: AppState, private llmHelper: LLMHelper) {}<br><br>  public async processScreenshots(): Promise&lt;void&gt; {<br>    const mainWindow = this.appState.getMainWindow()<br>    if (!mainWindow) return<br><br>    const view = this.appState.getView()<br><br>    if (view === &quot;queue&quot;) {<br>      const screenshotHelper = this.appState.getScreenshotHelper()<br>      const screenshotQueue = screenshotHelper.getScreenshotQueue()<br><br>      if (screenshotQueue.length === 0) {<br>        mainWindow.webContents.send(this.appState.PROCESSING_EVENTS.NO_SCREENSHOTS)<br>        return<br>      }<br><br>      mainWindow.webContents.send(this.appState.PROCESSING_EVENTS.INITIAL_START)<br>      this.appState.setView(&quot;solutions&quot;)<br><br>      try {<br>        const problemInfo = await this.llmHelper.extractProblemFromImages(screenshotQueue)<br>        this.appState.setProblemInfo(problemInfo)<br>        mainWindow.webContents.send(<br>          this.appState.PROCESSING_EVENTS.PROBLEM_EXTRACTED,<br>          problemInfo<br>        )<br><br>        const solution = await this.llmHelper.generateSolution(problemInfo)<br>        this.appState.setSolutionInfo(solution)<br>        mainWindow.webContents.send(<br>          this.appState.PROCESSING_EVENTS.SOLUTION_SUCCESS,<br>          solution<br>        )<br>      } catch (error: any) {<br>        mainWindow.webContents.send(<br>          this.appState.PROCESSING_EVENTS.INITIAL_SOLUTION_ERROR,<br>          error.message<br>        )<br>      }<br>    }<br><br>    if (view === &quot;solutions&quot;) {<br>      const screenshotHelper = this.appState.getScreenshotHelper()<br>      const extraScreenshotQueue = screenshotHelper.getExtraScreenshotQueue()<br>      const problemInfo = this.appState.getProblemInfo()<br>      const currentSolution = this.appState.getSolutionInfo()<br><br>      if (!problemInfo || !currentSolution || extraScreenshotQueue.length === 0) return<br><br>      mainWindow.webContents.send(this.appState.PROCESSING_EVENTS.DEBUG_START)<br><br>      try {<br>        const debugResult = await this.llmHelper.debugSolutionWithImages(<br>          problemInfo,<br>          currentSolution.code,<br>          extraScreenshotQueue<br>        )<br><br>        this.appState.setSolutionInfo(debugResult)<br>        this.appState.setHasDebugged(true)<br><br>        mainWindow.webContents.send(<br>          this.appState.PROCESSING_EVENTS.DEBUG_SUCCESS,<br>          debugResult<br>        )<br><br>        screenshotHelper.clearAll()<br>      } catch (error: any) {<br>        mainWindow.webContents.send(<br>          this.appState.PROCESSING_EVENTS.DEBUG_ERROR,<br>          error.message<br>        )<br>      }<br>    }<br>  }<br><br>  public async processAudioBase64(data: string, mimeType: string) {<br>    return this.llmHelper.analyzeAudioFromBase64(data, mimeType)<br>  }<br>}</pre><h4>IPC and React UI</h4><p>The IPC layer is a thin bridge that lets React call Electron methods safely.</p><pre>import { contextBridge, ipcRenderer } from &quot;electron&quot;<br><br>contextBridge.exposeInMainWorld(&quot;electronAPI&quot;, {<br>  getScreenshots: () =&gt; ipcRenderer.invoke(&quot;get-screenshots&quot;),<br>  deleteScreenshot: (path: string) =&gt; ipcRenderer.invoke(&quot;delete-screenshot&quot;, path),<br>  processScreenshots: () =&gt; ipcRenderer.invoke(&quot;process-screenshots&quot;),<br>  analyzeAudioFromBase64: (data: string, mimeType: string) =&gt;<br>    ipcRenderer.invoke(&quot;analyze-audio-base64&quot;, data, mimeType),<br>  onProcessingEvent: (callback: (type: string, payload?: any) =&gt; void) =&gt; {<br>    const handler = (_: any, message: { type: string; payload?: any }) =&gt; {<br>      callback(message.type, message.payload)<br>    }<br>    ipcRenderer.on(&quot;processing-event&quot;, handler)<br>    return () =&gt; ipcRenderer.removeListener(&quot;processing-event&quot;, handler)<br>  }<br>}</pre><p>On the React side, I keep the UI lightweight: a queue page to show captured screenshots, and a solutions page that listens for processing events and displays the problem and code in small cards.</p><h3>Why this is a Serious Interview Problem</h3><p>When all parts are connected, the app can quietly do a lot of work for the candidate. It can see the exact problem statement, error messages, and test cases on the screen. It can listen to what the interviewer is saying. It can then produce a cleaned up problem statement, step by step reasoning, and a complete solution, and even help debug errors using more screenshots.</p><p>From the interviewer side, it might look like the candidate is just thinking slowly and typing carefully. But in reality, a lot of the thinking is offloaded to the AI. This makes a standard remote coding interview much less trustworthy if you assume people are not using tools like this.</p><p>This is also why I mentioned earlier that it feels like a perfect free alternative to cluely.com. It gives similar “AI on top of your call” behavior, but as a local app with your own keys and models. That should worry anyone who runs interviews the old way.</p><h3>How hiring teams can protect their process</h3><p>The goal of this project is not to push cheating. It is to show that the barrier is low, so hiring teams must adapt. Here are some practical changes, written simply and focused on awareness.</p><p><strong>First</strong>, change what you measure. If your interview is only “solve this coding problem from scratch in 30 minutes”, a hidden AI copilot can do most of the heavy work. Instead, put more weight on how people think and explain. Ask them to talk through their approach, and follow up with “why this and not that” questions. Ask how they would change the solution for different constraints like more data, less memory, or stricter latency.</p><p><strong>Second</strong>, make the format more interactive. Use pair programming and design discussions, not just static questions. Ask the candidate to modify their solution live, add new requirements, or handle a special case. If the conversation keeps moving and the problem keeps changing, it is harder to rely on a single AI generated answer.</p><p><strong>Third</strong>, use context that is not visible in a single screenshot. For example, base some questions on details that were explained earlier in the call, or on diagrams you shared verbally. Ask about trade offs in your own systems, not just generic algorithm puzzles. The more the interview depends on shared context and domain thinking, the less a generic AI can fully carry the candidate.</p><p><strong>Fourth</strong>, handle take home tasks with honesty in mind. Make your AI policy clear. For example, you can allow some AI help but require a short write up on how it was used and why. Then in a follow up round, ask for deeper explanations of the submitted work. Someone who copied a solution without understanding it will have a hard time explaining details and design choices.</p><p><strong>Fifth</strong>, use light environment checks when it makes sense. You do not need to spy on anyone, but you can ask for full screen sharing instead of a single window for parts of the session. Sometimes you can ask the candidate to quickly show the desktop. This will not block all tools, but it raises the bar and makes people think twice.</p><p><strong>Finally</strong>, build a culture where it is safe to say “I do not know”. Tell candidates that it is fine to say they would look something up. Make it clear you care more about how they reason, learn, and communicate than about typing perfect code without help. If people trust that, they are less likely to reach for hidden tools in the first place.</p><h3>Conclusion</h3><p>This project started as a simple experiment to see if I could combine Electron, React, screenshots, audio capture, and LLMs into an almost invisible AI interview copilot running fully on my machine, and along the way it turned into a powerful, slightly scary proof-of-concept that a single developer can quietly bend the rules of remote interviews with something that feels like a free alternative to cluely.com. It shows how easy it is to recreate this kind of tool with open tech, which is exactly why it should be treated as a warning, not a shortcut: if candidates lean on tools like this as a crutch, they may pass a round but will struggle later when real work demands real understanding, while hiring teams need to accept that AI helpers are here to stay and design interviews that look beyond raw code output, focus on thinking and communication, and assume that invisible assistance might be present.</p><h4>A Message from AI Mind</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*5Wm7sOfTpe5DEbhg.gif" /></figure><p>Thanks for being a part of our community! Before you go:</p><ul><li>👏 Clap for the story and follow the author 👉</li><li>📰 View more content in the <a href="https://pub.aimind.so/">AI Mind Publication</a></li><li>🧠 Improve your <a href="https://www.aimind.so/prompt-generator?utm_source=pub&amp;utm_medium=message">AI prompts effortlessly and FREE</a></li><li><strong>🧰 Discover </strong><a href="https://www.aimind.so/?utm_source=pub&amp;utm_medium=message"><strong>Intuitive AI Tools</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=227e56ec88a1" width="1" height="1" alt=""><hr><p><a href="https://pub.aimind.so/building-an-ai-interview-cheat-and-what-it-means-for-hiring-227e56ec88a1">Building an AI Interview Cheat And What It Means for Hiring</a> was originally published in <a href="https://pub.aimind.so/">AI Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI’s Bubble Is Growing Fast, But Another Bubble Is Forming Even Faster]]></title>
            <link>https://medium.com/@stalinabraham/ais-bubble-is-growing-fast-but-another-bubble-is-forming-even-faster-486e171a9aea?source=rss-819a7774c34e------2</link>
            <guid isPermaLink="false">https://medium.com/p/486e171a9aea</guid>
            <category><![CDATA[investing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[future-of-work]]></category>
            <dc:creator><![CDATA[Abraham]]></dc:creator>
            <pubDate>Sat, 29 Nov 2025 08:46:24 GMT</pubDate>
            <atom:updated>2025-11-29T08:48:09.725Z</atom:updated>
            <content:encoded><![CDATA[<p>AI might be the hottest tech on the planet right now, <em>but bubbles always burst</em>. Nearly <strong>half of the world’s private investment</strong> is now flowing into AI ventures, making AI hype a primary driver of stock market gains. Tech companies large and small have seen their valuations soar by simply tying themselves to AI. This feverish <strong>gold rush</strong> is reminiscent of past bubbles from dot-coms to crypto where speculation outpaced real business value. Many experts warn that the <strong>AI industry is overheating</strong>, showing the classic signs of a bubble that’s ripe to burst.</p><h4><strong>A Tangled Web of Big AI Deals</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*ddf6sONW2Ca5d7x1SDW-2Q.png" /></figure><p>One striking example of the frenzy is the<strong> interconnected web of deals</strong> among AI’s biggest players. A recent diagram of the AI ecosystem highlights how companies like OpenAI, Oracle, and CoreWeave are all pouring money into Nvidia’s chips and Nvidia, in turn, is heavily investing back into them. <strong>Nvidia’s GPUs</strong> power nearly every major AI project, so firms such as OpenAI, Oracle, and CoreWeave have been buying vast quantities of Nvidia hardware to build AI supercomputers. In an unprecedented move, <strong>Nvidia even agreed to invest up to $100 billion in OpenAI providing cash that OpenAI </strong>will largely use to buy more Nvidia chips. OpenAI itself has committed to a <em>staggering</em> <strong>$300 billion</strong> cloud contract with Oracle to secure future computing power for AI. Oracle, along with OpenAI and SoftBank, also announced a $500 billion “Project Stargate” to build massive AI data centers globally. And it doesn’t end there: CoreWeave, a fast-growing cloud provider specializing in AI, raised hundreds of millions of dollars (about <strong>$550 million</strong> in one round) to expand its GPU infrastructure, and <strong>Nvidia owns roughly a 5–6% stake in that company.</strong> In other words, the same money is cycling through a closed loop AI companies invest in infrastructure by buying chips from Nvidia, while Nvidia invests in those companies to fuel even more growth. Analysts have openly voiced concerns about this <strong>“circular” financing</strong>: Nvidia’s dollars flow to OpenAI and then come back as orders for more Nvidia chips. It’s a self-reinforcing feedback loop that has helped pump the AI boom to trillions in value, but it also looks very much like a bubble. As one observer quipped, it’s “an illustration of circular investing… a handful propping up a handful,” which starts to resemble a house of cards if any link weakens.</p><h4>Cracks in the AI Hype (Signs of a Bubble)</h4><p>Despite massive capital inflows, the AI sector appears to be hitting an efficiency wall where newer, larger models fail to deliver performance gains proportional to their increased resource demands. Practical implementation has also struggled, with research showing that nearly all corporate AI pilots have failed to boost productivity, sometimes even hampering efficiency due to the need for error correction. The financial sustainability of the industry is currently in question, as leading providers like <strong>OpenAI reportedly operate at a loss</strong> and would need to drastically raise prices to break even on their services. This widening gap between immense speculative spending and the slower growth of real-world utility mirrors the classic indicators of a financial bubble. Recognizing these risks, major investors like <strong>Goldman Sachs have warned</strong> that a market correction could be imminent, threatening both AI software developers and the underlying infrastructure companies like Nvidia and Oracle.</p><h4>Quantum Computing: The Next Big Hype Cycle</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRtHVylsvJW5aY8O2lISDg.png" /></figure><p>If the AI bubble does pop, where will all that excited capital go next? The answer, it seems, is <strong>quantum computing</strong>. Tech insiders are already touting quantum computers as the saviors that could fix AI’s limitations. The idea is that quantum machines, with their exponentially greater processing power, might train AI models far beyond the scale of today’s hardware. As a result, a quantum computing bubble is already inflating. Investors and executives who bet big on AI are now pouring money and hope into quantum tech, positioning it as the <em>next revolution</em>. All the major players are on board: Google, Microsoft, and Amazon have their own quantum research programs, Nvidia is developing quantum chips and software, and OpenAI has hired leading quantum physicists to work on quantum AI. Even figures like Elon Musk have started hinting at quantum computing plans. Meanwhile, startups in the field are raising huge sums at lofty valuations for example, a small firm called <strong>Quantinuum raised $600 million, doubling its valuation to $10 billion on quantum promises</strong>. The hype around quantum echoes the frenzy around AI: big claims, big money, and a rush of FOMO (fear of missing out). But it also comes with a similar warning label. <strong>Experts caution that quantum computing is still far</strong> from ready for prime time building a general-purpose quantum computer could take another <strong>10–20 years,</strong> and even then success isn’t guaranteed. The technology is extremely costly and technically daunting, and there’s a long road ahead to make it practical. So while quantum is exciting and does hold revolutionary <em>potential</em>, it may become the next bubble if enthusiasm races ahead of what the science can actually deliver in the near term.</p><h4>Implications for Investors and Companies</h4><p>For investors and tech companies, the current AI landscape presents a <strong>double-edged sword</strong> of massive potential gains and significant risks. Early movers like Nvidia and Oracle have already secured enormous fortunes by betting big on the infrastructure required for this new market. However, the threat of over-investment is high, and a deflation of the AI bubble could cause widespread damage across the tech sector. Firms that have overcommitted to costly data centers and chips risk being trapped with massive sunk costs and overcapacity. This danger is compounded by deep industry interdependence, meaning a stumble by a <strong>key player like OpenAI could drag down partners like Amazon and Oracle</strong>. As valuations fluctuate with interest rates and product sentiment, investors must rigorously distinguish between revolutionary utility and temporary hype. Ultimately, sustainable success depends on companies showing real profits rather than just jumping to the <em>next trend</em>, such as <strong>quantum computing</strong>.</p><h4>Conclusion</h4><p>The current AI landscape is defined by a precarious pattern of circular investment and diminishing technical returns, signaling a potential bubble that could severely impact major infrastructure players. As skepticism regarding immediate AI profitability grows, investors appear ready to pivot capital toward the burgeoning, yet immature, promise of quantum computing as the next growth engine. This shift presents a volatile dynamic where one speculative bubble is simply traded for another, leaving companies vulnerable to massive sunk costs if economic fundamentals do not align. Consequently, sustainable success will depend on the market’s ability to look past these hype cycles and prioritize tangible productivity gains over speculative valuation.</p><h4>References</h4><p><a href="https://eu.36kr.com/en/p/3504497314700418">The AI Bubble Is Poised to Burst, Yet the Next One Is in the Works</a></p><p><a href="https://wlockett.medium.com/the-ai-bubble-is-about-to-burst-but-the-next-bubble-is-already-growing-383c0c0c7ede">The AI Bubble Is About To Burst, But The Next Bubble Is Already Growing | by Will Lockett | Medium</a></p><p><a href="https://www.reuters.com/business/nvidia-invest-100-billion-openai-2025-09-22/">Nvidia to invest up to $100 billion in OpenAI, linking two artificial intelligence titans | Reuters</a></p><p><a href="https://ts2.tech/en/the-300b-bet-how-oracle-became-ais-dark-horse-supercloud/?trk=public_post_comment-text">The $300B Bet: How Oracle Became AI’s Dark-Horse Supercloud</a></p><p><a href="https://www.reuters.com/markets/deals/cloud-firm-coreweave-files-us-ipo-2025-03-03/">Nvidia-backed cloud firm CoreWeave reveals revenue surge in US IPO filing | Reuters</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=486e171a9aea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Python Forex Signal Bot Using EMA, RSI, MACD and Bollinger Bands]]></title>
            <link>https://medium.com/@stalinabraham/building-a-python-forex-signal-bot-using-ema-rsi-macd-and-bollinger-bands-2e5df124e2c9?source=rss-819a7774c34e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e5df124e2c9</guid>
            <category><![CDATA[forex]]></category>
            <category><![CDATA[algorithmic-trading]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[day-trading-strategy]]></category>
            <dc:creator><![CDATA[Abraham]]></dc:creator>
            <pubDate>Mon, 17 Nov 2025 22:19:13 GMT</pubDate>
            <atom:updated>2025-12-05T03:49:50.723Z</atom:updated>
            <content:encoded><![CDATA[<p>Algorithmic trading helps traders stay consistent and avoid emotional decision making. In this article, we explore a Python powered forex signal bot that tracks EURUSD on one minute candles and sends alerts to Telegram when multiple indicators align. Instead of relying on a single signal, the bot checks trend, momentum and volatility together to filter out weak setups and highlight only strong opportunities. This balanced approach reduces noise and gives a structured way to look for high probability trades.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0eEMv4KlL8pQLEwrcUchuw.png" /></figure><h3>Strategy Overview</h3><p>The core of the bot is the crossover between the 9 EMA and the 21 EMA on the one minute timeframe. A bullish setup begins when the 9 EMA closes above the 21 EMA and a bearish setup starts when it closes below. EMA crossovers alone can be unreliable, especially during sideways movement, so the bot adds multiple confirmations to improve signal quality.</p><p>The first confirmation is the higher timeframe trend. The bot checks the five minute chart and calculates a 20 period EMA. If price on the five minute timeframe is above this EMA, only buy setups are considered. If price is below, only sell setups are taken. This alignment ensures the bot avoids counter trend entries and stays with the prevailing direction.</p><p>The next filter is the RSI mid zone. The bot requires RSI on the one minute chart to stay within a safe momentum zone. For a buy signal, RSI must be between 40 and 70. For a sell signal, RSI must be between 30 and 60. This avoids buying when the market is too stretched upward or selling when it is overly oversold.</p><p>Momentum confirmation comes from the MACD histogram. The bot checks if the histogram is positive for buy signals or negative for sell signals. This ensures that momentum supports the EMA crossover instead of contradicting it. A crossover without MACD support often results in weak signals, so this additional filter dramatically improves reliability.</p><p>Finally, Bollinger Bands help the bot avoid entries at extreme volatility points. If price is already touching the upper band, it avoids buying. If price is touching the lower band, it avoids selling. This prevents entering a trade when the price is at an extreme and likely to retrace.</p><p>Together, these conditions form a strict multi indicator system. Only when all filters agree does the bot trigger a signal.</p><h3>How the Code Works</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FVZsmtROj1iPQEgX4bvrfA.png" /></figure><p>The bot starts by defining parameters such as the EMA lengths, RSI period, MACD settings and Bollinger Band settings. It uses yfinance to download recent EURUSD one minute data and calculates all indicators using pandas. The data is cleaned, organized and prepared for signal evaluation.</p><p>The function that adds indicators computes:</p><pre>df[&quot;ema_fast&quot;] = close.ewm(span=9).mean()<br>df[&quot;ema_slow&quot;] = close.ewm(span=21).mean()<br>df[&quot;rsi&quot;] = compute_rsi(close, 14)<br>df[&quot;macd&quot;], df[&quot;signal&quot;], df[&quot;hist&quot;] = compute_macd(close)<br>df[&quot;bb_ma&quot;], df[&quot;bb_upper&quot;], df[&quot;bb_lower&quot;] = compute_bollinger(close)</pre><p>These values are added directly into the DataFrame, allowing the bot to reference them on every new candle. This gives a complete view of trend, momentum and volatility all inside one dataset.</p><p>Each time a new minute begins, the bot:</p><ol><li>Fetches fresh one minute data</li><li>Calculates indicator values</li><li>Checks if any trades are still open and evaluates their results after five minutes</li><li>Evaluates the latest candle for a new signal</li></ol><p>The signal logic compares current EMA values with the previous candle to detect crossovers. It then checks RSI, MACD histogram, Bollinger position and the five minute trend. If all rules are satisfied, it forms a Telegram message summarizing the trade direction, entry price, entry time and expiry time. The bot then stores the trade in the open trades list to evaluate later.</p><p>After five minutes, the bot checks whether the entry direction was correct. For buy signals, price must be above the entry price after five candles. For sell signals, price must be below. A win or loss message is sent to Telegram and the daily counters are updated. At midnight Dubai time, the bot sends a summary of the day’s results and resets the counters.</p><h3>Full Python Source Code</h3><pre>import time<br>from datetime import datetime, timedelta, date<br>import requests<br>import numpy as np<br>import pandas as pd<br>import yfinance as yf<br>import pytz<br>import traceback<br><br># ========== CONFIG ==========<br>PAIR = &quot;EURUSD=X&quot;            # EURUSD on Yahoo Finance<br>INTERVAL = &quot;1m&quot;              # 1-minute candles<br><br>EMA_FAST = 9<br>EMA_SLOW = 21<br><br>RSI_PERIOD = 14<br>MACD_FAST = 12<br>MACD_SLOW = 26<br>MACD_SIGNAL = 9<br><br>BB_PERIOD = 20<br>BB_STD = 2<br><br>CHECK_EVERY_SECONDS = 60     # check once per minute<br><br># ===== TELEGRAM SETTINGS =====<br>TELEGRAM_BOT_TOKEN = &quot;yours&quot;<br>TELEGRAM_CHAT_ID = &quot;yourchatid&quot;<br># =============================<br><br>dubai_tz = pytz.timezone(&quot;Asia/Dubai&quot;)<br><br># Global state<br>last_candle_time = None<br>open_trades = []  # list of dicts: {entry_time, entry_price, direction, dubai_time_open}<br><br># Daily stats<br>stats_date = None      # type: date<br>wins_today = 0<br>losses_today = 0<br><br><br># ========== TELEGRAM HELPERS ==========<br>def send_telegram_message(text: str):<br>    &quot;&quot;&quot;<br>    Send a plain text message to your Telegram chat.<br>    &quot;&quot;&quot;<br>    url = f&quot;https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage&quot;<br>    payload = {<br>        &quot;chat_id&quot;: TELEGRAM_CHAT_ID,<br>        &quot;text&quot;: text<br>    }<br>    try:<br>        r = requests.post(url, json=payload, timeout=10)<br>        print(&quot;Telegram status:&quot;, r.status_code, &quot;-&quot;, r.text)<br>        if r.status_code != 200:<br>            print(&quot;Error sending Telegram message:&quot;, r.text)<br>    except Exception as e:<br>        print(&quot;Telegram send error:&quot;, e)<br><br><br># ========== DATA FETCHING ==========<br>def fetch_data() -&gt; pd.DataFrame:<br>    &quot;&quot;&quot;<br>    Fetch recent EURUSD candles from Yahoo Finance.<br>    Normalize columns so we always have a usable &#39;Close&#39; column.<br>    &quot;&quot;&quot;<br>    try:<br>        df = yf.download(<br>            PAIR,<br>            period=&quot;2d&quot;,<br>            interval=INTERVAL,<br>            auto_adjust=False,<br>            progress=False<br>        )<br>    except Exception as e:<br>        print(&quot;Error fetching data from Yahoo Finance:&quot;, e)<br>        return pd.DataFrame()<br><br>    if df is None:<br>        print(&quot;Yahoo Finance returned None&quot;)<br>        return pd.DataFrame()<br><br>    if isinstance(df, pd.Series):<br>        df = df.to_frame(&quot;Close&quot;)<br><br>    if not isinstance(df, pd.DataFrame):<br>        print(&quot;Unexpected data type from yfinance:&quot;, type(df))<br>        return pd.DataFrame()<br><br>    if df.empty:<br>        print(&quot;Yahoo Finance returned empty DataFrame&quot;)<br>        return pd.DataFrame()<br><br>    # If columns are MultiIndex, pick a Close column<br>    if isinstance(df.columns, pd.MultiIndex):<br>        if (&quot;Close&quot;, PAIR) in df.columns:<br>            df = df.copy()<br>            df[&quot;Close&quot;] = df[(&quot;Close&quot;, PAIR)]<br>        else:<br>            close_cols = [c for c in df.columns if c[0] == &quot;Close&quot;]<br>            if close_cols:<br>                df = df.copy()<br>                df[&quot;Close&quot;] = df[close_cols[0]]<br>            else:<br>                print(&quot;Could not find Close column in MultiIndex data&quot;)<br>                return pd.DataFrame()<br>    else:<br>        if &quot;Close&quot; not in df.columns:<br>            print(&quot;No Close column in data&quot;)<br>            return pd.DataFrame()<br><br>    df = df.dropna()<br>    return df<br><br><br># ========== INDICATORS ==========<br>def compute_rsi(close: pd.Series, period: int) -&gt; pd.Series:<br>    delta = close.diff()<br>    gain = delta.clip(lower=0)<br>    loss = -delta.clip(upper=0)<br><br>    avg_gain = gain.ewm(alpha=1 / period, adjust=False).mean()<br>    avg_loss = loss.ewm(alpha=1 / period, adjust=False).mean()<br><br>    rs = avg_gain / (avg_loss + 1e-10)<br>    rsi = 100 - (100 / (1 + rs))<br>    return rsi<br><br><br>def compute_macd(close: pd.Series, fast: int, slow: int, signal: int):<br>    ema_fast = close.ewm(span=fast, adjust=False).mean()<br>    ema_slow = close.ewm(span=slow, adjust=False).mean()<br>    macd = ema_fast - ema_slow<br>    signal_line = macd.ewm(span=signal, adjust=False).mean()<br>    hist = macd - signal_line<br>    return macd, signal_line, hist<br><br><br>def compute_bollinger(close: pd.Series, period: int, std_mult: float):<br>    ma = close.rolling(period).mean()<br>    std = close.rolling(period).std()<br>    upper = ma + std_mult * std<br>    lower = ma - std_mult * std<br>    return ma, upper, lower<br><br><br>def add_indicators(df: pd.DataFrame) -&gt; pd.DataFrame:<br>    &quot;&quot;&quot;<br>    Add EMA 9, EMA 21, RSI, MACD, Bollinger to the DataFrame.<br>    &quot;&quot;&quot;<br>    if df is None or df.empty:<br>        return pd.DataFrame()<br><br>    df = df.copy()<br><br>    close_raw = df[&quot;Close&quot;]<br><br>    # If Close is a DataFrame (rare case), take first column<br>    if isinstance(close_raw, pd.DataFrame):<br>        close_col = close_raw.iloc[:, 0]<br>    else:<br>        close_col = close_raw<br><br>    close = pd.to_numeric(close_col, errors=&quot;coerce&quot;)<br>    close = pd.Series(close, index=df.index)<br><br>    # EMAs<br>    ema_fast = close.ewm(span=EMA_FAST, adjust=False).mean()<br>    ema_slow = close.ewm(span=EMA_SLOW, adjust=False).mean()<br>    df[&quot;ema_fast&quot;] = ema_fast<br>    df[&quot;ema_slow&quot;] = ema_slow<br><br>    # RSI<br>    df[&quot;rsi&quot;] = compute_rsi(close, RSI_PERIOD)<br><br>    # MACD<br>    macd, macd_signal, macd_hist = compute_macd(close, MACD_FAST, MACD_SLOW, MACD_SIGNAL)<br>    df[&quot;macd&quot;] = macd<br>    df[&quot;macd_signal&quot;] = macd_signal<br>    df[&quot;macd_hist&quot;] = macd_hist<br><br>    # Bollinger<br>    bb_ma, bb_upper, bb_lower = compute_bollinger(close, BB_PERIOD, BB_STD)<br>    df[&quot;bb_ma&quot;] = bb_ma<br>    df[&quot;bb_upper&quot;] = bb_upper<br>    df[&quot;bb_lower&quot;] = bb_lower<br><br>    # Drop rows with any NaN in indicators<br>    df = df.dropna()<br>    return df<br><br><br># ========== DAILY STATS ==========<br>def check_and_reset_daily_stats():<br>    &quot;&quot;&quot;<br>    If date changed in Dubai, send summary for previous day and reset counters.<br>    &quot;&quot;&quot;<br>    global stats_date, wins_today, losses_today<br><br>    now_dubai = datetime.now(dubai_tz)<br>    today = now_dubai.date()<br><br>    if stats_date is None:<br>        # First time initialization<br>        stats_date = today<br>        wins_today = 0<br>        losses_today = 0<br>        return<br><br>    if today != stats_date:<br>        # New day started, send summary for previous day<br>        summary = (<br>            f&quot;📊 Daily summary for {stats_date.isoformat()} (Dubai time)\n&quot;<br>            f&quot;Wins: {wins_today}\n&quot;<br>            f&quot;Losses: {losses_today}&quot;<br>        )<br>        print(summary)<br>        send_telegram_message(summary)<br><br>        # Reset for new day<br>        stats_date = today<br>        wins_today = 0<br>        losses_today = 0<br><br><br># ========== TIME FILTER ==========<br>def is_good_trading_time(now_dubai: datetime) -&gt; bool:<br>    &quot;&quot;&quot;<br>    Only trade during main forex time:<br>    Mon–Fri, 11:00–22:00 Dubai time.<br>    &quot;&quot;&quot;<br>    weekday = now_dubai.weekday()  # 0 = Monday, 6 = Sunday<br>    if weekday &gt;= 5:<br>        return False<br>    hour = now_dubai.hour<br>    return 11 &lt;= hour &lt; 22<br><br><br># ========== 5-MINUTE TREND ==========<br>def get_5m_trend(df: pd.DataFrame) -&gt; str:<br>    &quot;&quot;&quot;<br>    Determine 5-minute trend using EMA on resampled 5-minute candles.<br>    Returns &quot;UP&quot;, &quot;DOWN&quot;, or None.<br>    &quot;&quot;&quot;<br>    if df is None or df.empty:<br>        return None<br><br>    # Use Close for 5m resample<br>    close_1m = df[&quot;Close&quot;]<br>    if isinstance(close_1m, pd.DataFrame):<br>        close_1m = close_1m.iloc[:, 0]<br>    close_1m = pd.to_numeric(close_1m, errors=&quot;coerce&quot;)<br><br>    df_5m = close_1m.resample(&quot;5T&quot;).last().dropna()<br>    if len(df_5m) &lt; 30:<br>        return None<br><br>    ema_5m = df_5m.ewm(span=20, adjust=False).mean()<br>    last_close = df_5m.iloc[-1]<br>    last_ema = ema_5m.iloc[-1]<br><br>    if last_close &gt; last_ema:<br>        return &quot;UP&quot;<br>    elif last_close &lt; last_ema:<br>        return &quot;DOWN&quot;<br>    else:<br>        return None<br><br><br># ========== TRADE EVALUATION ==========<br>def evaluate_open_trades(df: pd.DataFrame):<br>    &quot;&quot;&quot;<br>    Check if any open trade has completed 5 candles,<br>    then send WIN or LOSS result and update daily stats.<br>    &quot;&quot;&quot;<br>    global open_trades, wins_today, losses_today<br><br>    if df is None or df.empty:<br>        return<br><br>    if len(open_trades) == 0:<br>        return<br><br>    index_list = list(df.index)<br>    trades_to_remove = []<br><br>    for trade in open_trades:<br>        entry_time = trade[&quot;entry_time&quot;]<br>        direction = trade[&quot;direction&quot;]<br>        entry_price = float(trade[&quot;entry_price&quot;])<br><br>        if entry_time not in df.index:<br>            continue<br><br>        try:<br>            entry_idx = index_list.index(entry_time)<br>        except ValueError:<br>            continue<br><br>        exit_idx = entry_idx + 5  # 5 minute expiry on 1 minute chart<br><br>        if exit_idx &gt;= len(df):<br>            continue<br><br>        exit_candle = df.iloc[exit_idx]<br>        exit_price = float(exit_candle[&quot;Close&quot;])<br><br>        # Decide win or loss<br>        if direction == &quot;CALL&quot;:<br>            result = &quot;WIN&quot; if exit_price &gt; entry_price else &quot;LOSS&quot;<br>        else:  # PUT<br>            result = &quot;WIN&quot; if exit_price &lt; entry_price else &quot;LOSS&quot;<br><br>        dubai_time_open = trade[&quot;dubai_time_open&quot;]<br>        dubai_time_close = dubai_time_open + timedelta(minutes=5)<br><br>        msg = (<br>            f&quot;Result for {direction} EURUSD trade\n&quot;<br>            f&quot;Entry price: {entry_price:.5f} at {dubai_time_open.strftime(&#39;%Y-%m-%d %H:%M:%S&#39;)} Dubai time\n&quot;<br>            f&quot;Exit after 5 minutes: {exit_price:.5f} at {dubai_time_close.strftime(&#39;%Y-%m-%d %H:%M:%S&#39;)} Dubai time\n&quot;<br>            f&quot;Outcome: {result}&quot;<br>        )<br>        print(msg)<br>        send_telegram_message(msg)<br><br>        # Update stats<br>        if result == &quot;WIN&quot;:<br>            wins_today += 1<br>        else:<br>            losses_today += 1<br><br>        trades_to_remove.append(trade)<br><br>    for t in trades_to_remove:<br>        if t in open_trades:<br>            open_trades.remove(t)<br><br><br># ========== SIGNAL LOGIC ==========<br>def format_dubai_time_short(dt: datetime) -&gt; str:<br>    &quot;&quot;&quot;<br>    Format time like 2:55pm (no leading zero, lowercase am/pm).<br>    &quot;&quot;&quot;<br>    return dt.strftime(&quot;%I:%M%p&quot;).lstrip(&quot;0&quot;).lower()<br><br><br>def check_for_signal():<br>    &quot;&quot;&quot;<br>    Main per-candle logic:<br>    - Check daily reset<br>    - Fetch data<br>    - Add indicators<br>    - Evaluate existing trades<br>    - Check for a new multi-filter signal (CALL/PUT)<br>    &quot;&quot;&quot;<br>    global last_candle_time, open_trades<br><br>    # 1) Daily summary check<br>    check_and_reset_daily_stats()<br><br>    now_dubai = datetime.now(dubai_tz)<br><br>    # 2) Fetch data<br>    df = fetch_data()<br>    if df is None or df.empty:<br>        print(f&quot;{now_dubai} - No data received from Yahoo Finance&quot;)<br>        return<br><br>    # 3) Indicators<br>    df = add_indicators(df)<br>    if df is None or df.empty:<br>        print(f&quot;{now_dubai} - Not enough data after indicators&quot;)<br>        return<br><br>    # 4) Evaluate previous open trades<br>    evaluate_open_trades(df)<br><br>    # 5) Need at least 3 candles<br>    if len(df) &lt; 3:<br>        print(f&quot;{now_dubai} - Not enough candles for signal check&quot;)<br>        return<br><br>    latest = df.iloc[-1]<br>    prev = df.iloc[-2]<br><br>    candle_time = latest.name<br>    price_now = float(latest[&quot;Close&quot;])<br><br>    ema_fast_now = float(latest[&quot;ema_fast&quot;])<br>    ema_slow_now = float(latest[&quot;ema_slow&quot;])<br>    ema_fast_prev = float(prev[&quot;ema_fast&quot;])<br>    ema_slow_prev = float(prev[&quot;ema_slow&quot;])<br><br>    rsi_now = float(latest[&quot;rsi&quot;])<br>    macd_hist_now = float(latest[&quot;macd_hist&quot;])<br>    bb_upper_now = float(latest[&quot;bb_upper&quot;])<br>    bb_lower_now = float(latest[&quot;bb_lower&quot;])<br><br>    # Candle body size filter (fixed to always be a float)<br>    if &quot;Open&quot; in df.columns:<br>        open_now = float(latest[&quot;Open&quot;])<br>        body_series = (df[&quot;Close&quot;] - df[&quot;Open&quot;]).abs()<br>        avg_body = float(body_series.tail(20).mean())<br>    else:<br>        open_now = price_now<br>        avg_body = 0.0<br><br>    body_size = abs(price_now - open_now)<br><br>    # If avg_body is zero or NaN, fall back to current body size<br>    if not np.isfinite(avg_body) or avg_body == 0:<br>        avg_body = body_size<br><br>    # Avoid tiny doji candles (too weak)<br>    if avg_body &gt; 0 and body_size &lt; 0.3 * avg_body:<br>        print(f&quot;{now_dubai} - Candle too small (body {body_size:.6f} vs avg {avg_body:.6f}), skipping.&quot;)<br>        return<br><br>    # Avoid trading outside good hours<br>    if not is_good_trading_time(now_dubai):<br>        print(f&quot;{now_dubai} - Outside main trading hours, skipping trades.&quot;)<br>        return<br><br>    # 6) 5-minute trend filter<br>    trend_5m = get_5m_trend(df)<br>    if trend_5m is None:<br>        print(f&quot;{now_dubai} - 5m trend unclear, skipping.&quot;)<br>        return<br><br>    # Avoid duplicate signal on same candle<br>    if last_candle_time is not None and candle_time &lt;= last_candle_time:<br>        print(f&quot;{now_dubai} - No new candle yet.&quot;)<br>        return<br><br>    signal_text = None<br>    direction = None<br>    reason_parts = []<br><br>    # Base EMA cross conditions<br>    call_cross = (ema_fast_prev &lt;= ema_slow_prev) and (ema_fast_now &gt; ema_slow_now)<br>    put_cross = (ema_fast_prev &gt;= ema_slow_prev) and (ema_fast_now &lt; ema_slow_now)<br><br>    # === CALL conditions ===<br>    if call_cross:<br>        # Trend filter: only buy in uptrend<br>        if trend_5m != &quot;UP&quot;:<br>            print(f&quot;{now_dubai} - CALL cross but 5m trend is not UP, skipping.&quot;)<br>        # RSI: avoid overbought; want bullish but not extreme<br>        elif not (40 &lt;= rsi_now &lt;= 70):<br>            print(f&quot;{now_dubai} - CALL cross but RSI={rsi_now:.2f} outside 40-70, skipping.&quot;)<br>        # MACD: need bullish momentum<br>        elif macd_hist_now &lt;= 0:<br>            print(f&quot;{now_dubai} - CALL cross but MACD hist {macd_hist_now:.6f} &lt;= 0, skipping.&quot;)<br>        # Bollinger: avoid spikes at or above upper band<br>        elif price_now &gt;= bb_upper_now:<br>            print(f&quot;{now_dubai} - CALL cross but price at/above upper BB, skipping.&quot;)<br>        else:<br>            signal_text = &quot;Buy (CALL)&quot;<br>            direction = &quot;CALL&quot;<br>            reason_parts.append(&quot;EMA9 crossed above EMA21&quot;)<br>            reason_parts.append(&quot;5m trend UP&quot;)<br>            reason_parts.append(f&quot;RSI={rsi_now:.1f} in 40-70&quot;)<br>            reason_parts.append(&quot;MACD momentum bullish&quot;)<br>            reason_parts.append(&quot;Price below upper Bollinger band&quot;)<br><br>    # === PUT conditions ===<br>    if direction is None and put_cross:<br>        # Trend filter: only sell in downtrend<br>        if trend_5m != &quot;DOWN&quot;:<br>            print(f&quot;{now_dubai} - PUT cross but 5m trend is not DOWN, skipping.&quot;)<br>        # RSI: avoid oversold; want bearish but not extreme<br>        elif not (30 &lt;= rsi_now &lt;= 60):<br>            print(f&quot;{now_dubai} - PUT cross but RSI={rsi_now:.2f} outside 30-60, skipping.&quot;)<br>        # MACD: need bearish momentum<br>        elif macd_hist_now &gt;= 0:<br>            print(f&quot;{now_dubai} - PUT cross but MACD hist {macd_hist_now:.6f} &gt;= 0, skipping.&quot;)<br>        # Bollinger: avoid spikes at or below lower band<br>        elif price_now &lt;= bb_lower_now:<br>            print(f&quot;{now_dubai} - PUT cross but price at/below lower BB, skipping.&quot;)<br>        else:<br>            signal_text = &quot;Sell (PUT)&quot;<br>            direction = &quot;PUT&quot;<br>            reason_parts.append(&quot;EMA9 crossed below EMA21&quot;)<br>            reason_parts.append(&quot;5m trend DOWN&quot;)<br>            reason_parts.append(f&quot;RSI={rsi_now:.1f} in 30-60&quot;)<br>            reason_parts.append(&quot;MACD momentum bearish&quot;)<br>            reason_parts.append(&quot;Price above lower Bollinger band&quot;)<br><br>    if signal_text is not None and direction is not None:<br>        last_candle_time = candle_time<br><br>        dubai_entry_time = now_dubai<br>        dubai_expiry_time = dubai_entry_time + timedelta(minutes=5)<br><br>        open_trades.append({<br>            &quot;entry_time&quot;: candle_time,<br>            &quot;entry_price&quot;: price_now,<br>            &quot;direction&quot;: direction,<br>            &quot;dubai_time_open&quot;: dubai_entry_time<br>        })<br><br>        first_line = (<br>            f&quot;{signal_text} EURUSD at &quot;<br>            f&quot;{format_dubai_time_short(dubai_entry_time)} Dubai time for 5 minutes&quot;<br>        )<br><br>        reason_text = &quot;; &quot;.join(reason_parts)<br><br>        msg = (<br>            f&quot;{first_line}\n\n&quot;<br>            f&quot;Entry price: {price_now:.5f}\n&quot;<br>            f&quot;Entry time: {dubai_entry_time.strftime(&#39;%Y-%m-%d %H:%M:%S&#39;)} Dubai time\n&quot;<br>            f&quot;Expiry: {dubai_expiry_time.strftime(&#39;%Y-%m-%d %H:%M:%S&#39;)} Dubai time\n&quot;<br>            f&quot;Reason: {reason_text}&quot;<br>        )<br><br>        print(msg)<br>        send_telegram_message(msg)<br>    else:<br>        print(f&quot;{now_dubai} - No signal this candle.&quot;)<br><br><br># ========== MAIN LOOP ==========<br>def main_loop():<br>    print(&quot;Starting signal bot (advanced strategy)...&quot;)<br>    send_telegram_message(&quot;✅ Advanced EURUSD signal bot started (EMA+RSI+MACD+BB+5m trend). Demo use only.&quot;)<br>    while True:<br>        try:<br>            check_for_signal()<br>        except Exception as e:<br>            print(&quot;Error in main loop:&quot;, repr(e))<br>            traceback.print_exc()<br>        time.sleep(CHECK_EVERY_SECONDS)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main_loop()</pre><h3>Telegram Alerts</h3><p>The bot uses simple HTTP requests to send messages to Telegram. You only need a Telegram bot token and your chat ID. Once configured, every signal, result and daily summary will appear instantly on your phone. This makes the bot easy to monitor even when you are not at your computer.</p><h3>Running the Bot</h3><p>To run the script, install the required libraries:</p><pre>pip install yfinance pandas numpy requests pytz</pre><p>Then enter your Telegram bot token and chat ID inside the configuration section. Run the script and leave it active. The bot will generate real time alerts using the conditions you configured.</p><h3>Conclusion</h3><p>This bot offers a disciplined approach to short term forex trading. By combining EMA crossovers with RSI filtering, MACD confirmation and Bollinger Band positioning, it avoids low quality entries and focuses on strong, high confidence setups. Even though the system is simple, it demonstrates how multiple indicators can work together to create a structured and effective trading strategy. You can customize indicator parameters, add more filters or even integrate direct trade execution if you connect it to a broker API.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e5df124e2c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>