Untitled

 avatar
unknown
plain_text
5 months ago
4.0 kB
3
Indexable
//@version=5
strategy("Volty Expan Close Strategy", overlay=true)
length = input(5)
numATRs = input (0.75)

////3Commas
botId = input.string("", title="Bot ID", group="3Commas", tooltip="Input your 3Commas bot ID, located in the address bar of your bot page.")
emailToken = input.string("", title="Email Token", group="3Commas", tooltip="Input your 3Commas email token, which can be found on your bot information page.")
var enableTpAlert = input.bool(false, title = "Use 3Commas Exit", group="3Commas", tooltip="When enabled, vyn's take profit alert will be deactivated, and your take profit will be determined by the settings in your 3Commas bot. Take care to have the identical value in 3Commas and in vyn so the deal's do not get out of sync.")
var futures = input.bool(false, title = "Enable ByBit Futures", group="3Commas", tooltip="When enabled, the alert will work for 3Commas' ByBit Futures bot.")
futures_exchange = input.string(defval="ByBit Futures", title="Futures Exchange", group="3Commas", options=["ByBit Futures", "Binance Futures", "OKX Futures", "GateIO Futures"], tooltip="Every Futures Exchange requires a different symbols syntax on 3Commas. Please pick the correct futures exchange for your needs.")


/////3Commas MultiPair//////
getBotStartMsg(orderSize = 0) =>
	if futures
		if futures_exchange == "ByBit Futures" or futures_exchange == "Binance Futures"
        	msg = '{"message_type":"bot", "bot_id":"' + botId + '", "email_token":"' + emailToken + '", "delay_seconds":0, "pair":"' + str.tostring(syminfo.currency) + '_' + str.tostring(syminfo.basecurrency) + 'USDT"}'
    	if futures_exchange == "OKX Futures"
        	msg = '{"message_type":"bot", "bot_id":"' + botId + '", "email_token":"' + emailToken + '", "delay_seconds":0, "pair":"' + str.tostring(syminfo.currency) + '_' + str.tostring(syminfo.basecurrency) + 'USDT"}'
		if futures_exchange == "GateIO Futures"
        	msg = '{"message_type":"bot", "bot_id":"' + botId + '", "email_token":"' + emailToken + '", "delay_seconds":0, "pair":"' + str.tostring(syminfo.currency) + '_' + str.tostring(syminfo.basecurrency) + 'USDT"}'
	else
        msg = '{"message_type":"bot", "bot_id":"' + botId + '", "email_token":"' + emailToken + '", "delay_seconds":0, "pair":"' + str.tostring(syminfo.currency) + '_' + str.tostring(syminfo.basecurrency) + '"}'

getBotStopMsg() =>
	if futures
		if futures_exchange == "ByBit Futures" or futures_exchange == "Binance Futures"
			msg = '{"action": "close_at_market_price", "message_type":"bot", "bot_id":"' + botId + '", "email_token":"' + emailToken + '", "delay_seconds":0, "pair":"' + str.tostring(syminfo.currency) + '_' + str.tostring(syminfo.basecurrency) + 'USDT"}'
	else
		msg = '{"action": "close_at_market_price", "message_type":"bot", "bot_id":"' + botId + '", "email_token":"' + emailToken + '", "delay_seconds":0, "pair":"' + str.tostring(syminfo.currency) + '_' + str.tostring(syminfo.basecurrency) + '"}'

getBotAddFundsMsg(addVolume = 0) =>
	if futures
		if futures_exchange == "ByBit Futures" or futures_exchange == "Binance Futures"
			msg = '{"action": "add_funds_in_quote", "message_type":"bot", "bot_id":"' + botId + '", "email_token":"' + emailToken + '", "delay_seconds":0, "pair":"' + str.tostring(syminfo.currency) + '_' + str.tostring(syminfo.basecurrency) + 'USDT", "volume":' + str.tostring(addVolume) + '}'
	else
		msg = '{"action": "add_funds_in_quote", "message_type":"bot", "bot_id":"' + botId + '", "email_token":"' + emailToken + '", "delay_seconds":0, "pair":"' + str.tostring(syminfo.currency) + '_' + str.tostring(syminfo.basecurrency) + '", "volume":' + str.tostring(addVolume) + '}'




atrs = ta.sma(ta.tr,length) *numATRs
if (not na(close[length]))
    strategy.entry("VItC1sLE",strategy.long, stop=close+atrs, comment = "VItC1sLE")
    strategy.entry("VItClsSE", strategy.short, stop=close-atrs, comment = "VltClsSE")
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)


Editor is loading...
Leave a Comment