one Trade per Session

Questions about MultiCharts and user contributed studies.
MJOONIU
Posts: 2
Joined: 07 Dec 2017

one Trade per Session

Postby MJOONIU » 25 Dec 2017

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!

User avatar
Anna MultiCharts
Posts: 262
Joined: 14 Jul 2017
Has thanked: 14 times
Been thanked: 65 times

Re: one Trade per Session

Postby Anna MultiCharts » 10 Jan 2018

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.
These users thanked the author Anna MultiCharts for the post:
sptrader


Return to “MultiCharts”