Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 07-29-2010, 06:56 AM   #1

Join Date: Jan 2010
Location: Valencia
Posts: 26
Ignore this user

Thanks: 0
Thanked 2 Times in 1 Post

Intrabar Exit, Easylanguage

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=t rue
is it the right way?
Any advise?

thanks
skan is offline  
Reply With Quote
Old 07-29-2010, 08:49 AM   #2

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Intrabar Exit, Easylanguage

I would not push an auto-strategy to the last minute, for several reasons:

1. most brokers require the last order at least 3 minutes before session end to ensure a proper fill.

2. if something happens between you and the broker at the last minute (e.g. internet, computer hiccup, etc),
you will have no alternative until the next session.

3...
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 07-29-2010, 08:53 AM   #3

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Intrabar Exit, Easylanguage

you can try this:

Code:
var:
Last.Order.Time(1558);

If currenttime = Last.Order.Time then
begin
    buytocover...
    sell...
end;

p.s. you will need intrabarordergeneration to execute anything intrabar.
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 07-29-2010, 11:43 AM   #4

Join Date: Jan 2010
Location: Valencia
Posts: 26
Ignore this user

Thanks: 0
Thanked 2 Times in 1 Post

Re: Intrabar Exit, Easylanguage

Quote:
Originally Posted by Tams »
you can try this:

Code:
var:
Last.Order.Time(1558);

If currenttime = Last.Order.Time then
begin
    buytocover...
    sell...
end;

p.s. you will need intrabarordergeneration to execute anything intrabar.


Hello

But how can I activate IntraBarOrderGeneration just for this part of the code and not for all the strategy ??
Do I need to add IntraBarOrderGeneration=T RUE in the functions too ?

If I put 2 strategies on the same chart and one of them buys ... can I detect marketposition change from the other one? Or each strategy detects only its MP changes??


When working with intrabarordergeneration=T RUE... if I say Close[1] I mean the close of one bar ago.
How do I get the value of 3 ticks ago?

thanks

Last edited by skan; 07-29-2010 at 12:33 PM.
skan is offline  
Reply With Quote
Old 07-29-2010, 12:27 PM   #5

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Intrabar Exit, Easylanguage

if your idea is to close all position at end of day,
you can use SetExitOnClose.
but you have to set your session time to X minutes before the actual close,
because it is practically not possible to submit an order at the last tick.
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 07-29-2010, 12:30 PM   #6

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Intrabar Exit, Easylanguage

Quote:
Originally Posted by skan »
Hello

But how can I activate IntraBarOrderGeneration just for this part of the code and not for all the strategy ??
Do I need to add IntraBarOrderGeneration=T RUE in the functions too ?
IOG is for the whole strategy, not a particular line.


Quote:
Originally Posted by skan »
If I put 2 strategies on the same chart and one of them buys ... can I detect marketposition change from the other one? Or each strategy detects only its MP changes??

thanks
read up on:

MarketPosition_at_Broker
MarketPosition_at_Broker_ for_The_Strategy
__________________



Only an idiot would reply to a stupid post

Last edited by Tams; 07-29-2010 at 12:40 PM.
Tams is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Exit Trades Based on Price Action? keymoo Trading and the Markets 17 07-09-2011 12:14 AM
How to Do a Time Stop with Easylanguage cunparis Coding Forum 11 07-13-2010 07:03 AM
NumericSeries and Arrays in Easylanguage nsvv Automated Trading 10 07-13-2010 03:39 AM
EasyLanguage Going Object Oriented ! Tams Tools of the Trade 24 07-03-2010 09:49 AM
Easylanguage at What Price trader273 Coding Forum 1 05-22-2010 11:23 PM

All times are GMT -4. The time now is 03:00 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.