# Example Usage params = calculate_grid_params( total_investment=1000, price_range_low=25000, price_range_high=30000, grid_profit_pct=0.5 # 0.5% profit per grid )
This allows your SBot to ride the trend upwards but automatically sells if the price drops by a set percentage from its peak, protecting profits without needing to predict the exact top. sbot trade script
// Conditions longCondition = ta.crossover(rsiValue, overSold) shortCondition = ta.crossunder(rsiValue, overBought) Unlike a discretionary trader who relies on sentiment
def calculate_grid_params(total_investment, price_range_low, price_range_high, grid_profit_pct): """ Calculates grid parameters for a bot like SBot. """ total_range = price_range_high - price_range_low overSold) shortCondition = ta.crossunder(rsiValue
At its core, an SBOT trade script is a deterministic set of instructions executed by a trading bot. Unlike a discretionary trader who relies on sentiment and news, the script operates purely on quantifiable data. A typical script follows a four-phase cycle:
# Calculate step based on desired profit per grid (approx) # Formula: Step = Profit % / (1 + Profit %) -- simplified price_step = total_range * (grid_profit_pct / 100)
StopLossPrice = HighestPrice * (1 - TrailingStopPercent / 100)