将脚本变量引用到输入字段中
I have a strategy sending signals to my bot.
I wish to use the notation as in picture
to send the bot specific take profit and stop loss values, dynamically taken from my script. What should I do to reference my variables inside the input fields?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能那样做。输入字段需要一个
const string
,因此您不能在其中传递变量。该字段可能在那里,因此您可以为您的机器人输入特定命令(进入、退出等)。
如果您想在订单消息中使用变量,您应该使用
alert()
函数。You cannot do that. Input field expects a
const string
so you cannot pass a variable there.That field is probably there so you can enter specific commands for your bot (enter, exit etc.)
If you want to use variables in your order message, you should use the
alert()
function.Nvm,我使用了str.replace()。
基本上,您获取输入变量(整个文本消息),并将其传递给
str.replace()
n 倍的变量,每次都使用之前获得的新字符串。就我而言,如果我想替换#LongSL#和#longTP#,我会写如下:
Nvm, I used
str.replace()
.Basically you get the input variable (the whole text message) and pass it thru
str.replace()
n times as many variables you have to replace, each time using the previous obtained new string.In my case, if I wish to replace #LongSL# and #longTP#, I will write as following: