英文:
Pine Script plot MACD line and signal line on chart
问题
在我的TradingView策略中,我想要在我的图表上方绘制MACD的macdLine和signalLine。
// 本源代码受 Mozilla Public License 2.0 条款约束,详情请参阅 https://mozilla.org/MPL/2.0/
//@version=5
strategy('MACD',
overlay=true,
process_orders_on_close=true,
default_qty_type=strategy.percent_of_equity,
initial_capital=1000,
default_qty_value=100)
[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
plot(macdLine, color=color.blue)
plot(signalLine, color=color.orange)
当我的策略的overlay属性设置为true时,这些线条不会绘制在我的图表上方。如果将其设置为false,它会添加MACD线条,一切都正常。
如何在overlay=true的情况下将它们绘制在我的图表上方呢?
英文:
In my tradingview strategy I would like to plot the MACD macdLine and signalLine ontop of my chart.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//@version=5
strategy('MACD',
overlay=true,
process_orders_on_close=true,
default_qty_type=strategy.percent_of_equity,
initial_capital=1000,
default_qty_value=100)
[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
plot(macdLine, color=color.blue)
plot(signalLine, color=color.orange)
When the overlay attribute of my strategy is set to true, the lines are not plotted ontop of my chart. If it is set to false, it adds the MACD lines and everything is fine.
How can I draw them in overlay=true ontop of my chart?
答案1
得分: 1
使用 overlay=true 时,会绘制 MACD 线,但您看不到它,因为您的图表肯定位于另一个刻度。
英文:
With overlay=true your MACD lines are plotted, but you don't see it because your chart is certainly at another scale.<br>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论