Wait for the price to fall and then rise by 1 unit.
Or enter immediately if the price rises by 1 unit without falling. Does current tradelogic follows this for both or not tell me for buy side and sell side ( 
package com.lazy.rechargeservice.core.service;

import android.util.Log;

class TradeLogic(private val tapSequenceManager: TapSequenceManager, private val taskService: TaskService) {
    var tradeSide: TradeSide = TradeSide.BUY
    private var isInTrade = false
    private var initialPrice: Double? = null  // Store the initial price when starting to monitor
    private var entryPrice: Double? = null
    private var peakPrice: Double? = null
    private var bottomPrice: Double? = null
    private val priceEvaluator = PriceEvaluator()


    fun executeTradeLogic(currentPrice: Double) {
        val priceWithoutLastDecimal = priceEvaluator.ignoreLastDecimal(currentPrice)

        if (initialPrice == null) {
            initialPrice = priceWithoutLastDecimal
        }

        Log.d("TradeLogic", "Current Price (Ignoring Last Decimal): $priceWithoutLastDecimal, Initial Price: $initialPrice, Entry Price: $entryPrice, Peak Price: $peakPrice, Bottom Price: $bottomPrice")

        when (tradeSide) {
            TradeSide.BUY -> {
                if (!isInTrade) {
                    // Entry conditions for BUY
                    if (priceWithoutLastDecimal >= initialPrice!! + 1) { // Price increased by 1
                        Log.d("TradeLogic", "Entering Buy Trade (Price Rise): $priceWithoutLastDecimal")
                        enterTrade(priceWithoutLastDecimal)
                    } 
                } else {
                    peakPrice = maxOf(peakPrice!!, priceWithoutLastDecimal)
                    if (priceWithoutLastDecimal <= peakPrice!! - 1) {
                        Log.d("TradeLogic", "Exiting Buy Trade at: $priceWithoutLastDecimal (-1 from peak: $peakPrice)")
                        tapSequenceManager.performBuyExitSequence()
                        resetTradeState()
                    }
                }
            }

            TradeSide.SELL -> {
                if (!isInTrade) {
                   // Entry conditions for SELL
                    if (priceWithoutLastDecimal <= initialPrice!! - 1) { // Price decreased by 1
                        Log.d("TradeLogic", "Entering Sell Trade (Price Fall): $priceWithoutLastDecimal")
                        enterTrade(priceWithoutLastDecimal)
                    }
                } else {
                    bottomPrice = minOf(bottomPrice!!, priceWithoutLastDecimal)
                    if (priceWithoutLastDecimal >= bottomPrice!! + 1) {
                        Log.d("TradeLogic", "Exiting Sell Trade at: $priceWithoutLastDecimal (+1 from bottom: $bottomPrice)")
                        tapSequenceManager.performSellExitSequence()
                        resetTradeState()
                    }
                }
            }
        }
    }

    private fun enterTrade(price: Double) {
        when (tradeSide) {
            TradeSide.BUY -> tapSequenceManager.performBuyEntrySequence()
            TradeSide.SELL -> tapSequenceManager.performSellEntrySequence()
        }
        isInTrade = true
        entryPrice = price
        peakPrice = price // Initialize peak/bottom for tracking
        bottomPrice = price
        initialPrice = null // Reset initial price so it's recalculated on the next trade
    }

    fun resetTradeState() {
        isInTrade = false
        initialPrice = null
        entryPrice = null
        peakPrice = null
        bottomPrice = null
        Log.d("TradeLogic", "Trade state reset")
    }
}

enum class TradeSide {
    BUY, SELL
}