open positon on Open?

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
siscop
Posts: 193
Joined: 09 Jan 2011
Has thanked: 34 times
Been thanked: 25 times

open positon on Open?

Postby siscop » 26 Jan 2011

Hi,
I wanted to backtest an idea but the entry is calculated on the openprice and an immediate entry (at open) when certain criteria is confirmed. The exit would be the close of that same bar (close).
I can close the order with the command “sell this bar on close”.
The only way to open an order according the documentation is with the bar close or next bar open.
Is there a way to open at this bar on open and close the position on the same bar close?
In the way…

Code: Select all

Condition1=open>something;
If condition1 then
buy this bar on open;
If marketcondition=1 then
Sell this bar on close;
//obviously this code doesn’t work. But maybe one of you guys know a way?
I know this could be done by a smaller timeframe and intrabarordergeneration but I don’t have smaller TimeFrame date. I do think this would be unnecessary since I have all data I need on that timeframe since I only require the OHLC data.
I have done this with Excel but MC has a great backtest function and the backtestresults are way better then from that what I get from Excel.

User avatar
TJ
Posts: 7250
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Re: open positon on Open?

Postby TJ » 26 Jan 2011

Hi,
I wanted to backtest an idea but the entry is calculated on the openprice and an immediate entry (at open) when certain criteria is confirmed. The exit would be the close of that same bar (close).
I can close the order with the command “sell this bar on close”.
The only way to open an order according the documentation is with the bar close or next bar open.
Is there a way to open at this bar on open and close the position on the same bar close?
In the way…

Code: Select all

Condition1=open>something;
If condition1 then
buy this bar on open;
If marketcondition=1 then
Sell this bar on close;
//obviously this code doesn’t work. But maybe one of you guys know a way?
I know this could be done by a smaller timeframe and intrabarordergeneration but I don’t have smaller TimeFrame date. I do think this would be unnecessary since I have all data I need on that timeframe since I only require the OHLC data.
I have done this with Excel but MC has a great backtest function and the backtestresults are way better then from that what I get from Excel.
what chart resolution you are using?

User avatar
siscop
Posts: 193
Joined: 09 Jan 2011
Has thanked: 34 times
Been thanked: 25 times

Re: open positon on Open?

Postby siscop » 27 Jan 2011

I wanted to use this backtest feature of MC on a D1 chart where I don’t have smaller TF data -> freequote
I want to use this only for backtesting and not for live trading.

User avatar
TJ
Posts: 7250
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Re: open positon on Open?

Postby TJ » 27 Jan 2011

Normally
Autotrades are calculated once per bar, at EOB (end of bar).

If intrabarordergeneration is enabled, calculation will be done every tick.



You cannot buy THIS BAR AT OPEN...

think about this sequentially:
You will need the opening tick to trigger the OPEN event,
by the time the opening tick is received, the OPEN event is gone !
The best you can do is buy at the the tick after the open.

User avatar
siscop
Posts: 193
Joined: 09 Jan 2011
Has thanked: 34 times
Been thanked: 25 times

Re: open positon on Open?

Postby siscop » 27 Jan 2011

I do understand that in normal cases you can only buy after the open. But only with EOD data going several years back an the entrycondition is calculated on the openprice of a bar that is all I have.
There has to be a way just to tell MC to go long with the openprice and close the position with the closeprice. Even Excel can do that.
I dont neet this specification that you can only enter a tick after the open since I dont have this data.
I like the resultpresentation of MC.
Do you know a workaround for the openentry?
Do I really need one tickprice which is the same as the openprice and tell MC to go intrabar?
as OOHLC just to open at the second Openprice?

I just hoped that there is some secret code just for backtests which is not documented since this code can not be used for live trading - so useless and not documentable.

User avatar
TJ
Posts: 7250
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Re: open positon on Open?

Postby TJ » 27 Jan 2011

...
There has to be a way just to tell MC to go long with the openprice and close the position with the closeprice.
Even Excel can do that. ....
Because Excel is NOT a trading program.

A trading program must work within the confines of reality... ie. execute sequenced events dictated by time and price.

User avatar
TJ
Posts: 7250
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Re: open positon on Open?

Postby TJ » 27 Jan 2011

...
Do you know a workaround for the openentry?
Do I really need one tickprice which is the same as the openprice and tell MC to go intrabar?
as OOHLC just to open at the second Openprice?

I just hoped that there is some secret code just for backtests which is not documented since this code can not be used for live trading - so useless and not documentable.
your concept is intraday...
so to test your idea, you will need intraday data.

User avatar
siscop
Posts: 193
Joined: 09 Jan 2011
Has thanked: 34 times
Been thanked: 25 times

Re: open positon on Open?

Postby siscop » 27 Jan 2011

k thx

User avatar
piranhaxp
Posts: 241
Joined: 18 Oct 2005
Has thanked: 4 times
Been thanked: 30 times

Re: open positon on Open?

Postby piranhaxp » 30 Jan 2011

Honestly .... I am totally tired to hear that someone has to be able to buy or sell at the open price. And the software has to be able to do it and to know the opening price. To know the opening price ? Yes, because everyone who is requesting the software vendor to make it possible to act at the open is requesting the point which will never happen. You never know the OPEN until the open tick "happened" ! So how the software should know ? How the software should buy or sell at this unknown price ? It is impossible ..... I am laughing if I read that Excel can do this on the EOD base ? Ask yourself how it should ? It is an illusion ! How Excel knows when and where to buy or to sell ? How it know when the market is open ? And by the way, talking on EOD base is a totally different thing. Because it is just acting at market on the next bar and has nothing to do with defining "Open" of the next day. If all quants are working on that issue, why we should or MC should be able to fix it. BECAUSE IT IS IMPOSSIBLE. It is just a project for handling order issues on a specific market condition. So stop thinking faster then the price (market) is. So sometimes you have to accept it. There is no solution and will be no solution in the future .....

Regards.

Mike


Return to “User Contributed Studies and Indicator Library”