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
Intrabar exit
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: Intrabar exit
Dear skan,
Yes, b) is the right way. Here is the example of the code:
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;