Price Action EMA + RSI + Bollinger Bands With Bots Testing

fastEMA:30 slowEMA:50 SOLUSDT SL=2.5, TP=1.8, return=13.29% in 1h.
fastEMA:30 slowEMA:50 SOLUSDT SL=2.5, TP=1.3, return=4.96% in 30m.
fastEMA:30 slowEMA:50 SOLUSDT SL=1.2, TP=1.1, return=-1.01% in 15m.
fastEMA:30 slowEMA:50 SOLUSDT SL=1.5, TP=2.5, return=-0.42% in 5m.
fastEMA:30 slowEMA:50 SOLUSDT SL=1.1, TP=1.4, return=0.66% in 4h.
fastEMA:20 slowEMA:40 SOLUSDT SL=2.4, TP=2.2, return=6.70% in 1h.
fastEMA:50 slowEMA:100 SOLUSDT SL=2.0, TP=2.5, return=8.82% in 1h.

fastEMA:30 slowEMA:50 ETHUSDT SL=2.1, TP=2.4, return=10.72% in 1h.
fastEMA:30 slowEMA:50 ETHUSDT SL=1.8, TP=1.3, return=1.06% in 30m.
fastEMA:30 slowEMA:50 ETHUSDT SL=1.1, TP=1.7, return=0.10% in 15m.
fastEMA:30 slowEMA:50 ETHUSDT SL=1.3, TP=2.5, return=0.69% in 5m.
fastEMA:30 slowEMA:50 ETHUSDT SL=1.0, TP=1.3, return=3.97% in 4h.
fastEMA:20 slowEMA:40 ETHUSDT SL=2.2, TP=2.4, return=9.95% in 1h.
fastEMA:50 slowEMA:100 ETHUSDT SL=1.3, TP=2.5, return=-2.24% in 1h.

def count_opened_trades():
    api_instance = c.API(access_token)
    config = api_instance.config
    api_key = config.get(“api_key_bybit”)
    api_secret = config.get(“api_secret_bybit”)
    session = HTTP(testnet=False, api_key=api_key, api_secret=api_secret)
    try:
        data = session.get_positions(category=”linear”, symbol=Symbol)
        size = data[‘result’][‘list’][0][‘size’]
        return float(size)
    except Exception as e:
        print(f”DGM Failed to get {Symbol} position: {e}”)
        return

def ema_signal(df, current_candle, backcandles):  
    df_slice = df.reset_index().copy()
    start = max(0, current_candle – backcandles)
    end = current_candle + 1
    relevant_rows = df_slice.iloc[start:end]
   
    # Check if all EMA_fast values are below EMA_slow values (buy signal)
    if (relevant_rows[‘EMA_fast’] < relevant_rows[‘EMA_slow’]).all():
        return 1
    # Check if all EMA_fast values are above EMA_slow values (sell signal)
    elif (relevant_rows[‘EMA_fast’] > relevant_rows[‘EMA_slow’]).all():
        return -1
    else:
        return 0
   
def total_signal(df, current_candle, backcandles):
    if isinstance(current_candle, pd.Timestamp):
        current_candle = df.index.get_loc(current_candle)

    ema_signal_result = ema_signal(df, current_candle, backcandles)

    candle_open_price = df[‘Open’].iloc[current_candle]
    bbl = df[‘BBL_15_1.5’].iloc[current_candle]
    bbu = df[‘BBU_15_1.5’].iloc[current_candle]

    if ema_signal_result == 1 and candle_open_price <= bbl:
        return 1
    if ema_signal_result == -1 and candle_open_price >= bbu:
        return -1
    return 0

def get_candles(symbol, interval, lookback):
    url = f”{API_URLv3}{library}?symbol={symbol}&interval={interval}&limit={lookback}”
    try:
        response = requests.get(url)
        response.raise_for_status()
        data = response.json()

        if not data:
            print(f”No data received from {API_URLv3}{library} API.”)
            return None

        df = pd.DataFrame(data, columns=[
            ‘open_time’, ‘open’, ‘high’, ‘low’, ‘close’, ‘volume’,
            ‘close_time’, ‘quote_asset_volume’, ‘number_of_trades’,
            ‘taker_buy_base_asset_volume’, ‘taker_buy_quote_asset_volume’, ‘ignore’
        ])
        df[‘open_time’] = pd.to_datetime(df[‘open_time’], unit=’ms’)
        df.set_index(‘open_time’, inplace=True)
        df.rename(columns={‘open’: ‘Open’, ‘high’: ‘High’, ‘low’: ‘Low’, ‘close’: ‘Close’}, inplace=True)

        df[[‘Open’, ‘High’, ‘Low’, ‘Close’]] = df[[‘Open’, ‘High’, ‘Low’, ‘Close’]].astype(float)
        return df[[‘Open’, ‘High’, ‘Low’, ‘Close’]]
    except requests.RequestException as e:
        print(f”{symbol} Request failed: {e}”)
    except Exception as e:
        print(f”Failed to process {symbol} data: {e}”)
    return None

def get_candles_frame(lookback):
    candles = get_candles(Symbol, Interval, lookback)

    if candles is None:
        print(f”Failed to retrieve {Interval} {Symbol} candle data.”)
        return None

    dfstream = candles.copy()

    dfstream[‘ATR’] = ta.atr(dfstream[‘High’], dfstream[‘Low’], dfstream[‘Close’], length=7)
    dfstream[‘EMA_fast’] = ta.ema(dfstream[‘Close’], length=30)
    dfstream[‘EMA_slow’] = ta.ema(dfstream[‘Close’], length=50)
    dfstream[‘RSI’] = ta.rsi(dfstream[‘Close’], length=10)
    my_bbands = ta.bbands(dfstream[‘Close’], length=15, std=1.5)
    dfstream = dfstream.join(my_bbands)
    if not isinstance(dfstream.index, pd.DatetimeIndex):
        dfstream.index = pd.to_datetime(dfstream.index)

    dfstream[‘TotalSignal’] = dfstream.apply(lambda row: total_signal(dfstream, row.name, 7), axis=1)
    dfstream.to_csv(‘dfstream.csv’)
    return dfstream

def optimization():
    slatrcoef = 0
    TPSLRatio_coef = 0

    dfstream = get_candles_frame(lookback)
    if dfstream is None:
        print(f”No candle data for {Symbol} fitting optimization job.”)
        return

    def SIGNAL():
        return dfstream[‘TotalSignal’]

    class MyStrat(Strategy):
        mysize = 3000
        slcoef = 1.3
        TPSLRatio = 2.5

        def init(self):
            self.signal1 = self.I(SIGNAL)

        def next(self):
            slatr = self.slcoef * self.data.ATR[-1]
            TPSLRatio = self.TPSLRatio

            if self.signal1[-1] == 2 and len(self.trades) == 0:
                sl1 = self.data.Close[-1] – slatr
                tp1 = self.data.Close[-1] + slatr * TPSLRatio
                self.buy(sl=sl1, tp=tp1, size=self.mysize)

            elif self.signal1[-1] == 1 and len(self.trades) == 0:
                sl1 = self.data.Close[-1] + slatr
                tp1 = self.data.Close[-1] – slatr * TPSLRatio
                self.sell(sl=sl1, tp=tp1, size=self.mysize)

    bt = Backtest(dfstream, MyStrat, cash=100000, margin=0.01, commission=0.00055)
    stats, heatmap = bt.optimize(slcoef=[i/10 for i in range(10, 26)],
                                 TPSLRatio=[i/10 for i in range(10, 26)],
                                 maximize=’Return [%]’, max_tries=300,
                                 random_state=0,
                                 return_heatmap=True)
    print(stats)
   
    slatrcoef = stats[“_strategy”].slcoef
    TPSLRatio_coef = stats[“_strategy”].TPSLRatio
    print(f”{Symbol} SL = {slatrcoef}, TP = {TPSLRatio_coef}, expected return, {stats[‘Return [%]’]:.2f}% in {Interval} interval.\n”)
   
    with open(“fitting_data_file.txt”, “a”) as file:
        file.write(f”{Symbol} SL = {slatrcoef}, TP = {TPSLRatio_coef}, expected return, {stats[‘Return [%]’]:.2f}% in {Interval} interval.\n”)
    return slatrcoef, TPSLRatio_coef

def trading_job():
    dfstream = get_candles_frame(lookback)
    if dfstream is None:
        print(f”No {Symbol} candle data for trading job.”)
        return

    signal = total_signal(dfstream, len(dfstream) – 1, 7)



    # now = datetime.now()
    # if now.weekday() == 0 and now.hour < 7 and now.minute < 5:  # Monday before 07:05
    slatrcoef, TPSLRatio_coef = optimization()
    print(f”Optimize SL = {slatrcoef}, and TP = {TPSLRatio_coef}.”)

    slatr = slatrcoef * dfstream[‘ATR’].iloc[-1]
    TPSLRatio = TPSLRatio_coef
    max_spread = 16e-5

    last_candle = get_candles(Symbol, Interval, 1).iloc[-1]
    candle_open_bid = float(last_candle[‘Open’])
    candle_open_ask = candle_open_bid
    spread = candle_open_ask – candle_open_bid

    SLBuy = candle_open_bid – slatr – spread
    SLSell = candle_open_ask + slatr + spread

    TPBuy = candle_open_ask + slatr * TPSLRatio + spread
    TPSell = candle_open_bid – slatr * TPSLRatio – spread

    print(“SLBuy = “, SLBuy)
    print(“SLSell = “, SLSell)
    print(“TPBuy  = “, TPBuy )
    print(“TPSell = “, TPSell)
   
    # # Sell
    # if signal == -1 and count_opened_trades() == 0.0 and spread < max_spread:
    #     print(“Sell Signal Found…”)
    #     trade_crypto = c.TradeCrypto(EXCHANGE, Symbol, ‘sell’)
    #     message, MyTradePrice = trade_crypto.TradeQty(quantity)
    #     print(message)
    #     with open(“trading_data_file.txt”, “a”) as file:
    #         file.write(f”SL = {SLSell}, TP = {TPSell}, Trade Price = {MyTradePrice}\n”)

    # # Buy
    # elif signal == 1 and count_opened_trades() == 0.0 and spread < max_spread:
    #     print(“Buy Signal Found…”)
    #     trade_crypto = c.TradeCrypto(EXCHANGE, Symbol, ‘buy’)
    #     message, MyTradePrice = trade_crypto.TradeQty(quantity)
    #     print(message)
    #     with open(“trading_data_file.txt”, “a”) as file:
    #         file.write(f”SL = {SLBuy}, TP = {TPBuy}, Trade Price = {MyTradePrice}\n”)


if __name__ == “__main__”:
    optimization()

# scheduler = BlockingScheduler()
# scheduler.add_job(trading_job, ‘cron’, day_of_week=’mon-fri’, hour=’07-18′, minute=’1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56′, timezone=’Asia/Beirut’, misfire_grace_time=15)
# scheduler.start()

In 1993, Buffett spoke to Columbia University’s Business School graduates. Asked about his method for evaluating risk, he said, “Risk comes from not knowing what you’re doing.” This quote reflects Buffett’s investment philosophy, highlighting the crucial role of knowledge and understanding in reducing risk.

The biggest risk is not taking any risk… In a world that changing really quickly, the only strategy that is guaranteed to fail is not taking risks.” Mark Zuckerberg



Tips:

Despite of the crypto dump recently on all the alt coins after SEC announcement to sue Binance and Coinbase. Guess what? My Ai Trading Strategies are making shit ton of USDT from the crazy markets. Well there is a secret and cannot tell you unless…Anyway, I have given you the formula to copy and it is up to you to trade manually with stress and sleepless nights or ride on the trend of Ai trading today ⬇️⬇️⬇️


AI Sleeping Income With DGM System

The SECRET is to marry between Ai trading strategies and an income generated exchange platform

  • Ai trading strategies

  • An income generated exchange platform

How It Works?


BackTest Sharpe Ratio and Max Draw Down

DGM Sharp Ratio = 3.5

2024-05-14 09:01:09,378 – INFO – DGM Start Date and Time now is 2024-05-14 09:01:09.378769
2024-05-14 09:01:09,880 – INFO – All data downloaded successfully in GetDataRequest.
2024-05-14 09:01:09,993 – INFO – Exported FROM 2020-11-11 TO 2024-05-14 Data saved to DB.
2024-05-14 09:01:10,401 – INFO – File QuantTrending.csv has been successfully deleted.
2024-05-14 09:01:10,401 – INFO – >>*>> ETHUSDT-QuantSharpRatioMDD-1d.csv for Equity Curve.
2024-05-14 09:01:10,401 – INFO – BackTest Trade Message = None
2024-05-14 09:01:10,401 – INFO – BackTest Trade Price (Qty: 0.05) = 0
DGM Class Start Date and Time now is 2024-05-14 09:01:09.380486
START: 1d ETHUSDT OHLC-data from 2020-11-11 00:00:00 until 2024-05-14
Open Time Open High Low Close
0 2020-11-11 450.34 476.25 449.28 463.09
1 2020-11-12 463.09 470.00 451.20 462.39
2 2020-11-13 462.48 478.01 457.12 476.43
3 2020-11-14 476.42 477.47 452.00 460.89
4 2020-11-15 460.90 462.89 440.19 448.08
.. … … … … …
276 2024-05-10 3036.24 3053.89 2878.03 2909.99
277 2024-05-11 2909.98 2945.67 2886.46 2912.45
278 2024-05-12 2912.45 2955.20 2901.17 2929.29
279 2024-05-13 2929.30 2996.40 2864.76 2950.99
280 2024-05-14 2950.99 2958.76 2937.51 2944.75

[1281 rows x 5 columns]
END: v3/klines 1d ETHUSDT DB Processed.

START DB Processing: >>> Data from GetDataRequested table.
Mean Price: 2208.228266978923
Standard Deviation: 914.490172178236
v3/klines Upper Percentage Threshold: 4037.208611335395
v3/klines Lower Percentage Threshold: 379.2479226224509
Open Time High Low Close
0 2020-11-11 476.25 449.28 463.09
1 2020-11-12 470.00 451.20 462.39
2 2020-11-13 478.01 457.12 476.43
3 2020-11-14 477.47 452.00 460.89
4 2020-11-15 462.89 440.19 448.08
GetDataProcess Trade Message = None
GetDataProcess Trade Price (Qty: 0.05) = 0
GetDataProcess Data processed and saved to QuantTrending table.
END: v3/klines 1d ETHUSDT GetDataProcess Completed.

START DB Processing: >>> Data from QuantTrending table.
BackTestSharpRatioMDD: >>> Processed the file QuantTrending.csv.
Warning: NaN values detected in ‘Previous_Close’. Attempting to recalculate ‘Daily_PnL’.
Warning: NaN or Infinite values detected in ‘Daily_PnL’ after recomputation. Cleaning required.
Info: Previous_Close Close Daily_PnL Cumm_PnL
count 1280.000000 1280.000000 1280.000000 1280.000000
mean 2207.652859 2209.591656 0.014513 11.073642
std 914.972973 913.902063 0.038246 5.210313
min 448.080000 448.080000 -0.263329 0.000000
25% 1598.405000 1599.225000 -0.000000 7.088900
50% 1899.325000 1900.090000 -0.000000 12.360589
75% 2910.605000 2914.057500 0.031202 15.726248
max 4807.980000 4807.980000 0.277372 18.590075

*> DGM Sharp Ratio = 7.25
**> DGM Maximum Drawdown: 28.47%
***> DGM Peak Profit: 1859.01%
****> DGM Drawdown from Peak: 1.40%
*****>> Created ETHUSDT-QuantSharpRatioMDD-1d.csv for Equity Curve.

In 1993, Buffett spoke to Columbia University’s Business School graduates. Asked about his method for evaluating risk, he said, “Risk comes from not knowing what you’re doing.” This quote reflects Buffett’s investment philosophy, highlighting the crucial role of knowledge and understanding in reducing risk.

The biggest risk is not taking any risk… In a world that changing really quickly, the only strategy that is guaranteed to fail is not taking risks.” Mark Zuckerberg



Tips:

Despite of the crypto dump recently on all the alt coins after SEC announcement to sue Binance and Coinbase. Guess what? My Ai Trading Strategies are making shit ton of USDT from the crazy markets. Well there is a secret and cannot tell you unless…Anyway, I have given you the formula to copy and it is up to you to trade manually with stress and sleepless nights or ride on the trend of Ai trading today ⬇️⬇️⬇️


AI Sleeping Income With DGM System

The SECRET is to marry between Ai trading strategies and an income generated exchange platform

  • Ai trading strategies

  • An income generated exchange platform

How It Works?


AI Strategies To Become A Millionaire

https://dailygamemoments.com/traderdao
  • This is not a money game.
  • This is not a manual trading system,
  • This is not a trading system with charts and indicators.
  • This is not a paid solution, this is DGM sleeping solution.
  • This is not an investment program and it is a trading Ai strategy.
  • This is not coins staking nor yield farming or to provide liquidation.
  • This is not TradingView pine scripts trading or webhook complicated settings.
  • This is not financial advise and Do Your Own Research (DYOR). You need only 3 steps!
  • This is not limited to one crypto exchange that you can use. More than one that you can choose.
  • This is not a solution without DGM guidance. I will provide a guidance which cryptocurrencies to trade.
  • This is not MT4/MT5 or EA and has nothing to do with VPS or setup a mini-PC to automate your trades.

Step 1: Setup an Ai Trading System

Step 2: Setup A Trading Platform To Earn USDT When You Sleep

Step 3: Marry Them Both Together Forever

How can you do that?

  1. Create an application programming interface (API) with TraderDAO in Bybit exchange (Which is Step 2).
  2. Paste the API secret keys into the Ai Trading system app (Which is Step 1).
  3. Your job is done! You will make the passive income daily from Step 1 and also Step 2. One Trade Two Incomes!
Build An Ai Trading System That Make Money Daily

Identifying Key Structures & Liquidity Zones

Do you want to setup your Casino and start earning interest rates? Follow me to read on 

Harnessing the Power of AI for WordPress Publishing

How to Automatically Tweet (X) When You Publish a New Post in WordPress? Automate Site Guide 🤖

Tips:

The biggest risk is not taking any risk… In a world that changing really quickly, the only strategy that is guaranteed to fail is not taking risks.” Mark Zuckerberg ⬇️⬇️⬇️

JT's Cover Letter helps your online presence today.

CHWY Sell Put Options Again in March 2024


In 1993, Buffett spoke to Columbia University’s Business School graduates. Asked about his method for evaluating risk, he said, “Risk comes from not knowing what you’re doing.” This quote reflects Buffett’s investment philosophy, highlighting the crucial role of knowledge and understanding in reducing risk.



Tips:

The biggest risk is not taking any risk… In a world that changing really quickly, the only strategy that is guaranteed to fail is not taking risks.” Mark Zuckerberg ⬇️⬇️⬇️


Here To Trade Options From Experts With Best Wins And 100% FREE!!!

DGM Trading Options


Yahoo Finance with MARKOV Strategy

About DGM

In 1993, Buffett spoke to Columbia University’s Business School graduates. Asked about his method for evaluating risk, he said, “Risk comes from not knowing what you’re doing.” This quote reflects Buffett’s investment philosophy, highlighting the crucial role of knowledge and understanding in reducing risk.

The biggest risk is not taking any risk… In a world that changing really quickly, the only strategy that is guaranteed to fail is not taking risks.” Mark Zuckerberg



Tips:

Despite of the crypto dump recently on all the alt coins after SEC announcement to sue Binance and Coinbase. Guess what? My Ai Trading Strategies are making shit ton of USDT from the crazy markets. Well there is a secret and cannot tell you unless…Anyway, I have given you the formula to copy and it is up to you to trade manually with stress and sleepless nights or ride on the trend of Ai trading today ⬇️⬇️⬇️


AI Sleeping Income With DGM System

The SECRET is to marry between Ai trading strategies and an income generated exchange platform

  • Ai trading strategies

  • An income generated exchange platform

How It Works?


DGM-Sharp-Ratio-March 2024


About DGM
DGM Sharp Ratio = 3.5
DGM Sharp Ratio = 3.5

In 1993, Buffett spoke to Columbia University’s Business School graduates. Asked about his method for evaluating risk, he said, “Risk comes from not knowing what you’re doing.” This quote reflects Buffett’s investment philosophy, highlighting the crucial role of knowledge and understanding in reducing risk.

The biggest risk is not taking any risk… In a world that changing really quickly, the only strategy that is guaranteed to fail is not taking risks.” Mark Zuckerberg



Tips:

Despite of the crypto dump recently on all the alt coins after SEC announcement to sue Binance and Coinbase. Guess what? My Ai Trading Strategies are making shit ton of USDT from the crazy markets. Well there is a secret and cannot tell you unless…Anyway, I have given you the formula to copy and it is up to you to trade manually with stress and sleepless nights or ride on the trend of Ai trading today ⬇️⬇️⬇️


AI Sleeping Income With DGM System

The SECRET is to marry between Ai trading strategies and an income generated exchange platform

  • Ai trading strategies

  • An income generated exchange platform

How It Works?


Apocalypse Sprinter Van Build Ready for ZOMBIES


About DGM


Tips:

Despite of the crypto dump recently on all the alt coins after SEC announcement to sue Binance and Coinbase. Guess what? My Ai Trading Strategies are making shit ton of USDT from the crazy markets. Well there is a secret and cannot tell you unless…Anyway, I have given you the formula to copy and it is up to you to trade manually with stress and sleepless nights or ride on the trend of Ai trading today ⬇️⬇️⬇️


AI Sleeping Income With DGM System

The SECRET is to marry between Ai trading strategies and an income generated exchange platform

  • Ai trading strategies

  • An income generated exchange platform

How It Works?