If I want to set the stop loss and then trade after 15 bars,
How to write the code ? (The meaning is after stop loss....the position cannot trade until 15 bars)
Thx!
How to write the code?
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: How to write the code?
With the PosTradeExitCategory() keyword we can figure out what caused a trade to exit (in this case, we'd be looking for a stop-loss exit category).If I want to set the stop loss and then trade after 15 bars,
How to write the code ? (The meaning is after stop loss....the position cannot trade until 15 bars)
If we then store the current bar number when such an exit happens (see CurrentBar), we can then later on compare that stored bar number with the current bar number to see if 15 bars have passed.
I hope this makes sense and helps you get started.