If you’ve been through our other articles you will already know how to set up a watchlist in Amibroker and Backtest a stock with some simple Amibroker Formula Language.
如果您阅读过我们的其他文章,您就会知道如何在 Amibroker 中设置观察列表并使用一些简单的 Amibroker 公式语言回测股票。
But knowing how to scan the market for buy and sell signals is also a great skill to have, and Amibroker makes it extremely easy.
但了解如何扫描市场寻找买入和卖出信号也是一项很棒的技能,Amibroker 使这变得极其简单。
Scanning A Watchlist Or Portfolio For Buy And Sell Signals Using Amibroker
使用 Amibroker 扫描观察列表或投资组合以获取买入和卖出信号
First, we need some Amibroker Formula Language to tell us where to buy and sell. For the purposes of this lesson, we will use a simple highest high / lowest low trading system. You can use any system you like, provided it has the buy and sell signals put in. Please note that I do not use this method in my own trading, I am simply using it as an example.
首先,我们需要一些 Amibroker 公式语言来告诉我们在哪里买卖。 出于本课程的目的,我们将使用一个简单的最高高点/最低低点交易系统。 您可以使用任何您喜欢的系统,只要它输入了买入和卖出信号。请注意,我在自己的交易中没有使用此方法,我只是将其用作示例。
- From the main screen in Amibroker, open the formula Editor by going to Analysis > Formula Editor.
在 Amibroker 的主屏幕中,转至分析 > 公式编辑器,打开公式编辑器。
- Paste in the following code to Notepad and then Amibroker (or type it in if it doesn’t work):
将以下代码粘贴到记事本,然后粘贴到 Amibroker(如果不起作用,则将其键入):
Uphigh = HHV (C, 90);
downhigh = LLV (C, 40);
Buy = C >= Uphigh;
Sell = C <= downhigh;
Buy = ExRem (Buy,Sell);
Sell = ExRem (Sell,Buy);
- The first part sets up our highest high and lowest low values – in this instance a 90 day high and 40 day low.
第一部分设置我们的最高高点和最低低点值——在本例中为 90 天的高点和 40 天的低点。
- The second part tells Amibroker to use those signals to trigger buy and sell signals.
第二部分告诉 Amibroker 使用这些信号来触发买入和卖出信号。
- The last part tells Amibroker to only show the first signal triggered by a higher high or low.
最后一部分告诉 Amibroker 仅显示由更高的高点或低点触发的第一个信号。
You can save the code if you like, then send it to the Automatic Analysis by going to Tools > Send To Auto Analysis.
如果愿意,您可以保存代码,然后通过转到“工具”>“发送到自动分析”将其发送到“自动分析”。
Now we need to select the watchlist that we want to scan for our buy and sell signals. In Automatic Analysis, we will work from left to right.
现在我们需要选择要扫描买入和卖出信号的观察列表。 在自动分析中,我们将从左到右进行工作。
- Under “Apply to”, select “use filter” and select the watchlist of your choice.
在“应用到”下,选择“使用过滤器”并选择您选择的监视列表。
- Under “Range” select “last n days” and make the value either 1 or 2 (i.e. the last 1 or two trading days for our signal)
在“范围”下选择“最后 n 天”并将值设置为 1 或 2(即我们信号的最后 1 或 2 个交易日)
- Click Scan, and it will scan the market for our signals and show the ones with signals from the most recent day.
单击“扫描”,它将扫描市场以查找我们的信号,并显示带有最近一天信号的信号。
You Can See The Buy And Sell Arrows On Chart As Well
您还可以在图表上看到买入和卖出箭头
As with our individual stock backtest, we can see the Buy and Sell arrows for the stocks in our portfolio too.
与我们的个股回测一样,我们也可以看到投资组合中股票的买入和卖出箭头。
Simply:
简单地:
Go to our chart that is open in Amibroker and right click, we get options like “Parameters” and “Edit Formula”.
转到在 Amibroker 中打开的图表并右键单击,我们会看到“参数”和“编辑公式”等选项。
- Click on “Parameters”.
单击“参数”。
- Go to “Axes and Grid” tab
转到“轴和网格”选项卡
- Scroll down and select “Show Trading Arrows” > Yes Click OK
向下滚动并选择“显示交易箭头”> 是单击“确定”
- Now if we go back to our Automatic Analysis screen (Analysis > Automatic Analysis), run the Scan then;
现在,如果我们返回自动分析屏幕(分析 > 自动分析),然后运行扫描;
- Right Click on the stock name (with the details and results) Select “Show Arrows For Actual Trades”
右键单击股票名称(包含详细信息和结果)选择“显示实际交易的箭头”
And you will be able to see a Green buy arrow and a Red sell arrow on your chart where the system bought and sold, including the latest buy or sell signal.
您将能够在图表上看到系统买入和卖出的绿色买入箭头和红色卖出箭头,包括最新的买入或卖出信号。