在特定时间退出交易 [松树脚本]

时间:2021-06-19 14:00:18

标签: pine-script

在我的策略中,如果没有达到止损或止盈,那么我将在 15:00 之前关闭交易。 并且我也不会在 12:30 之后进行交易。

按照这个逻辑。我编写了这个块,但似乎不起作用。

//Timing details , If an exit is not hit, then close the trade by 3PM exchange time.
exitTime = ((hour >= 15) and (minute >= 1))
//Don't enter after 12:30
lateEntry = ((hour >= 12) and (minute >= 30))
if (inGoodRange and strongCandle and breachS3 and notInTrade and timeperiod and not lateEntry)
    takeProfit = high + TP
    strategy.entry("long",strategy.long)
    strategy.exit("exit","long",stop=stopLoss,limit=R3)
    strategy.exit("exit","long",stop=stopLoss,limit=takeProfit)
    if(exitTime)
        strategy.exit("exit","long",limit=close)

请求帮助。

0 个答案:

没有答案