intrabar Time access

Questions about MultiCharts and user contributed studies.
dario
Posts: 31
Joined: 01 Dec 2015
Has thanked: 7 times
Been thanked: 1 time

intrabar Time access

Postby dario » 12 Dec 2015

Hi to all,
I use timeFrame Daily with [IntrabarOrderGeneration = true]; and BarMagnifier = 1 minute.

I have tried to use

Code: Select all

if(time = 1655 and marketposition > 0) then sell next bar at market;
to exit at specific time inside daily bar but it doesn't work.

Time seems to return always the close bar time.

How I can do?

bye

dario
Posts: 31
Joined: 01 Dec 2015
Has thanked: 7 times
Been thanked: 1 time

Re: intrabar Time access

Postby dario » 12 Dec 2015

I read about datetime_bar_update so I used this :

Code: Select all

if(DateTime2ELTime(datetime_bar_update) = 1655 and marketposition > 0) then sell next bar at market;
if(DateTime2ELTime(datetime_bar_update) = 1655 and marketposition < 0) then buy to cover next bar at market;
is it correct for backtesting?

But in realTime i must replace DateTime2ELTime(datetime_bar_update) with time, right?

tony
Posts: 420
Joined: 14 Jun 2013
Has thanked: 30 times
Been thanked: 81 times
Contact:

Re: intrabar Time access

Postby tony » 12 Dec 2015

It's because you are using time frame of daily, thus time does not equal 1655. You'll need to reference time in another format, such as computerdatetime or something else. Time is closing bar time of the current bar in data1, in your case one full day.

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

Re: intrabar Time access

Postby TJ » 12 Dec 2015

You might think you are trading a Daily bar,
but in reality you are trading intra day,

ie. your coding must cater to your intra day methodology.

Trying to shoe-horn an intra day method into a daily chart is not going to produce easy results.



Suggestion: See post #18
viewtopic.php?f=16&t=10811


Return to “MultiCharts”