Session and Autotrade

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Session and Autotrade

Postby HummerH1 » 09 Oct 2011

Hello!

I thought the session was defining the range time for trading.
Meant that there will be not any trade outside of this range.

Here is the doc quote:
Trading sessions are the hours in which a contract is available for trading. The trading session for each contract varies
depending on the contract and the exchange.
Did I understand it wrong?
Because Ive defined range session from 8am to 3pm, but i got trade at 3 am.

Did I miss something? Why isn't it working like this? How can I make it work?

Thanks

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 09 Oct 2011

Hello!

I thought the session was defining the range time for trading.
Meant that there will be not any trade outside of this range.

Here is the doc quote:
Trading sessions are the hours in which a contract is available for trading. The trading session for each contract varies
depending on the contract and the exchange.
Did I understand it wrong?
Because Ive defined range session from 8am to 3pm, but i got trade at 3 am.

Did I miss something? Why isn't it working like this? How can I make it work?

Thanks
Where did you define this "range session from 8am to 3pm"?

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 10 Oct 2011

It's the session I defined for my instrument: CME emini combined

Ive look around a little bit and found that I'd better not to use the ssetexitclose function.
That was the reason of my question. So I won't use that.

But how the session time impact my trades? Does it impact it at all?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 10 Oct 2011

It's the session I defined for my instrument: CME emini combined

Ive look around a little bit and found that I'd better not to use the ssetexitclose function.
That was the reason of my question. So I won't use that.

But how the session time impact my trades? Does it impact it at all?
Strategies read bars on the chart, and based its action on the information of the bars.

ie:
if there are bars on the chart, the strategy will read them, and trade them.

Therefore your default "session" is whatever bars you have on the chart.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 11 Oct 2011

I didnt understand what you meant by
Therefore your default "session" is whatever bars you have on the chart.
What the " for? it's not a real session?
Why do I chose a session to my instrument then? It's only so as I can use the sessionxxx varaibles?


I've looking around at posts and at the doc, Im trying to use the

Code: Select all

sessionendtime
and

Code: Select all

sessionfirstbattime
into my trades.
They are 2 parameters:
Sessiontype
sessionnumber

1- what's the difference between regular type or autodetect? it seems to do the same
2- I used the currentsession variable to print and see what are the numbers in my chart.
Ive found out that the session number is increasing for each line defined in the session I chose. Is that right???
In each of these lines, I have a "session end" box which I can check or uncheck.
What is it for??
I thought that if left unchecked the session will continue over the next line and will not end. But not. the session number is increasing anyway.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 15 Oct 2011

MultiCharts collects data 24/7.... irregardless of instrument, number of sessions, or their start/end times.

When you create a chart, you can choose to display a 24 hr chart,
or a chart showing only the default session.
Most people choose RTH as their default session, but it is an option, your choice.

When you apply an autotrade to a chart,
the strategy will read all the data on the chart, irregardless of sessions.
Unless you have specified in your code, the strategy will use all the bars on the chart.
ie.
if your chart have 24 hr of bars, the strategy will trade all 24 hrs of bars.
by the same token,
if your chart have missing bars, the strategy will trade without realizing there are missing bars.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 17 Oct 2011

Thanks TJ for your explanation

But you did not answer the questions of my last post...

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 17 Oct 2011

Thanks TJ for your explanation

But you did not answer the questions of my last post...
can you supply more information regarding your question?

eg. screenshot, where or how you want to use a specific feature, etc.,

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 17 Oct 2011

Hello,

I talk about this part of the post:
Im trying to use the
sessionendtime and sessionfirstbattime into my trades.
They have 2 parameters:
Sessiontype
sessionnumber

1- what's the difference between regular type or autodetect? it seems to do the same
2- I used the currentsession variable to print and see what are the numbers in my chart.
Ive found out that the session number is increasing for each line defined in the session I chose. Is that right???
In each of these lines, I have a "session end" box which I can check or uncheck.
What is it for??
I thought that if left unchecked the session will continue over the next line and will not end. But not. the session number is increasing anyway.
I just want to understand how its working, so as I can make better use of it. I have no screenshot to post. and my output file wont tell anything

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 17 Oct 2011

Hello,

I talk about this part of the post:
Im trying to use the
sessionendtime and sessionfirstbattime into my trades.
They have 2 parameters:
Sessiontype
sessionnumber

1- what's the difference between regular type or autodetect? it seems to do the same
2- I used the currentsession variable to print and see what are the numbers in my chart.
Ive found out that the session number is increasing for each line defined in the session I chose. Is that right???
In each of these lines, I have a "session end" box which I can check or uncheck.
What is it for??
I thought that if left unchecked the session will continue over the next line and will not end. But not. the session number is increasing anyway.
I just want to understand how its working, so as I can make better use of it. I have no screenshot to post. and my output file wont tell anything
see post #2.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 03 Nov 2011

post2?
Ive answered in post3

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 05 Nov 2011

Code: Select all

print( "test --------" + NumToStr(Time,0) + " " + NumToStr(CurrentSession(0),0));
condition10 =(time>SessionEndTime(0,1)+1 and time[1]<=SessionEndTime(0,1)+1);

if condition10 then
print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
this code got an error in running time, when using a 1 min frame.
STD exception: invalid argument
With 15 mins it does not.

Why? How can I make it work?

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 05 Nov 2011

This is the definition of the session i use
the error comes on thursday around 17
Last print is "test --------1111103 1645 9"
Attachments
session.gif
my session
(53.87 KiB) Downloaded 3024 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 05 Nov 2011

Code: Select all

print( "test --------" + NumToStr(Time,0) + " " + NumToStr(CurrentSession(0),0));
condition10 =(time>SessionEndTime(0,1)+1 and time[1]<=SessionEndTime(0,1)+1);

if condition10 then
print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
this code got an error in running time, when using a 1 min frame.
STD exception: invalid argument
With 15 mins it does not.

Why? How can I make it work?
I have tested the code; it runs without problem.

Please copy and paste the whole error message.
Please post a snippet of your print out.
Post a screen shot whenever possible.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 06 Nov 2011

screen with the error
Attachments
error invalid arg.gif
(196.83 KiB) Downloaded 3029 times

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 06 Nov 2011

the print out;

and again the code in my indicator;

Code: Select all

print( "test --------" +NumToStr(Date,0) +" "+ NumToStr(Time,0) + " " + NumToStr(CurrentSession(1),0) +"/" + NumToStr(sessioncount(1),0) );
condition10 =(time>SessionEndTime(1,1)+1 and time[1]<=SessionEndTime(1,1)+1);

if condition10 then
print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
Ive chose the "cme combined" session in the chart settings.
Ive nothing else in my chart except this indicator.

I ve just tried again now, and I still have the error.
Attachments
print out.txt
(95.95 KiB) Downloaded 544 times

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 06 Nov 2011

the print out;

and again the code in my indicator;

Code: Select all

print( "test --------" +NumToStr(Date,0) +" "+ NumToStr(Time,0) + " " + NumToStr(CurrentSession(1),0) +"/" + NumToStr(sessioncount(1),0) );
condition10 =(time>SessionEndTime(1,1)+1 and time[1]<=SessionEndTime(1,1)+1);

if condition10 then
print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
Ive chose the "cme combined" session in the chart settings.
Ive nothing else in my chart except this indicator.

I ve just tried again now, and I still have the error.

this is not the same code as the one you posted above.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 06 Nov 2011

here the one before

Code: Select all

//print( "test --------" +NumToStr(Date,0) +" "+ NumToStr(Time,0) + " " + NumToStr(CurrentSession(0),0) +"/" + NumToStr(sessioncount(0),0) );
//condition10 =(time>SessionEndTime(0,1)+1 and time[1]<=SessionEndTime(0,1)+1);
i grayed it to check with 1 if any diff
and i add the total number of sessions

but no diff between the 2 codes
same error at same time

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 06 Nov 2011

what is your computer local time?
what is the chart time? local time or exchange time?

if your local time is in a different zone from exchange time,
I would recommend that you set your chart and symbol to exchange time.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 06 Nov 2011

Chart and symbol are exchange time

my computer is local time in france

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Session and Autotrade

Postby JoshM » 07 Nov 2011

the print out;

and again the code in my indicator;

Code: Select all

print( "test --------" +NumToStr(Date,0) +" "+ NumToStr(Time,0) + " " + NumToStr(CurrentSession(1),0) +"/" + NumToStr(sessioncount(1),0) );
condition10 =(time>SessionEndTime(1,1)+1 and time[1]<=SessionEndTime(1,1)+1);

if condition10 then
print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
The code compiles here correctly, and gives no error when added to a chart (EUR/USD with CME Equity Index Futures [Combined] template). (Edit: also no problems with ES continuous future contract, same template, time set to exchange).

Code: Select all

test --------1110726 330 3/10
test --------1110725 2145 1/5
test --------1110726 335 3/10
test --------1110725 2150 1/5
test --------1110726 340 3/10
test --------1110725 2155 1/5
test --------1110726 345 3/10
test --------1110725 2200 1/5
test --------1110726 350 3/10
test --------1110725 2205 1/5
test --------1110726 355 3/10
test --------1110725 2210 1/5
test --------1110726 400 3/10
test --------1110725 2215 1/5
test --------1110726 405 3/10
test --------1110725 2220 1/5
test --------1110726 410 3/10
test --------1110725 2225 1/5
test --------1110726 415 3/10
test --------1110725 2230 1/5
test --------1110726 420 3/10
test --------1110725 2235 1/5
test --------1110726 425 3/10
test --------1110725 2240 1/5
test --------1110726 430 3/10
test --------1110725 2245 1/5
test --------1110726 435 3/10
test --------1110725 2250 1/5
test --------1110726 440 3/10
test --------1110725 2255 1/5
test --------1110726 445 3/10
test --------1110725 2258 1/5
test --------1110726 450 3/10
test --------1110725 2311 2/5
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
This works both with chart set to Exchange or Local time, and also in PlayBack (that you used in the screenshot). I'm in the same time zone as France, so that also can't explain it.

In other words, the STD Exception error has to originate from somewhere else, in my opinion.

Regards,
Josh

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Session and Autotrade

Postby Henry MultiСharts » 07 Nov 2011

Code: Select all

print( "test --------" + NumToStr(Time,0) + " " + NumToStr(CurrentSession(0),0));
condition10 =(time>SessionEndTime(0,1)+1 and time[1]<=SessionEndTime(0,1)+1);

if condition10 then
print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
this code got an error in running time, when using a 1 min frame.
STD exception: invalid argument
With 15 mins it does not.

Why? How can I make it work?
Hello Sir.
Please let me know who is your datafeed and what exact version of MultiCharts are you running.
Please also attach the workspace you are using for analysis.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 07 Nov 2011

datafeed: esignal
multichart version: 7.0 Release (Build 4510)
here attached: the workspace.
there's nothing on it except these 2 lines code
Attachments
test.wsp
test workspace
(50.76 KiB) Downloaded 457 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Session and Autotrade

Postby Henry MultiСharts » 08 Nov 2011

Sir please export the data for ES #F symbol from eSignal.
You can do it in Quote Manager->right click on ES #F->Export data->Export instrument.

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 08 Nov 2011

To export and send it to you?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Session and Autotrade

Postby Henry MultiСharts » 08 Nov 2011

Yes please send it to my email support@multicharts.com

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 08 Nov 2011

Ok. Im at work now. Ill dot it when ill be at home in about 2, 3 hours

HummerH1
Posts: 66
Joined: 13 Sep 2011
Has thanked: 6 times
Been thanked: 1 time

Re: Session and Autotrade

Postby HummerH1 » 08 Nov 2011

Sent

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Session and Autotrade

Postby Henry MultiСharts » 17 Nov 2011

Code: Select all

print( "test --------" + NumToStr(Time,0) + " " + NumToStr(CurrentSession(0),0));
condition10 =(time>SessionEndTime(0,1)+1 and time[1]<=SessionEndTime(0,1)+1);

if condition10 then
print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
this code got an error in running time, when using a 1 min frame.
STD exception: invalid argument
With 15 mins it does not.

Why? How can I make it work?
STD exception issue is confirmed as a bug.
It will be fixed in Multicharts 7.4
This version is expected in a week.
There is no exact release date at the moment.

Erik Pepping
Posts: 74
Joined: 25 Aug 2007
Been thanked: 6 times

Re: Session and Autotrade

Postby Erik Pepping » 27 Nov 2011

As an extra point to this. Keep in mind that Stop for profit ans stoploss with SetProfitTarget and SetStopLoss are sent to the broker. I found out that for instance IB fills your stops before market. or After market sometimes, regardless of your session settings. This is off course logical, but still keep it in mind.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 27 Nov 2011

As an extra point to this. Keep in mind that Stop for profit ans stoploss with SetProfitTarget and SetStopLoss are sent to the broker. I found out that for instance IB fills your stops before market. or After market sometimes, regardless of your session settings. This is off course logical, but still keep it in mind.
You have to set in TWS to not fill orders outside of RTH.

Erik Pepping
Posts: 74
Joined: 25 Aug 2007
Been thanked: 6 times

Re: Session and Autotrade

Postby Erik Pepping » 27 Nov 2011

yes but that means that for instance for dax futures it does not trade after 17.30. But i want that. I do not want it in the morning however. I do not think that is an option.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Session and Autotrade

Postby TJ » 27 Nov 2011

yes but that means that for instance for dax futures it does not trade after 17.30. But i want that. I do not want it in the morning however. I do not think that is an option.
Every tool has a specific purpose.

SetProfitTarget and SetStopLoss are GLOBAL exits.

If your activities are NOT Global... don't use them.

Please read post #3 in detail:
viewtopic.php?f=16&t=6929


Return to “User Contributed Studies and Indicator Library”