Hi,
How to code to allow just one trade per session? For example trade session is from today 20:00 until 08:00 next day?
Thank you!
one Trade per Session
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 140 times
Re: one Trade per Session
Hello, MJOONIU!
You can use the If operator to check if the current bar time corresponds to the specified time interval and generate an order or not depending on this.
I’m afraid that’s not quite clear what you understand by “trade” here.
If you need to send just one order, then you can use a boolean to determine whether an order was generated during this session or not. Once an order is generated, you should make so that your strategy stopped generating new orders.
If you need just one filled order, then you can monitor the market position at broker and once it changes for the instrument, stop generating new orders and cancel the pending ones.
You can use the If operator to check if the current bar time corresponds to the specified time interval and generate an order or not depending on this.
I’m afraid that’s not quite clear what you understand by “trade” here.
If you need to send just one order, then you can use a boolean to determine whether an order was generated during this session or not. Once an order is generated, you should make so that your strategy stopped generating new orders.
If you need just one filled order, then you can monitor the market position at broker and once it changes for the instrument, stop generating new orders and cancel the pending ones.