我是TradingView的新手,并且已经学习了很多东西。我正在使用Pine-Script语言进行回测的策略,但是让我感到困惑的是如何将相同的策略用于多个硬币。
该策略主要是为了赚钱期货交易而制定的,如果可能的话,是否可以将其应用于其他交易所。
因此,我想设置多个硬币的警报系统要连接到3comma bot或Finandy,以根据设置参数执行交易。
我的问题是。
-
如果我想使用某些蜡烛类型(例如Hiken Ashi),应该包含在代码中或仅在图表中选择它,并且该策略将自动读取?
-
我应该在脚本中包括硬币还是在图表中选择一个,然后设置每枚硬币的警报?
-
我应该每张一枚硬币创建一个警报,还是每张硬币都有多个图表来设置警报?
-
应该在代码中定义时间表,否则图表可以完成工作?
对不起,有很多问题,我试图很好地理解这一过程。
I'm a newbie for TradingView and have been learning a lot. I'm developing a strategy with backtesting using pine-script language however what confusing me, is how to use the same strategy for multiple coins.
The strategy is mainly developed for Binance Futures trading not sure if possible to apply it to other Exchangers.
So I wanna setup alerting system for multiple coins to be connected to 3comma Bot or Finandy to execute a trade based on the setup parameter.
My questions are.
-
If I wanna use certain candle types like Hiken Ashi should that be included in the code or just select it in the chart and it will be read by the strategy automatically?
-
Should I include the coins in the script or I should select them one by one in the chart and then setup an alert per coin?
-
Should I create one alert per one coin per chart or I should have multiple charts per each coin to setup an alert?
-
Should the timeframe also be defined in the code or the chart can do the job?
Sorry for many questions, I'm trying to understand the process well.
发布评论
评论(1)
对于多个硬币,最简单的方法是将您的策略附加到您要与之交易的交易中的每一个硬币上。这样,您可以在各自的图表上进行测试。
如果您为Binance:BTCUSDT创建一种策略,并考虑在不同的交流中使用此策略,您可以做到,但是首先,我建议对Binance进行测试:BTCPERP,并亲自查看相同的策略如何显示出截然不同的结果(即使BTCUSDT和BTCPERP也应该移动相同)。
对于一个复杂的解决方案,您可以创建一个使用多个证券的单个脚本,但是您将无法通过简单的方法进行回报,您将不得不编写自己的收益/损失计算器,而您还没有。
我沿着同一条道路,我的建议是:
strategy.entry.entry()
>命令,也就是说,以某种方式构造警报消息,您可以用其中的变量替换值(如上所选择的硬币)一些示例。以下将为硬币和用于交易硬币的机器人ID创建一个选择器。诸如“ bin:gmtperp -osakr”之类的名称完全是我的制作,它们是钥匙(对于键/值对):
现在您可以将上述部分组合到两个警报中,以启动/停止bot:
Exchange_Symbol
是您需要提供给机器人的适当的Exchange符号,您可以在3Commas的Bot页面上获得帮助(它们已预先制作了您需要用于某些操作的HTTP请求)。bot_id
是您的机器人的ID,这很简单。上述解决方案无法处理单个硬币机器人,其触发消息具有不同的结构。
只要您可以使用多硬币机器人,因为它们可以充当一个机器人,但要有两个例外:
要总结您的问题:
不包括代码中的图表类型(甚至不是可嵌入的数据),只需将代码应用于您想要使用的任何图表即可。提示:切勿使用Heikin-Ashi进行交易。您可以,但您会为此付出深厚的付出(每个人都在尝试,即使是针对警告,不用担心)
一一设置它们,因此您可以回头测试
否,请在图表上设置时间表。稍后,当您经验丰富时,您将能够抽象当前的时间范围(无论它是什么),并编写时间范围的代码。但这很难使您的代码不那么可读。
For multiple coins, the easiest way is to attach your strategy to each and every coin on Tradingview you want to trade with. This way you can backtest each on their respective chart.
If you create a strategy for say BINANCE:BTCUSDT and think of using this strategy on different exchange, you can do it, but first I suggest test it on BINANCE:BTCPERP and see for yourself how the same strategy can show a wildly different result (even though BTCUSDT and BTCPERP should be moving the same).
For a complex solution you can create a single script that uses multiple securities, but you won't be able to backtest that with simple approach, you would have to write your own gain/loss calculator, and you are not there yet.
I was going down the same road, my suggestions are:
strategy.entry()
command, that is, construct the alert message in a way you can replace values with variables in it (like the above selected coin)A few examples. The below will create a selector for a coin and the Bot ID that is used to trade that coin. The names like 'BIN:GMTPERP - osakr' are entirely my making, they act as a Key (for a key/value pair):
And now you can combine the above parts into two Alerts, for starting/stopping the bot:
exchange_symbol
is the proper exchange symbol you need to provide to your bot, you can get help on the 3Commas' bot page (they have pre-crafted the HTTP requests you need to use for certain actions).bot_id
is the ID of your Bot, that is straightforward.The above solution does not handle Single coin bots, their trigger message has a different structure.
Whenever you can, use Multi coin bots as they can act as a Single bot with two exception:
To summarize on your questions:
Do not include chart type in code (that is not even an embeddable data), just apply your code to whatever chart you want to use. Hint: never use Heikin-Ashi for trading. You can, but you will pay for it dearly (everyone tries, even against warnings, no worries)
Set up them one-by-one, so you can backtest them
No, set the timeframe on the chart. Later, when you will be more experienced you will be able to abstract the current timeframe (whatever it is) away and write code that is timeframe-agnostic. But that's hard and make your code less readable.