Intrabar exit

Questions about MultiCharts and user contributed studies.
skan
Posts: 36
Joined: 15 Jul 2010

Intrabar exit

Postby skan » 29 Jul 2010

Hello.

I have an strategy that works on 15 min bars.

I need the strategy to exit 1 minutes before the session ends.
I've already tried to run it on 1min bars but no combination of the parameters work as well as before and it's much slower.

I've thought in different ways to get it.


a)
Open a 1 min chart on Data1 and another 15min chart on Data2
change the code in order to run the strategy on Data2
add a time exit on Data1
I've tried it but it doesn't run as expected, it's quite confusing

b)
On the same 15 min bars chart add the original strategy
and add a new one with intrabarordergeneration=true
is it the right way?
Any advise?

thanks

SUPER
Posts: 624
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

Postby SUPER » 29 Jul 2010


User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Intrabar exit

Postby Dave Masalov » 30 Jul 2010

Dear skan,

Yes, b) is the right way. Here is the example of the code:

Code: Select all

[intrabarordergeneration=true]

input: Time_Beg_Close(1659), Time_End_Close(1700);

if datetime2eltime(computerdatetime) >=Time_Beg_Close and datetime2eltime(computerdatetime) <= Time_End_Close then
begin
  sell next bar at market;
  buy to cover next bar at market;
end;


Return to “MultiCharts”