~~Title: BitMEX Syntax (BTC)~~
==== Standard Entry Syntax for BitMEX:XBTUSD.P ====
__Note:__ The following syntax works with the **default entry** alert messages that OCC comes with!
\\
They contain everything necessary to transport the configured (or calculated) quantity, leverage and SL/TP from OCC into PV and place all the orders/stops accordingly.
\\
=== ETHUSD / LTCUSD ===
➤ Click here for [[occ-indicator:bitmex-syntax-eth|ETHUSD Entry Syntax]]! ➤ Click here for [[occ-indicator:bitmex-syntax-ltc|LTCUSD Entry Syntax]]!
\\
**Market Entry with Limit + Market SL** – will __flip positions__ only when opened __by the same strategy__ previously! (useful for multiple layers)
#~~codedoc:clean: fill in your accounts here if necessary~~
#parallel=acc1,acc2,acc3
#~~codedoc:clean: remove wrongside=abort in the next line if you want to add to an already open position (pyramiding)~~
#~~codedoc:clean: optionally replace [id] in the next line with a list of alert names you want to allow being flipped eg. id=XH1,XH2~~
#~~codedoc:clean: (otherwise it will only flip it's own positions!)~~
marketclose=[!side] nopos=entry wrongside=abort checkid=[id] wrongid=abort
delay=3s
:entry
cancel
[side] market error=abort retries=2 time=30% leverage=_l quantity=_q% notify=discord:1
delay=3s
close=[side] stoploss=_sl[-]1.0 price=_sl id=[id]-LSL expect=1 notify=discord:~~codedoc:clean:"`LSL: \z` {stop} / {price}"~~
close=[side] stoploss=_sl[-]0.15% market id=[id]-MSL expect=1 notify=discord:~~codedoc:clean:"`MSL: \z` {stop}"~~
close=[side] takeprofit=_tp[-]0.33% price=_tp id=[id]-TP expect=1 notify=discord:~~codedoc:clean:"`TP: \z` {stop} / {price}"~~
\\
**Limit Entry with Limit + Market SL** – will __flip positions__ only when opened __by the same strategy__ previously! (useful for multiple layers)
#~~codedoc:clean: fill in your accounts here if necessary~~
#parallel=acc1,acc2,acc3
#~~codedoc:clean: remove wrongside=abort in the next line if you want to add to an already open position (pyramiding)~~
#~~codedoc:clean: optionally replace [id] in the next line with a list of alert names you want to allow being flipped eg. id=XH1,XH2~~
#~~codedoc:clean: (otherwise it will only flip it's own positions!)~~
marketclose=[!side] nopos=entry wrongside=abort checkid=[id] wrongid=abort
delay=3s
:entry
cancel
cached
#~~codedoc:clean: optionally uncomment / adjust maxslip in the following line~~
update #maxslip=0.15% maxslipref=close ifslip=abort
[side] retries=2 price=[-]1.0 leverage=_l quantity=_q% save id=[id]-ENTRY notify=discord:1 error=abort
[!side] stoploss=_sl[-]1.0 price=_sl quantity=lastqty@ reduce id=[id]-LSL notify=discord:~~codedoc:clean:"`LSL: \z` {stop} / {price}"~~
[!side] stoploss=_sl[-]0.15% market quantity=lastqty@ reduce id=[id]-MSL notify=discord:~~codedoc:clean:"`MSL: \z` {stop}"~~
[!side] takeprofit=_tp[-]0.33% price=_tp quantity=lastqty@ reduce id=[id]-TP notify=discord:~~codedoc:clean:"`TP: \z` {stop} / {price}"~~
#~~codedoc:clean: adjust delay to strategy / timeframe if necessary~~
delay=1.5m
cancel id=[id]-ENTRY
ifnopos=cancelall
notify=discord:~~codedoc:clean:"Filled!"~~
\\
**Market Entry with Limit + Market SL** – will __flip position regardless of who opened it__!
#~~codedoc:clean: fill in your accounts here if necessary~~
#parallel=acc1,acc2,acc3
#~~codedoc:clean: remove wrongside=abort in the next line if you want to add to an already open position (pyramiding)~~
marketclose=[!side] nopos=entry wrongside=abort
delay=3s
:entry
cancel
[side] market error=abort retries=2 time=30% leverage=_l quantity=_q% notify=discord:1
delay=3s
close=[side] stoploss=_sl[-]1.0 price=_sl id=[id]-LSL expect=1 notify=discord:~~codedoc:clean:"`LSL: \z` {stop} / {price}"~~
close=[side] stoploss=_sl[-]0.15% market id=[id]-MSL expect=1 notify=discord:~~codedoc:clean:"`MSL: \z` {stop}"~~
close=[side] takeprofit=_tp[-]0.33% price=_tp id=[id]-TP expect=1 notify=discord:~~codedoc:clean:"`TP: \z` {stop} / {price}"~~
\\
**Market Entry with Limit + Market SL** – will __abort if a position is already open__!
# fill in your accounts here if necessary
#parallel=acc1,acc2,acc3
ifpos=abort
cancel
[side] market error=abort retries=2 time=30% leverage=_l quantity=_q% notify=discord:1
delay=3s
close=[side] stoploss=_sl[-]1.0 price=_sl id=[id]-LSL expect=1 notify=discord:~~codedoc:clean:"`LSL: \z` {stop} / {price}"~~
close=[side] stoploss=_sl[-]0.15% market id=[id]-MSL expect=1 notify=discord:~~codedoc:clean:"`MSL: \z` {stop}"~~
close=[side] takeprofit=_tp[-]0.33% price=_tp id=[id]-TP expect=1 notify=discord:~~codedoc:clean:"`TP: \z` {stop} / {price}"~~