Value of a bar at a certain time from last session?  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Value of a bar at a certain time from last session?

Postby LRP » 23 May 2019

Hi All

I do like to get the Close of a bar from a certain time (eg. 17:30) during the last session (yesterday).

How to get this value as easy as possible?

Thank you very much for your appreciated help.
LRP

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

Re: Value of a bar at a certain time from last session?

Postby TJ » 23 May 2019

A few questions:

1. Do you only need the data from the previous session?

2. Is this a recurring request?

3. Do you need a specific time? or the time is different for every request?

4. When do you make the request?
eg at 1730 today, you want to know the close of 1730 the previous day?

User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Re: Value of a bar at a certain time from last session?

Postby LRP » 23 May 2019

A few questions:

1. Do you only need the data from the previous session?

2. Is this a recurring request?

3. Do you need a specific time? or the time is different for every request?

4. When do you make the request?
eg at 1730 today, you want to know the close of 1730 the previous day?


yes, it is an intraday Chart and i need everyday always that close from the previous session of the bar at 17:30 during the full current session until the end of it.

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

Re: Value of a bar at a certain time from last session?

Postby TJ » 23 May 2019

OK, this is a simple requirement.

All you need is to set up a variable,
then at 1730 every day, assign the close price to the variable.
this variable is available for you to recall at any time in the future.

eg.

Code: Select all

var: price.at.1730(0);

if time = 1730 then price.at.1730 = Close;

User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Re: Value of a bar at a certain time from last session?

Postby LRP » 24 May 2019

Thanks a lot TJ, but as soon 17:30 is reached (today) I will get a new but unwanted value. Instead I do like to keep the close 17:30 value from yesterday until the end of the session. I tried a lot but can not find the solution to keep that 17:30 Close value from yesterday until the session ends today at eg. 22:00. Thank you again for your help.

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

Re: Value of a bar at a certain time from last session?

Postby TJ » 24 May 2019

Thanks a lot TJ, but as soon 17:30 is reached (today) I will get a new but unwanted value. Instead I do like to keep the close 17:30 value from yesterday until the end of the session. I tried a lot but can not find the solution to keep that 17:30 Close value from yesterday until the session ends today at eg. 22:00. Thank you again for your help.
What is your trading session time?

User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Re: Value of a bar at a certain time from last session?

Postby LRP » 24 May 2019

from 0800 until 2200 local time but officially closed at 1730

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

Re: Value of a bar at a certain time from last session?  [SOLVED]

Postby TJ » 24 May 2019

Try this:

Code: Select all


var: price.at.1730(0), temp(0);

if time = 1730 then temp = Close;

if time = 2200 then price.at.1730 = temp;

User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Re: Value of a bar at a certain time from last session?

Postby LRP » 24 May 2019

Perfect, it works! Thank you very much for your appreciated help TJ.
Kind regards, LRP

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

Re: Value of a bar at a certain time from last session?

Postby TJ » 24 May 2019

Perfect, it works! Thank you very much for your appreciated help TJ.
Kind regards, LRP
You are welcome.

Where there is a will, there is a way.


Return to “MultiCharts”