How to have only 1 trade per session  [SOLVED]

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

How to have only 1 trade per session

Postby trader101 » 02 Dec 2012

Hello,

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

Thank you.

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: How to have only 1 trade per session

Postby TJ » 02 Dec 2012

trader101 wrote:Hello,

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
begin your trading logic.

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

Re: How to have only 1 trade per session

Postby trader101 » 02 Dec 2012

ok,

Please tell me if this is correct :

Code: Select all

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

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: How to have only 1 trade per session

Postby TJ » 02 Dec 2012

trader101 wrote:ok,
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.

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

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

Postby TJ » 02 Dec 2012

trader101 wrote:ok,
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] then
counter = 0;
These users thanked the author TJ for the post:
trader101


Return to “MultiCharts”