logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
CrazyHorse  
#1 Posted : Monday, February 20, 2012 8:17:25 AM(UTC)
CrazyHorse

Rank: Member

Groups: Registered, Registered Users
Joined: 2/10/2012(UTC)
Posts: 11

Hello everybody ^^ I need some help to find a way to let my sistem open and close a position in the same day when necessary. The system is quite complex, so I cannot post it here. Anyway the principle is that the entry and the stop prices are both determined the day before the orders are placed. So if only the entry price is triggered the day after everything is fine, but when the price reaches both the entry and the stop prices in the same day it enters the position and closes it only at the open of the next day. I know that there are a lot of threads with this topic, but it seems that the only solution working is using not realistic market prices, with a reference to the future - ref(... , 1) - for the sell signal formula and setting one bar of delay for the immission of the order. This way my sistem doesn't work, since as I explained one of the key point is the price level, that needs to be realistic. I tried using the reference to the future method both in the entry and the stop sections of the system tester....but it doesn't work (it changes something, but doesn't let the executions happen in the same day). Any idea?? thank you for your patience and help :)) Cr@zYhOrSe
jjstein  
#2 Posted : Tuesday, February 21, 2012 2:57:44 AM(UTC)
jjstein

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
CrazyHorse wrote:
The system is quite complex, so I cannot post it here.

If you don't post code, no one can find your errors.

CrazyHorse  
#3 Posted : Tuesday, February 21, 2012 3:21:06 AM(UTC)
CrazyHorse

Rank: Member

Groups: Registered, Registered Users
Joined: 2/10/2012(UTC)
Posts: 11

The problem is that I dont have a working code :/ I tried like this in the 'buy order' and 'sell short order' sections of the tester:
Code:

signal formula: ref("my rules to determine when to enter position", 1)
Limit price: ref("my rules to determine the entry price", 1)
entry size: ref("my rules to determine entry size", 1)
Strategic delay: Days=1 leaving the 'sell order' and 'buy to cover order' with no reference to he future and no strategic delay. then I tried the opposite: a reference to the future in the'sell order' and 'buy to cover' formulas with a strategic delay of one day, leaving the 'buy order' and 'sell short order' with no delay/ref to the future. In both cases it doesn't generate 2 orders (enter/exit of the same position) in the same day.
jjstein  
#4 Posted : Tuesday, February 21, 2012 3:37:30 AM(UTC)
jjstein

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
I suggest you use the features of the "EXPERT Symbols" tab to see if your system is doing what you want/expect.

CrazyHorse  
#5 Posted : Tuesday, February 21, 2012 3:52:56 AM(UTC)
CrazyHorse

Rank: Member

Groups: Registered, Registered Users
Joined: 2/10/2012(UTC)
Posts: 11

You mean the expert advisor? Maybe I didn't explain my problem properly, anyway in all the backtests I made my system is perfect and does exactly what I want. The only problem is that it is not able to open a position and close it in the same day when it is necessary (i.e. the price triggers entry and stop in the same day). When this situation happends it enters and exit at the open of the next day.
jjstein  
#6 Posted : Tuesday, February 21, 2012 4:53:55 AM(UTC)
jjstein

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
CrazyHorse wrote:
in all the backtests I made my system is perfect and does exactly what I want.


CrazyHorse wrote:
The problem is that I dont have a working code :/


If it's working now, post it; otherwise, there's nothing to go on.

CrazyHorse  
#7 Posted : Tuesday, February 21, 2012 8:03:48 AM(UTC)
CrazyHorse

Rank: Member

Groups: Registered, Registered Users
Joined: 2/10/2012(UTC)
Posts: 11

hmm there's some misunderstanding here... My question is totally indipendent from the system rules. My system rules works perfectly, so I dont need to post it here. The problem is that MetaStock doesn't execute 2 orders (opening and closing position) in the same day. The code is good, no errors. IS there some trick in MS to avoid this annoying situation? EXAMPLE: let's suppose I'm creating a system that goes only long. so no sell short/buy to cover formulas are required. I put it like this: BUY ORDER
Code:

cross(mov(C,10,S),mov(C,50,S))
buy order Stop or Limit Price:
Code:

H+0.05
SELL ORDER:
Code:

bearharami()
sell order stop or limit price:
Code:

L-0.05
Let's suppose that on day (t) we have both the buy order and the sell order signal. Let's also suppose that on day (t+1) the HIGH is HIGHER than the buy order price, and the LOW is LOWER than the sell order price. The system tester should execute BOTH entry at Buy Order Price and exit at Sell Order Price, instead it only executes the entry, exiting the position only on day (t+2) at the open. and finally, my question is: Is there a trick or something to let the system execute BOTH the orders on the same day IF both the trigger prices are met? thank you again :)
wabbit  
#8 Posted : Tuesday, February 21, 2012 9:50:32 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
CrazyHorse wrote:
Let's suppose that on day (t) we have both the buy order and the sell order signal. Let's also suppose that on day (t+1) the HIGH is HIGHER than the buy order price, and the LOW is LOWER than the sell order price. The system tester should execute BOTH entry at Buy Order Price and exit at Sell Order Price, instead it only executes the entry, exiting the position only on day (t+2) at the open. and finally, my question is: Is there a trick or something to let the system execute BOTH the orders on the same day IF both the trigger prices are met
How do you know in which order the HIGH and LOW occurred? If you're only looking at daily bars, you have no way of telling if the buy trigger happened before the sell trigger. The only way to identify the order of these two events is to examine the intraday timeframes: functionality no easily implemented in MS. wabbit [:D]
CrazyHorse  
#9 Posted : Tuesday, February 21, 2012 1:21:59 PM(UTC)
CrazyHorse

Rank: Member

Groups: Registered, Registered Users
Joined: 2/10/2012(UTC)
Posts: 11

hehehe I knew someone would have noted it.... but anyway, the system tester does something neither realistic nor logical: 1) If the system tester is conservative (and that's the way I'd like it, and the way it should be imo), it should consider always the entry (in my example the HIGH) before the stop (LOW). At least it should give you the option to choose what to do in this specific case (I think this is something really common on the markets...A lot of good systems I use can create a situation like the one described). 2) if the system thinks that the entry (HIGH) happened after the stop (LOW), it should then wait the price to reach again the stop level on the next days, and not just close the position on the very next day open. Closing on the next day open is illogical, because it implies that a stop signal is generated (as if the stop price is reached after the entry), but it closes at a random price the next day... You don't know if there is as way to set MS system tester as described in point 1 ?
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.