Documentation

Getting started

Aleeert.com is online-service which gives ability to connect TradingView with Binance and convert TradingView alerts to orders on cryptocurrency exchange.

For start using needed:

  • TradingView account
  • Binance API keys
  • Aleeert user key

Binance API keys

Go to Binance > Settings > API Management

  1. Create API key
  2. Enable Spot & Futures
  3. Add trusted IP addresses

Aleeert user key

Go to Dashboard and create user key

Setup

Create a new slot: select a market, paste your API keys and encrypt it by using your custom Aleeert key. This step completes the setup process.

Each slot is associated with a selected market (spot, futures, etc.). The slot is a pointer to the market where orders will be placed, and, at the same time, it is an encrypted storage for the API key. One slot is enough to trade all pairs on the selected market

Trading command

The trading command is a text string with several parameters. Using this command, the trader places and manages orders. This command must be used in the message area when creating alerts in TradingView

Supported markets:

  1. Binance Spot

BUY examples | Spot

Buy 0.1 BTC at fixed price (limit order)

				
					BTCUSDT, buy, 0.1, 21900, slot-id, userkey
				
			

Buy BTC by using 10% of USDT balance, at the market price

				
					BTCUSDT, buy, 10%, market, slot-id, userkey
				
			

Buy BTC by using 500 USDT, at the market price

				
					BTCUSDT, buy, $500, market, slot-id, userkey
				
			

Buy EOS by using 2 ETH, at the market price

				
					EOSETH, buy, $2, market, slot-id, userkey
				
			

SELL examples | Spot

Sell 0.1 BTC at the fixed price (limit order)

				
					BTCUSDT, sell, 0.1, 20900, slot-id, userkey
				
			

Sell 100% of BTC balance, at the market price

				
					BTCUSDT, sell, 100%, market, slot-id, userkey
				
			

Sell some amount of BTC equal to 500 USDT

				
					BTCUSDT, sell, $500, market, slot-id, userkey
				
			

Stop Limit | Spot

If the price reaches 21900, then 0.1 BTC will be bought at 21800 (limit order)

				
					BTCUSDT, buy, 0.1, 21900:21800(S), slot-id, userkey
				
			

OCO | Spot

The current price is 20000. If the price reaches 18500, then 0.1 BTC will be bought at 18500 (limit order). Also, if the price reaches 21900, then 0.1 BTC will be bought at 21950 or lower.

				
					BTCUSDT, buy, 0.1, 18500:21900:21950(OCO), slot-id, userkey
				
			

Trailing Stop | Spot

When the price reaches 20000 USDT the order will be activated. If the price increases by 1.0% from the lowest price, a limit order buying 0.1 BTC at 18500 USDT will be submitted to the order book

				
					BTCUSDT, buy, 0.1, 20000:1%:18500(TS), slot-id, userkey
				
			

The order will be activated with last price immediately. If the price increases by 1.0% from the lowest price, a limit order buying 0.1 BTC at 18500 USDT will be submitted to the order book

				
					BTCUSDT, buy, 0.1, -:1%:18500(TS), slot-id, userkey
				
			

Post Only | Spot

Add a Limit order to the order book as a liquidity-creating order (Maker order)

				
					BTCUSDT, buy, 0.1, 20000(P), slot-id, userkey
				
			

Close | Spot

Sell 50% of available BTC, if any

				
					BTCUSDT, close, 50%, -, slot-id, userkey
				
			

Cancel | Spot

Cancel all limit orders (associated with the pair) if any exist

				
					BTCUSDT, cancel, -, -, slot-id, userkey
				
			

Cancel all limit orders (associated with the pair) and send Buy order

				
					BTCUSDT, cancel-buy, 0.1, market, slot-id, userkey
				
			

Take Profit / Stop Loss | Spot

Buy BTC by using 500 USDT (at the market price) and set Take Profit level at 21900, and Stop Loss equal to 1% (OCO order will be used as TP/SL). Price calculation allowed

				
					BTCUSDT, buy, $500, market | 21900 | 1%, slot-id, userkey
				
			

Sell 100% of BTC balance (at the market price) and buy same quantity back if price drops by 10%, or rises by 1% (OCO order will be used). Price calculation allowed

				
					BTCUSDT, sell, 100%, market | 10% | 1%, slot-id, userkey
				
			

Calculations | Spot

Place Buy order below the current price by 9.5 USDT

				
					BTCUSDT, buy, 100%, {{close}}-9.5, slot-id, userkey
				
			

Place Sell order above the current price by 1%

				
					BTCUSDT, sell, 100%, {{close}}+1%, slot-id, userkey
				
			

If buy, then the order price will be 1% lower

				
					BTCUSDT, {{strategy.order.action}}, 100%, {{close}}+-1%, slot-id, userkey
				
			

If buy, then the order price will be 1% higher

				
					BTCUSDT, {{strategy.order.action}}, 100%, {{close}}-+1%, slot-id, userkey
				
			

For strategies | Spot

Using single alert in TradingView strategies

  • Buy/Sell by using 100% of balance (at the market price)
  • Side of position will be determined by strategy
				
					BTCUSDT, {{strategy.order.action}}, 100%, market, slot-id, userkey
				
			

More examples | Spot

Multiple commands in one alert (up to 5)

				
					BTCUSDT, buy, 0.1, market, slot-id, userkey;
ETHUSDT, buy, 3.5, market, slot-id, userkey
				
			

Add a short comment to the command. Only latin letters and numbers are allowed

				
					BTCUSDT, buy, 100%, market, slot-id, userkey, Short comment goes here
				
			

Delay before starting command execution (up to 30 seconds). If several commands with a delay parameter are received simultaneously, the total delay time should not exceed 30 seconds.

				
					delay(5): BTCUSDT, buy, 100%, market, slot-id, userkey
				
			

Supported markets:

  1. Binance USDⓈ-M Futures

LONG examples | Futures

Buy 0.1 BTC at the fixed price (limit order)

One-wayHedge
				
					BTCUSDT, buy, 0.1, 21900, slot-id, userkey
				
			

If the current position is Long -or- there is no current position, then 0.1 BTC will be bought at 21900. But if the current position is Short, then the size of such position will be reduced by 0.1 BTC

				
					BTCUSDT, openlong, 0.1, 21900, slot-id, userkey
BTCUSDT, closelong, 0.1, 21900, slot-id, userkey
				
			

Ex. 1: Increase the Long position by 0.1 BTC at 21900
Ex. 2: Reduce the current Long position by 0.1 BTC at 21900

Buy BTC for 10% of USDT balance at the market price

One-wayHedge
				
					BTCUSDT, buy, 10%, market, slot-id, userkey
				
			

If the current position is Long -or- there is no current position, then BTC will be bought at the market price for 10% of USDT balance. But if the current position is Short, then the size of such position will be reduced by 10%

				
					BTCUSDT, openlong, 10%, market, slot-id, userkey
BTCUSDT, closelong, 10%, market, slot-id, userkey
				
			

Ex. 1: Increase the Long position at the market price by using 10% of USDT balance
Ex. 2: Reduce the current Long position by 10% at the market price

Buy BTC by using 500 USDT at the market price

One-wayHedge
				
					BTCUSDT, buy, $500, market, slot-id, userkey
				
			

If the current position is Long -or- there is no current position, then BTC will be bought at the market price by using 500 USDT. But if the current position is Short, then the size of such position will be reduced by amount equal to 500 USDT

				
					BTCUSDT, openlong, $500, market, slot-id, userkey
BTCUSDT, closelong, $500, market, slot-id, userkey
				
			

Ex. 1: Increase the Long position at the market price by using 500 USDT
Ex. 2: Reduce the current Long position by 500 USDT, at the market price

SHORT examples | Futures

Sell 0.1 BTC at fixed price (limit order)

One-wayHedge
				
					BTCUSDT, sell, 0.1, 20900, slot-id, userkey
				
			

If the current position is Short -or- there is no current position, then BTC will be sold at 20900. But if the current position is Long, then the size of such position will be reduced by 0.1 BTC

				
					BTCUSDT, openshort, 0.1, market, slot-id, userkey
BTCUSDT, closeshort, 0.1, market, slot-id, userkey
				
			

Ex. 1: Increase the Short position by 0.1 BTC at 21900
Ex. 2: Reduce the current Short position by 0.1 BTC at 21900

Sell BTC for 10% of USDT balance (at market price)

One-wayHedge
				
					BTCUSDT, sell, 10%, market, slot-id, userkey
				
			

If the current position is Short -or- there is no current position, then BTC will be sold at the market price for 10% of USDT balance. But if the current position is Long, then the size of such position will be reduced by 10%

				
					BTCUSDT, openshort, 10%, market, slot-id, userkey
BTCUSDT, closeshort, 10%, market, slot-id, userkey
				
			

Ex. 1: Increase the Short position at the market price by using 10% of USDT balance
Ex. 2: Reduce the current Short position by 10%, at the market price

Sell BTC using 500 USDT (at the market price)

One-wayHedge
				
					BTCUSDT, sell, $500, market, slot-id, userkey
				
			

If the current position is Short -or- there is no current position, then BTC will be sold at the market price by using 500 USDT. But if the current position is Long, then the size of such position will be reduced by an amount equal to 500 USDT

				
					BTCUSDT, openshort, $500, market, slot-id, userkey
BTCUSDT, closeshort, $500, market, slot-id, userkey
				
			

Ex. 1: Increase Short position at the market price by using 500 USDT
Ex. 2: Reduce current Short position by 500 USDT at the market price

Stop Limit | Futures

Unlike other orders, the Stop Limit order size is calculated based on the balance, regardless of the current position.

If the price reaches 21900, then 0.1 BTC will be bought at 21800

One-wayHedge
				
					BTCUSDT, buy, 0.1, 21900:21800(S), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, 21900:21800(S), slot-id, userkey
				
			

Same as above, plus TP 5% and SL 1%.
Or SL only (ex. 2)

One-wayHedge
				
					BTCUSDT, buy, 0.1, 21900:21800(S) | 5% | 1%, slot-id, userkey
BTCUSDT, buy, 0.1, 21900:21800(S) | - | 1%, slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, 21900:21800(S) | 5% | 1%, slot-id, userkey
BTCUSDT, openlong, 0.1, 21900:21800(S) | - | 1%, slot-id, userkey
				
			

Place an order with the Stop price 1% above the current price and the Limit price at the current price

One-wayHedge
				
					BTCUSDT, buy, 0.1, {{close}}+1%:{{close}}(S), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, {{close}}+1%:{{close}}(S), slot-id, userkey
				
			

Stop Market | Futures

If the price reaches 21900, then 0.1 BTC will be bought at the market price

One-wayHedge
				
					BTCUSDT, buy, 0.1, 21900(SM), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, 21900(SM), slot-id, userkey
				
			

Same as above, plus TP 5% and SL 1%.
Or SL only (ex. 2)

One-wayHedge
				
					BTCUSDT, buy, 0.1, 21900(SM)|5%|1%, slot-id, userkey
BTCUSDT, buy, 0.1, 21900(SM)|-|1%, slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, 21900(SM)|5%|1%, slot-id, userkey
BTCUSDT, openlong, 0.1, 21900(SM)|-|1%, slot-id, userkey
				
			

Place the Stop Market order above the current price by 1%

One-wayHedge
				
					BTCUSDT, buy, 0.1, {{close}}+1%(SM), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, {{close}}+1%(SM), slot-id, userkey
				
			

Trailing Stop | Futures

If the price reaches 21900, then the Trailing Stop order will be activated. Callback is 1%

One-wayHedge
				
					BTCUSDT, buy, 0.1, 21900:1%(TS), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, 21900:1%(TS), slot-id, userkey
				
			

The Activation price is empty (the market price). Callback is 1%

One-wayHedge
				
					BTCUSDT, buy, 0.1, -:1%(TS), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, -:1%(TS), slot-id, userkey
				
			

The Activation price will be calculated and will be 2% below the current market price. Callback 1%

One-wayHedge
				
					BTCUSDT, buy, 0.1, {{close}}-2%:1%(TS), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, {{close}}-2%:1%(TS), slot-id, userkey
				
			

Post Only | Futures

Add a Limit order to the order book as a liquidity-creating order (Maker order)

One-wayHedge
				
					BTCUSDT, buy, 0.1, 20000(P), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, 20000(P), slot-id, userkey
				
			

Close | Futures

Close 50% of the current position, if any

One-wayHedge
				
					BTCUSDT, close, 50%, -, slot-id, userkey
				
			
				
					BTCUSDT, close_h, 50%, -, slot-id, userkey
				
			

Close 100% of the current position (if any), and open Long position by using 30% of USDT balance (at the market price)

One-wayHedge
				
					BTCUSDT, close-buy, 30%, market, slot-id, userkey
				
			
				
					BTCUSDT, close_h-openlong, 30%, market, slot-id, userkey
				
			

Cancel | Futures

Cancel all limit orders (associated with the pair), if any

				
					BTCUSDT, cancel, -, -, slot-id, userkey
				
			

Cancel all limit orders (associated with the pair), and open the Long position

One-wayHedge
				
					BTCUSDT, cancel-buy, 0.1, market, slot-id, userkey
				
			
				
					BTCUSDT, cancel-openlong, 0.1, market, slot-id, userkey
				
			

Cancel limit orders, then Close the current position (if any), and open the Long position

One-wayHedge
				
					BTCUSDT, cancel-close-buy, 0.1, market, slot-id, userkey
				
			
				
					BTCUSDT, cancel-close_h-openlong, 0.1, market, slot-id, userkey
				
			

Take Profit / Stop Loss | Futures

The examples below show how to set TP/SL orders with a volume equal to the volume of the order they are placed with

Open the Long position with 0.1 BTC (at the market price) and set Take Profit to 5%. The volume of the TP order will be equal to the buy order (0.1 BTC)

One-wayHedge
				
					BTCUSDT, buy, 0.1, market|5%, slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, market|5%, slot-id, userkey
				
			

Open the Long position with 0.1 BTC (at the market price) and set Stop Loss to 1%. The volume of the SL order will be equal to the buy order (0.1 BTC)

One-wayHedge
				
					BTCUSDT, buy, 0.1, market|-|1%, slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, market|-|1%, slot-id, userkey
				
			

Same as above but place the Stop Loss as Stop Limit order

One-wayHedge
				
					BTCUSDT, buy, 0.1, market|-|1%(S), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, market|-|1%(S), slot-id, userkey
				
			

Same as above but place the Stop Loss as Trailing Stop order

One-wayHedge
				
					BTCUSDT, buy, 0.1, market|-|1%(TS), slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, market|-|1%(TS), slot-id, userkey
				
			

Buy 0.1 BTC at 20000 (the limit order) and set the Take Profit level at 21900 and the Stop Loss at 1%. The volume of TP/SL orders will be equal to the Buy order (0.1 BTC)

One-wayHedge
				
					BTCUSDT, buy, 0.1, 20000|21900|1%, slot-id, userkey
				
			
				
					BTCUSDT, openlong, 0.1, 20000|21900|1%, slot-id, userkey
				
			

Unlike the previous ones, TP/SL orders sent using the tpsl command will be calculated based on the volume and average price of the current position

Set Take Profit to 5% by using 100% of the current position

One-wayHedge
				
					BTCUSDT, tpsl, -, 5%(100%), slot-id, userkey
				
			

The side of the current position can be any

				
					BTCUSDT, tpsl_h, long, 5%(100%), slot-id, userkey
				
			

The side of the current position must be pointed

Set TP to 5% and SL to 1% by using 100% of the current position.
Or SL only (ex. 2)

One-wayHedge
				
					BTCUSDT, tpsl, -, 5%(100%) | 1%(100%), slot-id, userkey
BTCUSDT, tpsl, -, - | 1%(100%), slot-id, userkey
				
			

The side of the current position can be any

				
					BTCUSDT, tpsl_h, long, 5%(100%) | 1%(100%), slot-id, userkey
BTCUSDT, tpsl_h, long, - | 1%(100%), slot-id, userkey
				
			

The side of the current position must be pointed

Same as above but place the Stop Loss as Stop Limit order

One-wayHedge
				
					BTCUSDT, tpsl, -, 5%(100%) | 1%(100%)(S), slot-id, userkey
BTCUSDT, tpsl, -, - | 1%(100%)(S), slot-id, userkey
				
			
				
					BTCUSDT, tpsl_h, long, 5%(100%) | 1%(100%)(S), slot-id, userkey
BTCUSDT, tpsl_h, long, - | 1%(100%)(S), slot-id, userkey
				
			

Set TP at 21900 and SL below the current price by 50 USDT using 100% of the current position.

One-wayHedge
				
					BTCUSDT, tpsl, -, 21900(100%) | {{close}}-50(100%), slot-id, userkey
				
			
				
					BTCUSDT, tpsl_h, long, 21900(100%) | {{close}}-50(100%), slot-id, userkey
				
			

TP/SL when there is no current position. For a future Long position, set TP at 21900 and SL at 18500 using 0.1 BTC. The prices and quantities should only be specific values in such scenario

One-wayHedge
				
					BTCUSDT, tpsl, long, 21900(0.1) | 18500(0.1), slot-id, userkey
				
			
				
					BTCUSDT, tpsl_h, long, 21900(0.1) | 18500(0.1), slot-id, userkey
				
			

Place multiple TP/SL orders (up to 3 of each).
Set two TP orders at 5% and 10%, by using 50% of the current position per order, and two SL orders at 1% and 2%, by using 30% and 70% of the current position

One-wayHedge
				
					BTCUSDT, tpsl, -, 5%(50%) : 10%(50%) | 1%(30%) : 2%(70%), slot-id, userkey
				
			
				
					BTCUSDT, tpsl_h, long, 5%(50%) : 10%(50%) | 1%(30%) : 2%(70%), slot-id, userkey
				
			

Leverage | Futures

Set the leverage to x5. Commands without this parameter will be executed with a leverage equal to 1

				
					BTCUSDT(x5), buy, 100%, market, slot-id, userkey
				
			

Calculations | Futures

Place the Long Limit order below the current price by 9.5 USDT

				
					BTCUSDT, buy, 100%, {{close}}-9.5, slot-id, userkey
				
			

Place the Short Limit order above the current price by 1%

				
					BTCUSDT, sell, 100%, {{close}}+1%, slot-id, userkey
				
			

If buy, then the order price will be 1% lower

				
					BTCUSDT, {{strategy.order.action}}, 100%, {{close}}+-1%, slot-id, userkey
				
			

If buy, then the order price will be 1% higher

				
					BTCUSDT, {{strategy.order.action}}, 100%, {{close}}-+1%, slot-id, userkey
				
			

Calculate prices for TP/SL orders with no current position

				
					BTCUSDT, tpsl, long, {{close}}+5%(0.1) | {{close}}-1%(0.1), slot-id, userkey
				
			

Conditions | Futures

Place order only if the condition is met.
‘if position’ means the current position could be any

				
					if long: BTCUSDT, buy, $500, market, slot-id, userkey
if short: BTCUSDT, buy, $500, market, slot-id, userkey
if position: BTCUSDT, buy, $500, market, slot-id, userkey
if not long: BTCUSDT, buy, $500, market, slot-id, userkey
if not short: BTCUSDT, buy, $500, market, slot-id, userkey
if not position: BTCUSDT, buy, $500, market, slot-id, userkey
				
			

Place BTCUSDT order if ETHUSDT Short position exists

				
					if short (ETHUSDT): BTCUSDT, buy, $500, market, slot-id, userkey
				
			

Condition with delay 5 seconds

				
					delay(5) if short: BTCUSDT, buy, $500, market, slot-id, userkey
				
			

All-in-One | Futures

  • Cancel all limit orders (associated with the pair), if any
  • Close the current position, if any
  • Sell BTC by using 20% of USDT balance (at the market price), with leverage x5
  • Set the Take Profit to 5%
  • Set the Stop Loss to 1%
				
					BTCUSDT(x5), cancel-close-sell, 20%, market|5%|1%, slot-id, userkey
				
			

For strategies | Futures

Using single alert with TradingView strategies

  • Close the current position (if any)
  • Buy or Sell BTC by spending 10% of USDT balance (at the market price)
  • Side of position will be determined by strategy
				
					BTCUSDT, close-{{strategy.order.action}}, 10%, market, slot-id, userkey
				
			
  • Cancel all limit orders (associated with the pair), if any
  • Close the current position (if any)
  • Place Buy or Sell the Trailing Stop order by using 10% of USDT balance
  • The Activation price will be calculated automatically, depending on the side of the order (if long, the price will be 2% lower)
  • Callback is 1%
  • Side of position will be determined by strategy
				
					BTCUSDT, cancel-close-{{strategy.order.action}}, 10%, {{close}}+-2%:1%(TS), slot-id, userkey

				
			

More examples | Futures

Multiple commands in one alert (up to 5)

				
					BTCUSDT, buy, 0.1, market, slot-id, userkey;
ETHUSDT, buy, 3.5, market, slot-id, userkey
				
			

Reduce only the option

				
					BTCUSDT, buy, 0.1, 21900_r, slot-id, userkey
BTCUSDT, buy, 0.1, 21900(SM)_r, slot-id, userkey
				
			

Mark price the option

				
					BTCUSDT, buy, 0.1, 21900_m, slot-id, userkey
BTCUSDT, buy, 0.1, 21900(S)_m|5%_m|2%_m, slot-id, userkey
				
			

Add a short comment to the command. It will be shown in reports. Only latin letters and numbers are allowed

				
					BTCUSDT, buy, 100%, market, slot-id, userkey, Short comment goes here
				
			

Delay before starting command execution (up to 30 seconds). If several commands with a delay parameter are received simultaneously, the total delay time should not exceed 30 seconds.

				
					delay(5): BTCUSDT, buy, 100%, market, slot-id, userkey
				
			

Note: Do not change leverage if there is a current position

Supported markets:

  1. Binance COIN-M Delivery

LONG examples | Delivery

Buy 1 contract at the fixed price (limit order)

One-wayHedge
				
					BTCUSD_PERP, buy, 1, 21900, slot-id, userkey
BTCUSD_230630, buy, 1, 21900, slot-id, userkey
				
			

If the current position is Long -or- there is no current position, then 1 contract will be bought at 21900. But if the current position is Short, then the size of such position will be reduced by 1 contract

				
					BTCUSD_PERP, openlong, 1, 21900, slot-id, userkey
BTCUSD_PERP, closelong, 1, 21900, slot-id, userkey
				
			

Ex. 1: Increase the Long position by 1 contract at 21900
Ex. 2: Reduce the current Long position by 1 contract at 21900

Buy some qty of contracts for 10% of BTC balance at the market price

One-wayHedge
				
					BTCUSD_PERP, buy, 10%, market, slot-id, userkey
BTCUSD_230630, buy, 10%, market, slot-id, userkey
				
			

If the current position is Long -or- there is no current position, then some qty of contracts will be bought at the market price for 10% of BTC balance. But if the current position is Short, then the size of such position will be reduced by 10%

				
					BTCUSD_PERP, openlong, 10%, market, slot-id, userkey
BTCUSD_PERP, closelong, 10%, market, slot-id, userkey
				
			

Ex. 1: Increase the Long position at the market price by using 10% of BTC balance
Ex. 2: Reduce the current Long position by 10% at the market price

Buy some qty of contracts by using 0.1 BTC at the market price

One-wayHedge
				
					BTCUSD_PERP, buy, $0.1, market, slot-id, userkey
BTCUSD_230630, buy, $0.1, market, slot-id, userkey
				
			

If the current position is Long -or- there is no current position, then some qty of contracts will be bought at the market price by using 0.1 BTC. But if the current position is Short, then the size of such position will be reduced by amount equal to 0.1 BTC

				
					BTCUSD_PERP, openlong, $0.1, market, slot-id, userkey
BTCUSD_PERP, closelong, $0.1, market, slot-id, userkey
				
			

Ex. 1: Increase the Long position at the market price by using 0.1 BTC
Ex. 2: Reduce the current Long position by 0.1 BTC, at the market price

SHORT examples | Delivery

Sell 1 contract at fixed price (limit order)

One-wayHedge
				
					BTCUSD_PERP, sell, 1, 20900, slot-id, userkey
BTCUSD_230630, sell, 1, 20900, slot-id, userkey
				
			

If the current position is Short -or- there is no current position, then 1 contract will be sold at 20900. But if the current position is Long, then the size of such position will be reduced by 1 contract

				
					BTCUSD_PERP, openshort, 1, market, slot-id, userkey
BTCUSD_PERP, closeshort, 1, market, slot-id, userkey
				
			

Ex. 1: Increase the Short position by 1 contract at 21900
Ex. 2: Reduce the current Short position by 1 contract at 21900

Sell BTC for 10% of BTC balance (at market price)

One-wayHedge
				
					BTCUSD_PERP, sell, 10%, market, slot-id, userkey
BTCUSD_230630, sell, 10%, market, slot-id, userkey
				
			

If the current position is Short -or- there is no current position, then some qty of contracts will be sold at the market price for 10% of BTC balance. But if the current position is Long, then the size of such position will be reduced by 10%

				
					BTCUSD_PERP, openshort, 10%, market, slot-id, userkey
BTCUSD_PERP, closeshort, 10%, market, slot-id, userkey
				
			

Ex. 1: Increase the Short position at the market price by using 10% of BTC balance
Ex. 2: Reduce the current Short position by 10%, at the market price

Sell some qty of contracts using 0.1 BTC (at the market price)

One-wayHedge
				
					BTCUSD_PERP, sell, $0.1, market, slot-id, userkey
BTCUSD_230630, sell, $0.1, market, slot-id, userkey
				
			

If the current position is Short -or- there is no current position, then some qty of contracts will be sold at the market price by using 0.1 BTC. But if the current position is Long, then the size of such position will be reduced by an amount equal to 0.1 BTC

				
					BTCUSD_PERP, openshort, $0.1, market, slot-id, userkey
BTCUSD_PERP, closeshort, $0.1, market, slot-id, userkey
				
			

Ex. 1: Increase Short position at the market price by using 0.1 BTC
Ex. 2: Reduce current Short position by 0.1 BTC at the market price

Stop Limit | Delivery

Unlike other orders, the Stop Limit order size is calculated based on the balance, regardless of the current position.

If the price reaches 21900, then 1 contract will be bought at 21800

One-wayHedge
				
					BTCUSD_PERP, buy, 1, 21900:21800(S), slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, 21900:21800(S), slot-id, userkey
				
			

Same as above, plus TP 5% and SL 1%.
Or SL only (ex. 2)

One-wayHedge
				
					BTCUSD_PERP, buy, 1, 21900:21800(S)|5%|1%, slot-id, userkey
BTCUSD_PERP, buy, 1, 21900:21800(S)|-|1%, slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, 21900:21800(S)|5%|1%, slot-id, userkey
BTCUSD_PERP, openlong, 1, 21900:21800(S)|-|1%, slot-id, userkey
				
			

Place an order with the Stop price 1% above the current price and the Limit price at the current price

One-wayHedge
				
					BTCUSD_PERP, buy, 1, {{close}}+1%:{{close}}(S), slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, {{close}}+1%:{{close}}(S), slot-id, userkey
				
			

Stop Market | Delivery

If the price reaches 21900, then 1 contract will be bought at the market price

One-wayHedge
				
					BTCUSD_PERP, buy, 1, 21900(SM), slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, 21900(SM), slot-id, userkey
				
			

Same as above, plus TP 5% and SL 1%.
Or SL only (ex. 2)

One-wayHedge
				
					BTCUSD_PERP, buy, 1, 21900(SM)|5%|1%, slot-id, userkey
BTCUSD_PERP, buy, 1, 21900(SM)|-|1%, slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, 21900(SM)|5%|1%, slot-id, userkey
BTCUSD_PERP, openlong, 1, 21900(SM)|-|1%, slot-id, userkey
				
			

Place the Stop Market order above the current price by 1%

One-wayHedge
				
					BTCUSD_PERP, buy, 1, {{close}}+1%(SM), slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, {{close}}+1%(SM), slot-id, userkey
				
			

Trailing Stop | Delivery

If the price reaches 21900, then the Trailing Stop order will be activated. Callback is 1%

One-wayHedge
				
					BTCUSD_PERP, buy, 1, 21900:1%(TS), slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, 21900:1%(TS), slot-id, userkey
				
			

The Activation price is empty (the market price). Callback is 1%

One-wayHedge
				
					BTCUSD_PERP, buy, 1, -:1%(TS), slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, -:1%(TS), slot-id, userkey
				
			

The Activation price will be calculated and will be 2% below the current market price. Callback 1%

One-wayHedge
				
					BTCUSD_PERP, buy, 1, {{close}}-2%:1%(TS), slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, {{close}}-2%:1%(TS), slot-id, userkey
				
			

Post Only | Delivery

Add a Limit order to the order book as a liquidity-creating order (Maker order)

One-wayHedge
				
					BTCUSD_PERP, buy, 0.1, 20000(P), slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 0.1, 20000(P), slot-id, userkey
				
			

Close | Delivery

Close 50% of the current position, if any

One-wayHedge
				
					BTCUSD_PERP, close, 50%, -, slot-id, userkey
				
			
				
					BTCUSD_PERP, close_h, 50%, -, slot-id, userkey
				
			

Close 100% of the current position (if any), and open Long position by using 30% of BTC balance (at the market price)

One-wayHedge
				
					BTCUSD_PERP, close-buy, 30%, market, slot-id, userkey
				
			
				
					BTCUSD_PERP, close_h-openlong, 30%, market, slot-id, userkey
				
			

Cancel | Delivery

Cancel all limit orders (associated with the pair), if any

				
					BTCUSD_PERP, cancel, -, -, slot-id, userkey
				
			

Cancel all limit orders (associated with the pair), and open the Long position

One-wayHedge
				
					BTCUSD_PERP, cancel-buy, 1, market, slot-id, userkey
				
			
				
					BTCUSD_PERP, cancel-openlong, 1, market, slot-id, userkey
				
			

Cancel limit orders, then Close the current position (if any), and open the Long position

One-wayHedge
				
					BTCUSD_PERP, cancel-close-buy, 1, market, slot-id, userkey
				
			
				
					BTCUSD_PERP, cancel-close_h-openlong, 1, market, slot-id, userkey
				
			

Take Profit / Stop Loss | Delivery

The examples below show how to set TP/SL orders with a volume equal to the volume of the order they are placed with

Open the Long position with 1 contract (at the market price) and set Take Profit to 5%. The volume of the TP order will be equal to the buy order (1 contract)

One-wayHedge
				
					BTCUSD_PERP, buy, 1, market|5%, slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, market|5%, slot-id, userkey
				
			

Open the Long position with 1 contract (at the market price) and set Stop Loss to 1%. The volume of the SL order will be equal to the buy order (1 contract)

One-wayHedge
				
					BTCUSD_PERP, buy, 1, market|-|1%, slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, market|-|1%, slot-id, userkey
				
			

Same as above but place the Stop Loss as Stop Limit order

One-wayHedge
				
					BTCUSD_PERP, buy, 1, market|-|1%(S), slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, market|-|1%(S), slot-id, userkey
				
			

Buy 1 contract at 20000 (the limit order) and set the Take Profit level at 21900 and the Stop Loss at 1%. The volume of TP/SL orders will be equal to the Buy order (1 contract)

One-wayHedge
				
					BTCUSD_PERP, buy, 1, 20000|21900|1%, slot-id, userkey
				
			
				
					BTCUSD_PERP, openlong, 1, 20000|21900|1%, slot-id, userkey
				
			

Unlike the previous ones, TP/SL orders sent using the tpsl command will be calculated based on the volume and average price of the current position

Set Take Profit to 5% by using 100% of the current position

One-wayHedge
				
					BTCUSD_PERP, tpsl, -, 5%(100%), slot-id, userkey
				
			

The side of the current position can be any

				
					BTCUSD_PERP, tpsl_h, long, 5%(100%), slot-id, userkey
				
			

The side of the current position must be pointed

Set TP to 5% and SL to 1% by using 100% of the current position.
Or SL only (ex. 2)

One-wayHedge
				
					BTCUSD_PERP, tpsl, -, 5%(100%) | 1%(100%), slot-id, userkey
BTCUSD_PERP, tpsl, -, - | 1%(100%), slot-id, userkey
				
			

The side of the current position can be any

				
					BTCUSD_PERP, tpsl_h, long, 5%(100%) | 1%(100%), slot-id, userkey
BTCUSD_PERP, tpsl_h, long, - | 1%(100%), slot-id, userkey
				
			

The side of the current position must be pointed

Same as above but place the Stop Loss as Stop Limit order

One-wayHedge
				
					BTCUSD_PERP, tpsl, -, 5%(100%) | 1%(100%)(S), slot-id, userkey
BTCUSD_PERP, tpsl, -, - | 1%(100%)(S), slot-id, userkey
				
			
				
					BTCUSD_PERP, tpsl_h, long, 5%(100%) | 1%(100%)(S), slot-id, userkey
BTCUSD_PERP, tpsl_h, long, - | 1%(100%)(S), slot-id, userkey
				
			

Set TP at 21900 and SL below the current price by 50 USD using 100% of the current position.

One-wayHedge
				
					BTCUSD_PERP, tpsl, -, 21900(100%) | {{close}}-50(100%), slot-id, userkey
				
			
				
					BTCUSD_PERP, tpsl_h, long, 21900(100%) | {{close}}-50(100%), slot-id, userkey
				
			

TP/SL when there is no current position. For a future Long position, set TP at 21900 and SL at 18500 using 1 contract. The prices and quantities should only be specific values in such scenario

One-wayHedge
				
					BTCUSD_PERP, tpsl, long, 21900(1) | 18500(1), slot-id, userkey
				
			
				
					BTCUSD_PERP, tpsl_h, long, 21900(1) | 18500(1), slot-id, userkey
				
			

Place multiple TP/SL orders (up to 3 of each).
Set two TP orders at 5% and 10%, by using 50% of the current position per order, and two SL orders at 1% and 2%, by using 30% and 70% of the current position

One-wayHedge
				
					BTCUSD_PERP, tpsl, -, 5%(50%) : 10%(50%) | 1%(30%) : 2%(70%), slot-id, userkey
				
			
				
					BTCUSD_PERP, tpsl_h, long, 5%(50%) : 10%(50%) | 1%(30%) : 2%(70%), slot-id, userkey
				
			

Leverage | Delivery

Set the leverage to x5. Commands without this parameter will be executed with a leverage equal to 1

				
					BTCUSD_PERP(x5), buy, 100%, market, slot-id, userkey
				
			

Calculations | Delivery

Place the Long Limit order below the current price by 9.5 USD

				
					BTCUSD_PERP, buy, 100%, {{close}}-9.5, slot-id, userkey
				
			

Place the Short Limit order above the current price by 1%

				
					BTCUSD_PERP, sell, 100%, {{close}}+1%, slot-id, userkey
				
			

If buy, then the order price will be 1% lower

				
					BTCUSDT, {{strategy.order.action}}, 100%, {{close}}+-1%, slot-id, userkey
				
			

If buy, then the order price will be 1% higher

				
					BTCUSDT, {{strategy.order.action}}, 100%, {{close}}-+1%, slot-id, userkey
				
			

Calculate prices for TP/SL orders with no current position

				
					BTCUSD_PERP, tpsl, long, {{close}}+5%(0.1) | {{close}}-1%(0.1), slot-id, userkey
				
			

Conditions | Delivery

Place order only if the condition is met.
‘if position’ means the current position could be any

				
					if long: BTCUSD_PERP, buy, 1, market, slot-id, userkey
if short: BTCUSD_PERP, buy, 1, market, slot-id, userkey
if position: BTCUSD_PERP, buy, 1, market, slot-id, userkey
if not long: BTCUSD_PERP, buy, 1, market, slot-id, userkey
if not short: BTCUSD_PERP, buy, 1, market, slot-id, userkey
if not position: BTCUSD_PERP, buy, 1, market, slot-id, userkey
				
			

Place BTCUSD_PERP order if ETHUSD_PERP Short position exists

				
					if short (ETHUSD_PERP): BTCUSD_PERP, buy, 1, market, slot-id, userkey
				
			

All-in-One | Delivery

  • Cancel all limit orders (associated with the pair), if any
  • Close the current position, if any
  • Sell some qty of contracts by using 20% of BTC balance (at the market price), with leverage x5
  • Set the Take Profit to 5%
  • Set the Stop Loss to 1%
				
					BTCUSD_PERP(x5), cancel-close-sell, 20%, market|5%|1%, slot-id, userkey
				
			

For strategies | Delivery

Using single alert with TradingView strategies

  • Close the current position (if any)
  • Buy or Sell some qty of contracts by using 10% of BTC balance (at the market price)
  • Side of position will be determined by strategy
				
					BTCUSD_PERP, close-{{strategy.order.action}}, 10%, market, slot-id, userkey
				
			
  • Cancel all limit orders (associated with the pair), if any
  • Close the current position (if any)
  • Place Buy or Sell the Trailing Stop order by using 10% of BTC balance
  • The Activation price will be calculated automatically, depending on the side of the order (if long, the price will be 2% lower)
  • Callback is 1%
  • Side of position will be determined by strategy
				
					BTCUSD_PERP, cancel-close-{{strategy.order.action}}, 10%, {{close}}+-2%:1%(TS), slot-id, userkey

				
			

More examples | Delivery

Multiple commands in one alert (up to 5)

				
					BTCUSD_PERP, buy, 1, market, slot-id, userkey;
ETHUSD_PERP, buy, 1, market, slot-id, userkey
				
			

Reduce only the option

				
					BTCUSD_PERP, buy, 1, 21900_r, slot-id, userkey
BTCUSD_PERP, buy, 1, 21900(SM)_r, slot-id, userkey
				
			

Mark price the option

				
					BTCUSD_PERP, buy, 1, 21900_m, slot-id, userkey
BTCUSD_PERP, buy, 1, 21900(S)_m|5%_m|2%_m, slot-id, userkey
				
			

Add a short comment to the command. It will be shown in reports. Only latin letters and numbers are allowed

				
					BTCUSD_PERP, buy, 100%, market, slot-id, userkey, Short comment goes here
				
			

Delay before starting command execution (up to 30 seconds). If several commands with a delay parameter are received simultaneously, the total delay time should not exceed 30 seconds.

				
					delay(5): BTCUSD_PERP, buy, 100%, market, slot-id, userkey
				
			

Note: Do not change leverage if there is a current position

Webhook URL

				
					https://aleeert.com/binance
				
			

Starter script

Starter script allows authors to quickly start writing their own strategy for trading via Aleeert

Get on TradingView
				
					//@version=5
indicator('Pine script Starter for Aleeert', overlay=true)


// CONTROLS --------------------------------------------------------

pair = input('BTCUSDT', 'Pair')
leverage = input.int(5, 'Leverage', options=[1, 2, 3, 5, 10, 20, 50, 75, 100, 125])
qty = input.string('$10', 'Qty', tooltip='Example: $10 x5 leverage equal to order size of $50. Another allowed formats: percent of balance e.g. 100%, and fixed number of coins e.g. 0.1')
priceType = input.string('stop-limit', 'Price type', options=['market', 'stop-limit'], tooltip='Order will be placed with market or limit price. Stop Limit price will be equal to "close" price at the moment of triggering')
istpsl = input.bool(false, 'TP/SL', tooltip='Note: For using TP/SL on Spot the "market" price type is required')
tp = input.float(1.5, 'TP, %', minval=0.1, step=0.1, tooltip='Take Profit level')
sl = input.float(0.5, 'SL, %', minval=0.1, step=0.1, tooltip='Stop Loss level')
slot = input.int(1, 'Slot ID', minval=1, step=1, tooltip='Pointer to the market where the order must be placed')
userkey = input('', 'Aleeert userkey')
comment = 'Pine script Starter'
command1 = ''
command2 = ''  // optionally


// STRATEGY IDEA ---------------------------------------------------

// WARNING!
// THIS IDEA WAS CREATED FOR DEMONSTRATION ONLY. USE OF THIS DEMO 
// "AS IS" FOR REAL TRADING MAY CAUSE LOSSES. MODIFY AND USE AT 
// YOUR OWN RISK.
// The trading idea is simple and based on the RSI indicator. We 
// will place long orders if RSI crosses 30 and we will place short 
// orders if RSI crosses below 70. Before placing a new order, we 
// will close the current position (if any) and cancel limit orders 
// (if any). Repeated signals will be ignored until a return signal 
// is received. The alert will be triggered when the candle closes.


// STRATEGY VARS ---------------------------------------------------

long = false
short = false
isLong = false
isShort = false
isLong := isLong[1]
isShort := isShort[1]
orderPrice = priceType == 'stop-limit' ? str.tostring(math.round_to_mintick(close)) + ':' + str.tostring(math.round_to_mintick(close)) + '(S)' : 'market'
tpsl = istpsl ? '|' + str.tostring(tp) + '%|' + str.tostring(sl) + '%' : ''

RSI = ta.rsi(close, 14)


// LONG ------------------------------------------------------------

if not isLong and ta.crossover(RSI, 30)
    long := true
    isLong := true
    isShort := false
    command1 := 'if not long: ' + pair + '(x' + str.tostring(leverage) + '), cancel-close-buy, ' + qty + ', ' + orderPrice + tpsl + ', ' + str.tostring(slot) + ', ' + userkey + ', ' + comment
    alert(command1 + ';' + command2, alert.freq_once_per_bar_close)


// SHORT -----------------------------------------------------------

if not isShort and ta.crossunder(RSI, 70)
    short := true
    isShort := true
    isLong := false
    command1 := 'if not short: ' + pair + '(x' + str.tostring(leverage) + '), cancel-close-sell, ' + qty + ', ' + orderPrice + tpsl + ', ' + str.tostring(slot) + ', ' + userkey + ', ' + comment
    alert(command1 + ';' + command2, alert.freq_once_per_bar_close)


plot(long ? low : na, title='Long', style=plot.style_columns, color=color.rgb(76, 175, 79, 50))
plot(short ? low : na, title='Short', style=plot.style_columns, color=color.rgb(255, 82, 82, 50))


				
			

How to trade cryptocurrency using TradingView chart

Basic example of using the chart on TradingView.com as terminal for trading on Binance.

How to trade by signals from TradingView indicators

Automated trading by signals from any indicator on TradingView

How to trade by signals from TradingView strategies

Automated trading by signals from strategies written on TradingView’s Pine script

How to trade the grid of orders

Will add instruction later.

How to trade using permanent orders

Will add instruction later.

Trading tricks using TradingView + Aleeert

Will add instruction later.

Table of contents

Something went wrong

Close