如何采取两个条目
How to take two entries
//@version=4
strategy("three OutSide Bar Strategy", overlay=true)
target = 3400
sl=9000
if (close > open and close[1] > open[1] and close[2]>open[2] and hour>= 12 and hour <19)// or hour ==20)
strategy.entry("OutBarLE", strategy.long, comment="OutBarLE")
strategy.exit("exit","OutBarLE",profit=target,loss=sl)
if (close < open and close[1] < open[1] and close[2] < open[2] and hour>= 12 and hour <19)// or hour ==20)
strategy.entry("OutBarSE", strategy.short, comment="OutBarLE")
strategy.exit("exit","OutBarSE",profit=target,loss=sl)
我已经尝试了一个基本策略,我发现如果有未平仓头寸,它不会进入另一个头寸。只有在已经开仓的仓位平仓后,它才会持有该仓位。
例如,如果在 ID OutBarLE 中开仓,并且在开仓时发生相同的情况,则由于开仓,该条件未被验证。如何同时处理两个或多个仓位
通过在策略设置中将 Pyramiding
设置为大于 1 的值。
您可以在此处阅读有关金字塔的信息:
- TradingView - Strategies
- Kodify.net - How to set a TradingView strategy's pyramiding with code?
- BackTestRookies - Tradingview: Pyramiding
您还可以search Whosebug for Pyramiding within the [pine-script] tag查找更多示例。
//@version=4
strategy("three OutSide Bar Strategy", overlay=true)
target = 3400
sl=9000
if (close > open and close[1] > open[1] and close[2]>open[2] and hour>= 12 and hour <19)// or hour ==20)
strategy.entry("OutBarLE", strategy.long, comment="OutBarLE")
strategy.exit("exit","OutBarLE",profit=target,loss=sl)
if (close < open and close[1] < open[1] and close[2] < open[2] and hour>= 12 and hour <19)// or hour ==20)
strategy.entry("OutBarSE", strategy.short, comment="OutBarLE")
strategy.exit("exit","OutBarSE",profit=target,loss=sl)
我已经尝试了一个基本策略,我发现如果有未平仓头寸,它不会进入另一个头寸。只有在已经开仓的仓位平仓后,它才会持有该仓位。
例如,如果在 ID OutBarLE 中开仓,并且在开仓时发生相同的情况,则由于开仓,该条件未被验证。如何同时处理两个或多个仓位
通过在策略设置中将 Pyramiding
设置为大于 1 的值。
您可以在此处阅读有关金字塔的信息:
- TradingView - Strategies
- Kodify.net - How to set a TradingView strategy's pyramiding with code?
- BackTestRookies - Tradingview: Pyramiding
您还可以search Whosebug for Pyramiding within the [pine-script] tag查找更多示例。