Simple Market Maker
stableDescription
-- ONLY FOR BINANCE FUTURES USDT/COIN HEDGE MODE ENABLED
HaasScript
Log('Update 4')
EnableHighSpeedUpdates(true)
HideOrderSettings()
HideTradeAmountSettings()
-- Check BYBIT or BINANCE
local getMarket = PriceMarket()
local isBybit = StringContains(getMarket, 'BYBIT')
-- inputs
InputGroupHeader('Trade Settings')
local okLong = Input('01. Allow Long', false, 'Allow bot to open Long')
local okShort = Input('02. Allow Short', false, 'Allow bot to open Short')
local wtfStop = Input('03. Stop at no position', false, 'Deactivate bot when there is no open position')
InputGroupHeader('Backtest Settings')
local wtfBal = Input('01. Deactivate on Over Budget', false, 'Deactivate when Bal Ratio hit 1')
local wtfRatio = Input('02. Deactivate on specific Bal Ratio', false, 'Deactivate when Bal Ratio hit trigger below')
local wtfRatioV = Input('02A. Bal Ratio Trigger', 0.5)
local wtfAmount = Input('03. Deactivate on Over Size', false, 'Deactivate when one of position size > Max Open')
local compound = Input('04. Add profit into balance', false, 'ONLY FOR BACKTEST. DO NOT USE WHEN ON RUNNING BOT')
local testWallet = Input('05. Use Custom Wallet', false, 'ONLY FOR BACKTEST. DO NOT USE WHEN ON RUNNING BOT')
local testBal = Input('05A. Custom Wallet Balance', 10000, 'ONLY FOR BACKTEST. DO NOT USE WHEN ON RUNNING BOT')
InputGroupHeader('Budget & Safety')
local maxSizeM = Input('01. Max. Open '..AmountLabel(), 99999, 'Maximum open contracts at any given time also as minimum for Dynamic Max Open. After exceeding this value, the bot will dump a portion of position at a loss.')
local autoMax = Input('01A. Dynamic Max Open', true, 'Dynamically change max open contracts based on available balanca')
local leverage = Input('01B. Leverage', 50, 'MUST be filled even if using Cross Margin. Important for trading budget.')
local contVal = Input('01C. COIN-M Value', 10, 'ONLY if bot trading on INVERSE Futures then enter the Contract Value. Ignore if trade on USDT')
local maxBudget = Input('01D. Balance Budget', 0.8, 'How much from wallet balance allocated for this bot. 0.5 is 50% of wallet balance.')
local maxOpen = Input('01E. Position Budget', 0.1, 'How much from the Balance Budget allocated for opening positions. 0.1 is 10% of Balance Budget')
local reduceSize = Input('02. Size Reduction %', 21, 'How big of a portion the bot will dump once Max. Open Contracts is exceeded')
local reduceOrderType = InputOrderType('03. Reduction Order Type', MarketOrderType, 'The order type for size reduction dump')
local noReduce = Input('04. Disable Size Reduction', false, 'Are you sure?')
InputGroupHeader('Grid Settings')
local slotCount = Input('01. Slot Count', 1, 'How many orders are constantly kept open on both long and short side')
local slotSizeM = Input('02. Slot Size', 0.001, 'Trade amount per slot')
local autoSlot = Input('03A. Dynamic Slot Size', true, 'DSSize - Dynamically change slot size favoring trending side.')
local slotBudget = Input('03B. Max. Open Divider', 377, 'DSSize feature - Divide max open position with this value to get new Slot Size. Example Max Open is 1000 and devider is 200 then slot size is 5')
local slotSpread = Input('04. Slot Spread %', 0.618, 'Percentage based spread value between each slot')
local slotCancel = Input('05. Cancel Distance %', 0.236, 'How much price can move to the opposite direction before orders are cancelled and replaced')
local minSpread = Input('06. Minimum Spread %', 0.236, 'Minimum spread percentage between the first long and short entries. This setting only works when bot has no position.')
InputGroupHeader('Profit Settings')
local takeProfitL = Input('01. LONG Take-Profit %', 0.236, 'Fixed take-profit value, based on price change')
local takeProfitS = Input('02. SHORT Take-Profit %', 0.236, 'Fixed take-profit value, based on price change')
local tpOrderType = InputOrderType('03. TP Order Type', MakerOrCancelOrderType, 'The order type for take-profit')
local preplacedTP = Input('04. Pre-Place TP', false, 'Place Exit Position as soon as has open position')
--
minSpread = minSpread / 2.0
local SRCounter = Load('SRCounter', 0)
-- price and data
local cp = CurrentPrice()
local c = ClosePrices()
-- positions
local hedge_longPosId = Load('hedge_longPosId', NewGuid())
local hedge_shortPosId = Load('hedge_shortPosId', NewGuid())
local dir_l = GetPos
0 Comments
Sign in to leave a comment.
No comments yet. Be the first!