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?


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?


Why Bitcoin, Ethereum, and Dogecoin Are All Down Big Last November 11,2021

After weeks of almost continuous good news for the cryptocurrency industry, we are seeing a widespread sell-off today. Big cryptocurrencies are down, altcoins are down, and even meme coins are having a rough day. In the last 24 hours, Bitcoin (CRYPTO:BTC) is down 5%, Ethereum (CRYPTO:ETH) is down 1.3% after being down as much as 8%, and Dogecoin (CRYPTO:DOGE) has fallen 2.4% as of 1 p.m. EST. Very few cryptocurrencies are trading higher today and some are down nearly 10% in the last 24 hours. Higher inflation in theory will lead to higher interest rates and investors looking for ways to hedge inflation and higher rates. As a store of value, Bitcoin, in particular, wasseen as a potential place for investors to put money if inflation picks up. That’s why it was up yesterday, but the trend has reversed course today. 

Cryptocurrencies have been on a quick run higher over the past month. Bitcoin and Ethereum, in particular, are up over 20% and a pullback is natural at this point. It could simply be that big investors are taking some chips off the table today. 

Which Cryptocurrency is the best way to invest in and why?

For my opinion, Bitcoin is one of the biggest cryptocurrency that had been used for past years. Bitcoin’s recent surge was the result of a few catalysts, not least of which was the launch of the first Bitcoin-focused exchange-traded fund in the U.S. The Proshares Bitcoin Strategy ETF (ticker: BITO) began trading Oct. 19, with excitement over the continued mainstreaming of the digital asset driving BTC to an all-time high of $66,930 just a day later. Bitcoin’s invention in 2009 changed money forever and opened the door to blockchain-based, decentralized currencies not issued by any nation. Bitcoin’s first-mover status, its hard limit on a maximum circulation of 21 million BTC and its potential to become a store of value on the balance sheets of corporate America – a future which Tesla Inc. (TSLA) first hinted at with a $1.5 billion Bitcoin purchase announced in February.

Fed Chair Jerome Powell on interest rate decision after FOMC meeting

Fed Chair Jerome Powell on interest rate decision after FOMC meeting

The latest announcement yesterday that 75 points have been added, the interest is already 2.5%. There are still 2 meetings before the end of the year, that is, the next 2 meetings are mainly about 50 points in September and 50 points in December [total 3.5%], there is even a chance to add 25 points each, a total of 3%.

Fed Chairman Powell: We want to achieve a moderate level of tightening by the end of this year, that is, interest rates in the 3%-3.5% range.

Fed Chair Jerome Powell on interest rate decision after FOMC meeting the BTC/USDT shoot up from 21k to 23k.

Stock CFD Trading Journal No 17 – Daily Game Moments. Everyday Trading For Profits

January 3, 2021 at 03:36PM

🎮 Daily Game Moments
🔒 | SSL Encrypted Checkout
⬇️⬇️⬇️ ACTION MORE 🕹️

My Account

Our website is DailyGameMoments.com and we are passionate with trades daily especially a platform for all traders to share their passionate trades everyday!

Be an Author Of Your YouTube. How to Be a Blog Author Of Your YouTube?
As the name suggests, you with the author role can write, edit, and publish your own game posts. You can also delete your own posts, even if they are published.

When writing posts, authors cannot create categories however you can choose from existing categories. On the other hand, you can add tags to the posts. Any additional categories are required, please contact us.

Authors can view comments even those that are pending review, but you cannot moderate, approve, or delete any comments. Happy posting!

The DAILY Games

Stock CFD Trading Journal No 16 – Daily Game Moments. Everyday Trading For Profits

Stock CFD Trading Journal No 16

December 23, 2020 at 02:51PM

🎮 Daily Game Moments
🔒 | SSL Encrypted Checkout
⬇️⬇️⬇️ ACTION MORE 🕹️
https://dailygamemoments.com/my-account/

Our website is DailyGameMoments.com and we are passionate with trades daily especially a platform for all traders to share their passionate trades everyday!

Be an Author Of Your YouTube. How to Be a Blog Author Of Your YouTube?
As the name suggests, you with the author role can write, edit, and publish your own game posts. You can also delete your own posts, even if they are published.

When writing posts, authors cannot create categories however you can choose from existing categories. On the other hand, you can add tags to the posts. Any additional categories are required, please contact us.

Authors can view comments even those that are pending review, but you cannot moderate, approve, or delete any comments. Happy posting!

The DAILY Games