node-binance-api icon indicating copy to clipboard operation
node-binance-api copied to clipboard

How to use trailing stop?

Open Naografix opened this issue 3 years ago • 2 comments

Hello,

I'm looking how to use TRAILING STOP for my bot. Currently, every 10s, I'm canceling my STOP LOSS, calculating the new value, and send a new STOP LOSS to Binance. It's not super safe and I saw TRAILING STOP is available in this node package... But how can I use it?

Process: I want to buy Bitcoin AT market and set a trailing stop loss at 3%. Every price move, my stop loss is re-setted (a trailing stop) at -3% of the last price

Thanks!

Naografix avatar Apr 28 '21 11:04 Naografix

I need to do this like this?

let trailingStopLoss = await user.binance.futuresOrder("SELL", pair, user.quantityBought, false,
        {
            type: "TRAILING_STOP_MARKET",
            callbackRate: user.stopLossInPercent,
            reduceOnly: true
        }
    );

Naografix avatar Apr 28 '21 12:04 Naografix

yes, something like this I think:

    let result = await binance.futuresOrder('SELL', 'BTCUSDT', 0.1, null, {
      type: "TRAILING_STOP_MARKET",
      callbackRate: 2,
    });

elyas74 avatar May 10 '21 15:05 elyas74