指定

import ccxt
import pandas as pd
import numpy as np
import talib
import time

# Configuration
exchange = ccxt.binance({
    'apiKey': 'VOTRE_API_KEY',
    'secret': 'VOTRE_SECRET_KEY',
})

# Paramètres de trading
symbole = 'BTC/USDT'
timeframe = '1h'
montant = 100  # en USDT
stop_loss = 0.98  # 2% de perte maximale
take_profit = 1.03  # 3% de gain

def recuperer_donnees():
    ohlcv = exchange.fetch_ohlcv(symbole, timeframe, limit=100)
    df = pd.DataFrame(ohlcv, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
    df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')
    return df

def calculer_indicateurs(df):
    df['ema_50'] = talib.EMA(df['close'].values, timeperiod=50)
    df['ema_200'] = talib.EMA(df['close'].values, timeperiod=200)
    df['rsi'] = talib.RSI(df['close'].values, timeperiod=14)
    return df

def strategie(df):
    if df['ema_50'].iloc[-1] > df['ema_200'].iloc[-1] and df['rsi'].iloc[-1] < 70:
        return 'acheter'
    elif df['ema_50'].iloc[-1] < df['ema_200'].iloc[-1] and df['rsi'].iloc[-1] > 30:
        return 'vendre'
    else:
        return 'neutre'

def trader():
    df = recuperer_donnees()
    df = calculer_indicateurs(df)
    signal = strategie(df)

    if signal == 'acheter':
        try:
            ordre = exchange.create_market_buy_order(symbole, montant)
            print(f"Achetés {montant} {symbole}")
        except Exception as e:
            print(f"Erreur d'achat : {e}")
    elif signal == 'vendre':
        try:
            ordre = exchange.create_market_sell_order(symbole, montant)
            print(f"Vendus {montant} {symbole}")
        except Exception as e:
            print(f"Erreur de vente : {e}")

while True:
    trader()
    time.sleep(3600)  # attendre 1 heure

反馈

1
开发者 1
等级
(5)
项目
7
0%
仲裁
8
13% / 75%
逾期
3
43%
空闲
2
开发者 2
等级
(28)
项目
39
23%
仲裁
14
0% / 93%
逾期
4
10%
工作中
相似订单
//+------------------------------------------------------------------+ //| M65 PRO ROBOT | //| Trend + RSI + Risk Management | //+------------------------------------------------------------------+ #property strict input double LotSize = 0.01; input int StopLoss = 100; // points input int TakeProfit = 200; // points input int RSI_Period = 14; int rsiHandle; int ema50Handle; int ema200Handle;
Description du projet : Je recherche un développeur MQL5 expérimenté pour créer un Expert Advisor (EA) complet basé sur les concepts de Smart Money Concepts (SMC) . L'algorithme doit fonctionner sur trois unités de temps synchronisées (H4, M15, M1). Compétences techniques requises : Maîtrise parfaite du Multi-Timeframe (MTF) sans "survie" (no repainting/no future leaking). Capacité à coder des détections de
Trader 30+ USD
Un robot qui tarde a ma place même quand je Dors je veux qu'elle faire tout les tâches a ma place même quand le téléphone est éteint ou allumé le robot doit analyse et trade pour moi
I am looking for a developer to work with to create a bot that will generate signals based on the session highs and lows. Two pending orders will be placed, and one will be automatically deleted as soon as the other is activated. A second recovery trade will then be placed at the same level where the deleted trade was located that will activated in case the running trade hits sl. If the running trade hits tp the

项目信息

预算
30 - 200 USD

客户

所下订单1
仲裁计数0