Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
syntax:bitmex [2020/05/12 05:35]
profitview
syntax:bitmex [2022/08/09 07:03]
profitview
Line 9: Line 9:
 ### BitMEX Long/Short ### ### BitMEX Long/Short ###
  
-If necessary uncomment the following line to set exchange & symbol+Uncomment this to set exchange & symbol ​(if different from your chart/​alert!)
 #​exchange=bitmex-testnet symbol=xbtusd #​exchange=bitmex-testnet symbol=xbtusd
  
-Optionally ​for multi accounts ​uncomment the following ​and fill in your accounts+Uncomment this for multi accounts ​(and fill in your accounts)
 #​parallel=acc1,​acc2,​acc3 #​parallel=acc1,​acc2,​acc3
  
-Optionally ignore ​this alert if ANY position is already open +Uncomment ​this to skip entry if ANY position is already open 
-#check=position ​iffound=abort+#check=pos iffound=abort
  
 # Close open positions on the opposite side at market # Close open positions on the opposite side at market
 # ..if no matching position is found, skip the delay and jump to main order # ..if no matching position is found, skip the delay and jump to main order
-close=position ​side=[!side] type=market ifnone=main+close=pos side=[!side] type=market ifnone=main
 # Give closing order time to execute # Give closing order time to execute
-delay=5+delay=3
  
 # Place main position order at market # Place main position order at market
Line 35: Line 35:
  
 # Add market stop loss order # Add market stop loss order
-return ​1        : Expect to place an order (needed in case main order takes longer to fill)+expect ​1        : Expect to place an order (needed in case main order takes longer to fill)
 # error closeside : If we cannot place SL, cancel orders, close position & abort # error closeside : If we cannot place SL, cancel orders, close position & abort
-close=position ​side=[side] stoploss=[-]YOUR_STOP_LOSS% type=market ​return=1 error=closeside retries=10 id=SL ~~codedoc:​clean:#​notify=discord:"​`SL at   \z` {stoppx}"~~+close=pos side=[side] stoploss=[-]YOUR_STOP_LOSS% type=market ​expect=1 error=closeside retries=10 id=SL ~~codedoc:​clean:#​notify=discord:"​`SL at   \z` {stop}"~~
  
-# Add limit take profit ​order +# Add limit take profit (reduce/​close onlyorder 
-(see above for other parameters+close=pos side=[side] takeprofit=[+]0.5% price=[+]YOUR_TAKE_PROFIT% ​expect=1 error=closeside retries=10 id=TP ~~codedoc:​clean:#​notify=discord:"​`TP at   \z` {price}"​~~
-close=position ​side=[side] takeprofit=0% price=[+]YOUR_TAKE_PROFIT% ​return=1 error=closeside retries=10 id=TP ~~codedoc:​clean:#​notify=discord:"​`TP at   \z` {price}"​~~+
 </​codedoc>​ </​codedoc>​
 ''​Quantity,​ leverage, stoploss and takeprofit have to be adjusted to your strategy / personal needs!''​ ''​Quantity,​ leverage, stoploss and takeprofit have to be adjusted to your strategy / personal needs!''​
 +
 +**Note:** For take profit a **TP limit closing-order stop** is used in the syntax above which is placed without a quantity. This has the advantage of being exempt from "load shedding"​ on BitMEX as well as always closing the whole position, even if something was added to the position after the first entry.
 +But for a limit closing-order to not fill immediately it has to be placed as a stop order with a trigger price — thus the ''​takeprofit=[+]0.5%''​ which is the offset from your calculated TP price where the stop will trigger. (adjust if necessary; be aware that if the trigger price is set to 0 or omitted to use the current price, the stop will sometimes not trigger at all!)
 </​panel>​ </​panel>​