# How to have only 1 trade per session  [SOLVED]

Questions about MultiCharts and user contributed studies.
Posts: 15
Joined: 30 Nov 2012
Has thanked: 8 times

### How to have only 1 trade per session

Hello,

How would I go about telling my strategy to only take one trade per session ?

Thank you.

TJ
Posts: 6873
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1976 times

### Re: How to have only 1 trade per session

How would I go about telling my strategy to only take one trade per session ?

Thank you.

Set up a counter.
If the counter <> 1 then

Posts: 15
Joined: 30 Nov 2012
Has thanked: 8 times

### Re: How to have only 1 trade per session

ok,

Please tell me if this is correct :

Code: Select all

`if counter = 0 thenBegin my logicif marketposition = 1 thenbegin   Sell ("longLoss") next bar at XXXX ;   counter = 1;   setexitonclose ;// Reset of the counter at end of the dayif currenttime = 1801 then counter = 0;`

Is this going to reset my counter for the next day ? or do iactually need to reset at the end of each sesion (day) ?

thanks

TJ
Posts: 6873
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1976 times

### Re: How to have only 1 trade per session

Please tell me if this is correct :
if counter = 0 then
Begin my logic
if marketposition = 1 then
begin
Sell ("longLoss") next bar at XXXX ;
counter = 1;
setexitonclose ;
// Reset of the counter at end of the day
if currenttime = 1801 then counter = 0
;
Is this going to reset my counter for the next day ? or do iactually need to reset at the end of each sesion (day) ?
thanks

Developing an autotrade is a thousand refinements on a thousand experiments.
Nobody can tell you if this is right, you have to test it out yourself.

I would suggest you to start with a good read on the ebooks in the first post:
viewtopic.php?f=16&t=6929

ps. I have tagged your code for you. You can do the same next time. Simply highlight the code you are able to post and click on the [Code] button at the top of the message window.

TJ
Posts: 6873
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1976 times

### Re: How to have only 1 trade per session  [SOLVED]

Is this going to reset my counter for the next day ? or do iactually need to reset at the end of each sesion (day) ?
thanks

How and when you reset the counter depends on your requirement.
One of the ways you can reset the counter is:

Code: Select all

`if date > date[1] thencounter = 0;`
These users thanked the author TJ for the post: