Lets assume I am using a simple moving average cross.
If it crosses above, I get long but if it then crosses below once I am at 50% of my profit target I get out.
The syntax asks me for a "lookback period" which I want to be the following
int lookBackPeriod = [??????];
where [??????] is the exact number of bars since position entry (or as I like to think of it, "elapsed time since position entry". Of course, this number will dynamically update OnBarClose.
Is there a reasonable method for counting or measuring the number of bars since position entry?
Thank you and regards,
Andrew
Comment