CopyPastor

Detecting plagiarism made easy.

Score: 0.8945684412721197; Reported for: String similarity Open both answers

Possible Plagiarism

Reposted on 2022-08-07
by vitruvius

Original Post

Original - Posted on 2022-04-18
by vitruvius



            
Present in both answers; Present only in the new answer; Present only in the old answer;

You can use the `strategy.opentrades.entry_bar_index` built-in variable to get the bar index of the open trade. Then compare it with the current bar index.
n = 50 open_idx = strategy.opentrades.entry_bar_index(strategy.opentrades-1) diff_idx = bar_index - open_idx if (diff_idx >= n) strategy.close("buy")
You can use the `strategy.opentrades.entry_bar_index` built-in variable to get the bar index of the entry. Then add a check based on current bar index.
entry_idx = strategy.opentrades.entry_bar_index diff = bar_index - entry_idx if (diff > 10) strategy.close("Long")

        
Present in both answers; Present only in the new answer; Present only in the old answer;