Example: Remote signals combined with managed leverage trading

stable
By Stephan in Miscellaneous Published October 2020 👁 2,357 views 💬 1 comments

Description

This is an example script to show how remote signals can be read inside HaasScript and how to handle it for managed leverage trading.
HaasScript
-- High speed update are recommended for a quick responce, but its not essential
EnableHighSpeedUpdates();

-- Use your own signal identifier for this field
signal = GetRemoteSignal('d8f3e51a01454d07a31343c63a426e9f')

-- Progress the incoming data like this
if (signal == SignalLong) then
  DoLong()
end
if (signal == SignalShort)  then
  DoShort()
end
if (signal == SignalExitPosition)  then
  DoExitPosition()
end

-- The following methods are not totally valid, because the
-- signals are more advanced then managed trading can handle
if (signal == SignalExitLong)  then
  DoExitPosition()
end
if (signal == SignalExitShort)  then
  DoExitPosition()
end

1 Comment

Sign in to leave a comment.

W
WERdas8118AFter about 4 years ago

Launched the bot according to your code, received the following message!

WARNING: Order has failed to execute. Reason: Order's position side does not match user's setting. (Exchange error code: -4061) (1813f4a17ff04e7fa41b924ef5010e1a)
Executing GoLong order of 150.0 KAVA @ 2.4485 USDT (1813f4a17ff04e7fa41b924ef5010e1a)