BarsSinceExit  [SOLVED]

Questions about MultiCharts and user contributed studies.
tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

BarsSinceExit

Postby tony » 03 Feb 2019

Hi

I'm trying to prevent a strategy from generating an entry on the same or very next bar after an exit. I'm using

Code: Select all

BarsSinceExit(1) > 1
In theory this seems like it should work.

But for the very first trade. Since there are no prior exits, I'm assuming 0 is being returned and therefore no trades are taken.

Any ideas on how to solve this?

Thank You,

Tony

MAZINGUER
Posts: 75
Joined: 06 Jan 2017
Has thanked: 9 times
Been thanked: 25 times

Re: BarsSinceExit

Postby MAZINGUER » 03 Feb 2019

Hi Tony
Try adding to your if statement that conditions purchases / sales, the expression "or MarketPosition (1) = 0" so that something like this follows:

Code: Select all

If BarsSinceExit (1)>1 or MarketPosition (1) = 0 then
buy / sell

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: BarsSinceExit  [SOLVED]

Postby tony » 03 Feb 2019

Perfect. Thank you. Was having an apparent brain fart on that one. Nice and simple solution. I appreciate the support.


Return to “MultiCharts”