等待strategy.exit

时间:2019-05-16 19:40:56

标签: pine-script

该策略终止(退出)之后,我想等一下再输入新交易。

我尝试使用barsince,但是找不到满足最后一个出口的条件。

我希望在退出之后要等4个小时才能进入新交易。

//@version=3
strategy("ABC", shorttitle="ABC", initial_capital=1000, commission_type = strategy.commission.percent, commission_value = 0.075, overlay = true, linktoseries = true)
nominal = 1000/close
SL = 0.0
SLold = nz(SL[1])
SL :=  max(max(max(strategy.position_avg_price,ohlc4)-atr(10)*3, strategy.position_avg_price * 0.96), SLold)
buy = cci(close,40)<50
testPeriodStart = timestamp(2018,2,1,0,0)
if time >= testPeriodStart 
    strategy.entry("Long", strategy.long, nominal, when = buy)
    strategy.exit("Exit", "Long", stop = SL)
plot(SL, color = #006400)

1 个答案:

答案 0 :(得分:0)

尝试一下。

public IViewModel FileListViewModel { get; set; }
public IViewModel FileDisplayerViewModel { get; set; }

public IView FileListView { get; set; }
public IView FileDisplayerView { get; set; }

public MainWindowViewModel(IWindow window, IContainer container,
        IFileDisplayerViewModel fileDisplayerViewModel, IFileListViewModel fileListViewModel) : base(window, container)
        {
            FileListViewModel = fileListViewModel;
            FileListView = FileListViewModel.View;

            FileDisplayerViewModel = fileDisplayerViewModel;
            FileDisplayerView = FileDisplayerViewModel.View;
        }