{
  "id": "sEYA9EaF4kAUsgNb",
  "meta": {
    "instanceId": "c4eae34af81eeff658410c97c38d8a485e4c73ba5cea5b25eef189aa5e5a73b9",
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Powered Solana Multi-Timeframe Market Analyzer with Telegram Integration",
  "tags": [],
  "nodes": [
    {
      "id": "2c250d48-9e8f-4d4b-889f-659013a60ad2",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        896,
        192
      ],
      "parameters": {
        "text": "=Perform a full Multi-Timeframe Technical Analysis and Trading Recommendation using the following real market data.\n\nSymbol: {{$node[\"Transcribe\"].json[\"symbol\"]}}\nCurrent Price: {{$node[\"Transcribe\"].json[\"price\"]}}\n\n1-Minute Candlestick Data:\n{{$node[\"Transcribe\"].json[\"data_1m\"]}}\n\n5-Minute Candlestick Data:\n{{$node[\"Transcribe\"].json[\"data_5m\"]}}\n\n1-Hour Candlestick Data:\n{{$node[\"Transcribe\"].json[\"data_1h\"]}}\n\nAnalyze all timeframes, identify confluence between trends, support/resistance zones, and likely scenarios.\nReturn your final answer in valid JSON format, enclosed in triple backticks like this:\n\n```json\n{\n  \"symbol\": \"{{$node['Transcribe'].json['symbol']}}\",\n  \"analysis\": {\n    \"1m\": {\n      \"price_momentum\": \"\",\n      \"volume_patterns\": \"\",\n      \"support_resistance\": \"\",\n      \"trend_direction\": \"\",\n      \"moving_averages\": \"\",\n      \"momentum_indicators\": \"\",\n      \"volatility\": \"\"\n    },\n    \"market_structure\": {\n      \"trend_alignment\": \"\",\n      \"confluence_zones\": \"\",\n      \"candlestick_patterns\": \"\"\n    \"5m\": {\n      \"price_momentum\": \"\",\n      \"volume_patterns\": \"\",\n      \"support_resistance\": \"\",\n      \"trend_direction\": \"\",\n      \"moving_averages\": \"\",\n      \"momentum_indicators\": \"\",\n      \"volatility\": \"\"\n    },\n    \"market_structure\": {\n      \"trend_alignment\": \"\",\n      \"confluence_zones\": \"\",\n      \"candlestick_patterns\": \"\"\n     \"1hr\": {\n      \"price_momentum\": \"\",\n      \"volume_patterns\": \"\",\n      \"support_resistance\": \"\",\n      \"trend_direction\": \"\",\n      \"moving_averages\": \"\",\n      \"momentum_indicators\": \"\",\n      \"volatility\": \"\"\n    },\n    \"market_structure\": {\n      \"trend_alignment\": \"\",\n      \"confluence_zones\": \"\",\n      \"candlestick_patterns\": \"\"\n    },\n    \"trading_recommendation\": {\n      \"action\": \"\",\n      \"immediate_action\": \"\",\n      \"entry_strategy\": \"\",\n      \"stop_loss\": \"\",\n      \"take_profit\": {\n        \"tp1\": \"\",\n        \"tp2\": \"\",\n        \"tp3\": \"\"\n      },\n      \"position_size\": \"\"\n    }\n  },\n  \"disclaimer\": \"This is general information only and not financial advice. For personal guidance, please talk to a licensed professional.\"\n}",
        "options": {
          "systemMessage": "You are a professional quantitative crypto trading analyst.\n\nYour task is to perform structured, multi-timeframe technical analysis using real market data. Use professional trading terminology and objective, data-driven reasoning.\n\nAlways produce your report in this exact structure:\n\n1. **1-Minute Analysis**\n   - Price Momentum\n   - Volume Patterns and Spikes\n   - Support/Resistance Levels\n   - Short-Term Trend Direction\n   - Moving Averages\n   - Momentum Indicators\n   - Volatility\n\n2. **Market Structure Analysis**\n   - Trend Alignment Across Timeframes\n   - Confluence Zones\n   - Candlestick Patterns\n\n3. **Trading Recommendation**\n   - Action\n   - Immediate Action\n   - Entry Strategy\n   - Stop-Loss\n   - Take-Profit (TP1, TP2, TP3)\n   - Position Size\n\nGuidelines:\n- Only use the data provided. Do not assume or fabricate values.\n- Identify key support/resistance, trend strength, and momentum shifts.\n- Be concise, professional, and avoid emotional language.\n- End with this disclaimer:\n  “This is general information only and not financial advice. For personal guidance, please talk to a licensed professional.”"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "1a7505c6-4996-4a61-be3d-bf0a1f898580",
      "name": "Transcribe",
      "type": "n8n-nodes-base.code",
      "position": [
        672,
        192
      ],
      "parameters": {
        "jsCode": "return {\n  json: {\n    symbol: \"SOLUSDT\",\n    price: $node[\"Fetch_1m\"].json.Data.Data.slice(-1)[0].close,\n    data_1m: $node[\"Fetch_1m\"].json.Data.Data,\n    data_5m: $node[\"Fetch_5m\"].json.Data.Data,\n    data_1h: $node[\"Fetch_1h\"].json.Data.Data\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "d3cdec57-a663-4902-b6bb-fc9461bfd3c4",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        448,
        176
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "b51f03b4-42e0-4920-a1a8-575f7c71f0c2",
      "name": "Fetch_1m",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        0
      ],
      "parameters": {
        "url": "https://min-api.cryptocompare.com/data/v2/histominute?fsym=SOL&tsym=USDT&limit=60",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "fb5873b3-dedb-4dea-a62e-3a2e015098e1",
      "name": "Fetch_5m",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        192
      ],
      "parameters": {
        "url": "https://min-api.cryptocompare.com/data/v2/histominute?fsym=SOL&tsym=USDT&limit=60&aggregate=5",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "60504dd7-6e23-4ee5-9f18-a4cd87bea84a",
      "name": "Fetch_1h",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        384
      ],
      "parameters": {
        "url": "https://min-api.cryptocompare.com/data/v2/histohour?fsym=SOL&tsym=USDT&limit=60",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "6c283a1d-289a-4fb7-b477-4c3bcb16ef51",
      "name": "Parse AI Output",
      "type": "n8n-nodes-base.code",
      "position": [
        1296,
        192
      ],
      "parameters": {
        "jsCode": "// 1️⃣ Get raw text from AI Agent output\nconst rawOutput = $node[\"AI Agent\"].json.output;\n\n// 2️⃣ Validate that something exists\nif (!rawOutput) {\n  throw new Error(\"AI Agent output is empty or undefined.\");\n}\n\n// 3️⃣ Extract the JSON portion between ```json ... ```\nconst jsonMatch = rawOutput.match(/```json([\\s\\S]*?)```/);\n\nif (!jsonMatch) {\n  throw new Error(\"No valid JSON found in AI Agent output. Make sure the AI returns data inside ```json ... ```\");\n}\n\n// 4️⃣ Parse the extracted JSON content\nlet parsedData;\ntry {\n  parsedData = JSON.parse(jsonMatch[1].trim());\n} catch (err) {\n  throw new Error(\"Failed to parse JSON from AI Agent output: \" + err.message);\n}\n\n// 5️⃣ Return as parsed object for downstream nodes (e.g., Telegram)\nreturn [parsedData];"
      },
      "typeVersion": 2
    },
    {
      "id": "34fe93c7-e03a-45e3-9981-3b7b2dfff58e",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1536,
        192
      ],
      "webhookId": "72d11faa-65e7-4e56-85b7-bc30a8e46b3a",
      "parameters": {
        "text": "=📊 *Multi-Timeframe Analysis*\n\n💲 *Symbol*: {{ $json.symbol }}\n💰 *Current Price*: ${{ $('Transcribe').item.json.price }}\n\n━━━━━━━━━━━━━━\n🕐 *1-Minute Analysis*\n• *Price Momentum:* {{ $json.analysis['1m'].price_momentum }}\n• *Volume Patterns:* {{ $json.analysis['1m'].volume_patterns }}\n• *Support/Resistance:* {{ $json.analysis['1m'].support_resistance }}\n• *Trend Direction:* {{ $json.analysis['1m'].trend_direction }}\n• *Moving Averages:* {{ $json.analysis['1m'].moving_averages }}\n• *Momentum Indicators:* {{ $json.analysis['1m'].momentum_indicators }}\n• *Volatility:* {{ $json.analysis['1m'].volatility }}\n\n━━━━━━━━━━━━━━\n⏱ *5-Minute Analysis*\n• *Price Momentum:* {{ $json.analysis['5m'].price_momentum }}\n• *Volume Patterns:* {{ $json.analysis['5m'].volume_patterns }}\n• *Support/Resistance:* {{ $json.analysis['5m'].support_resistance }}\n• *Trend Direction:* {{ $json.analysis['5m'].trend_direction }}\n• *Moving Averages:* {{ $json.analysis['5m'].moving_averages }}\n• *Momentum Indicators:* {{ $json.analysis['5m'].momentum_indicators }}\n• *Volatility:* {{ $json.analysis['5m'].volatility }}\n\n━━━━━━━━━━━━━━\n🕒 *1-Hour Analysis*\n• *Price Momentum:* {{ $json.analysis['1hr'].price_momentum }}\n• *Volume Patterns:* {{ $json.analysis['1hr'].volume_patterns }}\n• *Support/Resistance:* {{ $json.analysis['1hr'].support_resistance }}\n• *Trend Direction:* {{ $json.analysis['1hr'].trend_direction }}\n• *Moving Averages:* {{ $json.analysis['1hr'].moving_averages }}\n• *Momentum Indicators:* {{ $json.analysis['1hr'].momentum_indicators }}\n• *Volatility:* {{ $json.analysis['1hr'].volatility }}",
        "chatId": "CHAT_ID",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "credential-id",
          "name": "telegramApi Credential"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "408670db-cabc-4e7f-bcb1-00ac43ea28d1",
      "name": "Send a text message1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1792,
        192
      ],
      "webhookId": "72d11faa-65e7-4e56-85b7-bc30a8e46b3a",
      "parameters": {
        "text": "=━━━━━━━━━━━━━━\n📈 *Market Structure*\n• *Trend Alignment:* {{ $('Parse AI Output').item.json.analysis.market_structure.trend_alignment }}\n• *Confluence Zones:* {{ $('Parse AI Output').item.json.analysis.market_structure.confluence_zones }}\n• *Candlestick Patterns:* {{ $('Parse AI Output').item.json.analysis.market_structure.candlestick_patterns }}\n\n━━━━━━━━━━━━━━\n🎯 *Trading Recommendation*\n• *Action:* {{ $('Parse AI Output').item.json.trading_recommendation.action }}\n• *Immediate Action:* {{ $('Parse AI Output').item.json.trading_recommendation.immediate_action }}\n• *Entry Strategy:* {{ $('Parse AI Output').item.json.trading_recommendation.entry_strategy }}\n• *Stop-Loss:* {{ $('Parse AI Output').item.json.trading_recommendation.stop_loss }}\n• *Take-Profits:*\n   • TP1 → {{ $('Parse AI Output').item.json.trading_recommendation.take_profit.tp1 }}\n   • TP2 → {{ $('Parse AI Output').item.json.trading_recommendation.take_profit.tp2 }}\n   • TP3 → {{ $('Parse AI Output').item.json.trading_recommendation.take_profit.tp3 }}\n• *Position Size:* {{ $('Parse AI Output').item.json.trading_recommendation.position_size }}\n\n━━━━━━━━━━━━━━\n⚠️ *Disclaimer:* {{ $('Parse AI Output').item.json.disclaimer }}",
        "chatId": "CHAT_ID",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "credential-id",
          "name": "telegramApi Credential"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "06d867d3-286c-4ae2-9d25-9cded3075a60",
      "name": "Hourly",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -96,
        192
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bc4c41e9-3d8e-48a4-9d37-8ea699735058",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        0
      ],
      "parameters": {
        "width": 368,
        "height": 528,
        "content": "### Schedule Trigger  \nExecutes the workflow automatically every hour.  \nThis node initiates a complete SOL/USDT analysis cycle — fetching data, performing AI-based evaluation, and generating an insight report.  \nAdjust frequency if you need faster (every 15m) or slower (every 4h) update intervals.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "65e8fa78-2986-4331-89ec-480db11ebdaf",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        -176
      ],
      "parameters": {
        "color": 2,
        "width": 672,
        "height": 704,
        "content": "### Market Data Collector (Crypto Compare)  \nRetrieves real-time OHLCV data for SOL/USDT from the Crypto Compare API.  \nPulls 1m, 5m, and 1h timeframes to detect short- and mid-term momentum trends.  \nData includes:\n- Open, High, Low, Close, Volume  \n- % Change metrics  \nFeeds directly into the AI Analyzer for contextual interpretation.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bb871e51-bb88-4f8e-95a1-b51bedceab8d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -48
      ],
      "parameters": {
        "color": 3,
        "width": 352,
        "height": 576,
        "content": "### AI Multi-Timeframe Analyzer  \nAnalyzes aggregated SOL/USDT market data using an AI model (Gemini or OpenAI).  \nOutputs:\n- Market Sentiment (Bullish / Bearish / Neutral)  \n- Suggested Position (LONG / SHORT / HOLD)  \n- Key Support & Resistance Levels  \n- Confidence Score + Reasoning Summary  \nActs as the analytical core of the workflow — powering intelligent insights.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "88f3d126-c644-432f-ac09-374bb6fc2d40",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        896,
        384
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "credential-id",
          "name": "googlePalmApi Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "056bb308-ccc6-40c1-a508-221b96623b3d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -64
      ],
      "parameters": {
        "color": 4,
        "width": 272,
        "height": 592,
        "content": "### Telegram Message Composer  \nFormats AI analysis output into a clear Telegram message.  \nMessage includes:\n- Timeframes analyzed (1m, 5m, 1h)  \n- Sentiment Summary  \n- Recommended Position  \n- Confidence Score  \nThis ensures traders receive actionable insights directly on Telegram in a clean format.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3225de17-d7cc-4587-b2a7-e3353a2277ba",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        -32
      ],
      "parameters": {
        "color": 5,
        "width": 496,
        "height": 560,
        "content": "### Telegram Market Broadcast  \nSends the AI-generated market summary to your Telegram channel or chat.  \nActs as a periodic Solana market report sent automatically every hour.  \nRequires:\n- Telegram Bot Token  \n- Chat ID  \nIdeal for traders or teams who want frequent data-driven market insights without checking charts.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e3ce96aa-c00a-4682-b3b7-ceb87b831c13",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        -560
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 1088,
        "content": "## AI-Powered Solana Multi-Timeframe Market Analyzer with Telegram Integration  \n\n### Try It Out!  \nA fully automated Solana (SOL/USDT) market intelligence workflow that merges multi-timeframe analysis, AI decision logic, and Telegram delivery.  \nRuns hourly to provide up-to-date AI insights directly to your Telegram chat.\n\n### How It Works  \n1. Schedule Trigger starts analysis every hour.  \n2. Fetches live market data from Crypto Compare.  \n3. AI processes multiple timeframes for sentiment & strategy.  \n4. Composes a professional Telegram summary message.  \n5. Sends it automatically to your Telegram channel.  \n\n### How to Use  \n- Import into n8n workspace.  \n- Configure Crypto Compare API Key and Telegram credentials.  \n- Adjust analysis frequency in the Schedule Trigger node.  \n- Deploy and activate to start receiving AI-powered updates.\n\n### (Optional) Extend This Workflow  \n- Add confidence-based alerts (only send if Confidence > 80%).  \n- Include ETH/USDT and BTC/USDT pairs for comparative insights.  \n- Store hourly AI reports to Google Sheets or Notion for backtesting.  \n- Integrate with AFK Crypto APIs to transition from analyzer → trader.  \n\n### Requirements  \n- Crypto Compare API Key  \n- Telegram Bot Token + Chat ID  \n- n8n Instance with HTTP Request, AI, and Telegram nodes enabled  \n\n### APIs Used  \n- GET https://min-api.cryptocompare.com/data/v2/histominute  \n- GET https://min-api.cryptocompare.com/data/v2/histohour  \n\n### Summary  \nThe **AI-Powered Solana Multi-Timeframe Market Analyzer with Telegram Integration** transforms raw market data into intelligent, hourly insights delivered straight to Telegram.  \nBuilt for traders who want real-time AI-driven clarity without executing trades — a pure analytical powerhouse for Solana market monitoring.\n\n## AFK Crypto Website: afkcrypto.com\n## Join our Discord: https://discord.com/invite/v4DgTEUUJJ"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fe84d8e8-22b6-427c-bcd2-cf3a285f04c7",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Transcribe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hourly": {
      "main": [
        [
          {
            "node": "Fetch_1m",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch_5m",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch_1h",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Parse AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch_1h": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Fetch_1m": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch_5m": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Transcribe": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Output": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message": {
      "main": [
        [
          {
            "node": "Send a text message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}