简体   繁体   English

Pine Script TradingView 查询

[英]Pine Script TradingView Query

I'm quite new to PINE and I'm hoping for some assistance, or to be pointed in the right direction.我对 PINE 很陌生,我希望得到一些帮助,或者指出正确的方向。 My goal is to script BUY/SELL signals which will use a PERCENTAGE of an available sum for use with a trading bot via TradingView.我的目标是编写买入/卖出信号脚本,该信号将使用可用金额的百分比通过 TradingView 与交易机器人一起使用。

For example, starting capital $100, buy signal comes through, which triggers buy of of 25% ($25) worth of X coin.例如,起始资金 100 美元,买入信号通过,触发买入价值 25%(25 美元)的 X 币。

I have been unable to find the code to setup the more complicated percentage-based buy/sell orders.我一直找不到代码来设置更复杂的基于百分比的买/卖订单。 Perhaps I'm blind, if so, tell me: :) The below code provided by TradingView would use all available capital in the account to make 1 x buy trade... which is not ideal.也许我是盲人,如果是,请告诉我:) TradingView 提供的以下代码将使用账户中的所有可用资金进行 1 x 买入交易......这并不理想。

{
    "action": "BUY",
    "botId": "1234"
}

I have tried this to add % but to no avail:我试过这个来添加 % 但无济于事:

{
    "action": "BUY" percent_of_equity 25,
    "botId": "1234"
}

Any suggestions?有什么建议么? Am I missing anything obvious?我错过了什么明显的东西吗?

Related Articles:相关文章:

The code above is not related to pine-script, but is part of alarm/webhook action.上面的代码与 pine-script 无关,而是警报/webhook 操作的一部分。

If you want to declare equity in your (back)order, inside pine-script, you have to use strategy like something this:如果你想在你的 (back) order 中声明权益,在 pine-script 中,你必须使用这样的策略:

strategy(title = "example",
         shorttitle = "myscript",
         overlay = true,
         pyramiding = 1,
         default_qty_type = strategy.percent_of_equity,
         default_qty_value = 50,
         initial_capital = 1000)

This get the type as percent of equity, which is 50% declared on qty_value这将类型作为权益百分比,在 qty_value 上声明为 50%

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM