0% found this document useful (0 votes)
0 views2 pages

Text Python

This document outlines a Python script that utilizes a Telegram bot to analyze currency pairs for trading signals based on the Relative Strength Index (RSI). It fetches historical candle data from a specified API, calculates the RSI, and sends buy or sell signals to a Telegram chat based on specific conditions. The script runs in a continuous loop, analyzing the market every minute.

Uploaded by

tempmaile69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views2 pages

Text Python

This document outlines a Python script that utilizes a Telegram bot to analyze currency pairs for trading signals based on the Relative Strength Index (RSI). It fetches historical candle data from a specified API, calculates the RSI, and sends buy or sell signals to a Telegram chat based on specific conditions. The script runs in a continuous loop, analyzing the market every minute.

Uploaded by

tempmaile69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import pandas as pd

import requests
import time
import numpy as np
from telegram import Bot

# === Telegram Bot Token ===


TELEGRAM_TOKEN = '7747083952:AAGqQncsCKjXbmYq9Ty4_rUQsxYj-jDyY8A'
TELEGRAM_CHAT_ID = 'your-chat-id-here' # Will help you find this below

bot = Bot(token=TELEGRAM_TOKEN)

# === Sample asset list (can be expanded) ===


assets = ['USD/ARS', 'EUR/JPY', 'NZD/CAD', 'AUD/USD', 'USD/JPY']

# === Get historical candle data from a dummy API (Replace with real source) ===
def get_candles(pair):
# Fake example - replace with your own API or dummy CSV if needed
url = f'https://api.example.com/candles/{pair}?timeframe=1m&limit=15'
response = requests.get(url)
data = response.json()
df = pd.DataFrame(data)
return df

# === Calculate RSI ===


def rsi(series, period=14):
delta = series.diff()
gain = np.where(delta > 0, delta, 0)
loss = np.where(delta < 0, -delta, 0)
gain = pd.Series(gain).rolling(window=period).mean()
loss = pd.Series(loss).rolling(window=period).mean()
rs = gain / loss
return 100 - (100 / (1 + rs))

# === Analyze market ===


def analyze_market():
for pair in assets:
try:
df = get_candles(pair)
df['rsi'] = rsi(df['close'])

latest = df.iloc[-1]
prev = df.iloc[-2]

if latest['rsi'] < 30 and latest['close'] > latest['open']: # Bullish


candle
send_signal(pair, 'BUY', latest['rsi'])
elif latest['rsi'] > 70 and latest['close'] < latest['open']: #
Bearish candle
send_signal(pair, 'SELL', latest['rsi'])

except Exception as e:
print(f"Error with {pair}: {e}")

# === Send Telegram Signal ===


def send_signal(pair, direction, rsi_value):
msg = f"""📢 *Quotex Signal*
Pair: {pair}
Direction: *{direction}*
RSI: {round(rsi_value, 2)}
Timeframe: 1 Minute
Expiry: 1 min
Confidence: ✅✅✅"""
bot.send_message(chat_id=TELEGRAM_CHAT_ID, text=msg, parse_mode='Markdown')

# === Loop ===


while True:
analyze_market()
time.sleep(60)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy