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

Notification

Icon
Error

Options
Go to last post Go to first unread
STNewbie  
#1 Posted : Thursday, June 25, 2009 11:07:16 PM(UTC)
STNewbie

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/25/2009(UTC)
Posts: 7

Hi i am testing a system where the Short exit is a simple formula that close < Ref(Close,-1) However metastock is not taking this simple formula properly. Following is the chart. http://i41.tinypic.com/6yih3n.jpg Kindly note the system enters/exits on the next day of getting the signal. As you can see that the problem is in 5th signal, it shouldn't have exited, 6th signal is the right one, where it exited according to the rule. I have looked everywhere but i couldn't find a similar error. Could someone help me out in telling what could be the problem? Thanks is advance.
wabbit  
#2 Posted : Friday, June 26, 2009 5:31:14 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)
Huh?

I am guessing your code is incomplete?



wabbit [:D]

STNewbie  
#3 Posted : Friday, June 26, 2009 10:13:48 AM(UTC)
STNewbie

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/25/2009(UTC)
Posts: 7

No, thats my Short exit condition. Its the simplest exit condition that i have used. If you are referring to the Short Entry code...then its something like: Ref(Close,-2)> Ref(Close,-3) and ( Ref(High,-1)-Ref(Low,-1) > 1.0*(Ref(High,-2)-Ref(Low,-2)) and Ref(Close,-1)<ref(Close,-2) ) and ( (Ref(Volume,-1) > Mov(Ref(Volume,-1),OPT2,S)) OR ( Ref(Volume,-1) > Mov(Ref(Volume,-1),OPT2+1,S)) or (Ref(Volume,-1) > Mov(Ref(Volume,-1),OPT2+2,S)) ) and ( (High-Low)<(Ref(High,-1)-Ref(Low,-1)) and ( Volume < Mov(Volume,OPT2,S) and close<0.75*(High+Low) and close < ref(C,-1) ) OR ( Close<ref(C,-1) and Volume> Mov(Volume,OPT2,S) ) ) and Mov(Close,OPT4,E)>Close ... I guess that was not the problem. Problem was that it was exiting where it shouldn't have. In some cases it was exiting properly and in other cases it was exiting improperly. i am confused why is it doing such thing. I have posted the link of the JPG image in which you can see the wrong and right both things. I am banging my head against this problem for last 1 week. Can you help me out?
wabbit  
#4 Posted : Friday, June 26, 2009 11:00:03 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)
By providing the exit signal simply as "CLOSE" so long as this is not zero, MS will interpret this as TRUE and exit on the first bar after the entry of the trade (this depends on what delays have been set in the EST); do some research on how MS does its Boolean analysis. Do you want to compare the CLOSE price with something else?

Also, dealing with incomplete codes and "something like" snippets which contain errors does very little to assist us in finding the cause of your code problems. Please post the whole code to the forum as exactly as it appears in your formula editor so that we can try to identify the root of the problem instead of wasting our time trying to fill-in the gaps of the pieces of code you have purposely omitted.

I have seen the jpg in the link you have provide, and by my brief glance at the unadorned chart, the EST has done exactly what you have told it to do in the one, short line of code you provided for the buy-to-cover criteria. Had you provided a word-description of what your system should be doing, we could have compared the word-description with the code-description to identify the shortcomings; you could have annotated the chart with some embellishment in the form of textual descriptions highlighting the errors because the casual peruse of the chart shows no errors what-so-ever.


wabbit [:D]


STNewbie  
#5 Posted : Friday, June 26, 2009 2:13:18 PM(UTC)
STNewbie

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/25/2009(UTC)
Posts: 7

Hi wabbit, First of all i apologize for the casual description of the problem. The code and EST is perfectly following the logic in the short entry criteria. The short exit criteria, however was that it should close when the previous close is lower than the the current close. Close is less than ref(Close,-1). ( For some reasons i am not able to post the formula, should have read the forums rules with a coffee cup in my hand, with coffee in it. ) ( the formula, BTW, is the subject line of the thread) Now this is the link of the new chart, With the error mentioned in the chart http://i43.tinypic.com/9ftf5t.jpg The thing is that i have "checked" the realistic market prices. So each signal get executed on the next day. In the chart, however, if you see that the 5th signal exit is incorrect one. The exit should not have been there since the close ( on the day prior to the exit signal ) is > Ref(Close,-1) thats the close just before the short entry signal. The 6th signal, is working perfectly fine with the close ( Close) of the day prior to exit is lower than the close of the day( Ref(Close,-1) just before that. Again, i apologize for the earlier lousy description of the problem and hope that i have made my problem clear. Peace. STNewbie.
wabbit  
#6 Posted : Friday, June 26, 2009 6:03:55 PM(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)
STNewbie wrote:
The short exit criteria, however was that it should close when the previous close is lower than the the current close. Close is less than ref(Close,-1). ( For some reasons i am not able to post the formula, should have read the forums rules with a coffee cup in my hand, with coffee in it. )


How to posts containing formula: http://forum.equis.com/forums/permalink/19754/20302/ShowThread.aspx#20302,OPT2+1,S)) or (Ref(Volume,-1) > Mov(Ref(Volume,-1),OPT2+2,S))
)
and
(
(High-Low)
(Volume )
OR
(Close
Mov(Volume,OPT2,S)
)
)
and
Mov(Close,OPT4,E)>Close
[/code]

Code:
{Short Exit - Buy to cover}
C < Ref(C,-1);


STNewbie wrote:
Now this is the link of the new chart, With the error mentioned in the chart http://i43.tinypic.com/9ftf5t.jpg


How post inline images: http://forum.equis.com/forums/permalink/19928/19928/ShowThread.aspx#19928


STNewbie  
#7 Posted : Friday, June 26, 2009 11:48:40 PM(UTC)
STNewbie

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/25/2009(UTC)
Posts: 7

Hi wabbit,

Thanks for replying again. If the short entry code is wrong i will try and fix that. But as i said i have no issues with that part of the code.

I have problem with the exit. I am ok with the trades being exited one day later than when the signal was generated.

The only problem that i think i have is that it is exiting on the wrong logic on the fifth exit.

So, as my original question was is that the

---------
C < Ref(C,-1)
--------

is it working properly in the buy to cover formula?

Because, as i said in my last post, also the exit should not have been there since the close ( on the day prior to the exit signal ) is > Ref(Close,-1) thats the close just before the short entry signal. The 6th signal, is working perfectly fine with the close ( Close) of the day prior to exit is lower than the close of the day( Ref(Close,-1) just before that.

So essentially, i am troubled with the buy to cover signal, doesn't matter whether it comes on the same day as of the enter short signal or one day after that. It should just follow the logic.

So am i mistaken in logic? Am i not putting the formula correctly?


wabbit  
#8 Posted : Saturday, June 27, 2009 12:43:21 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)
What do the EST orders log say about the problematic 5th trade?

Have you set any stops?


wabbit [:D]

STNewbie  
#9 Posted : Saturday, June 27, 2009 1:58:42 AM(UTC)
STNewbie

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/25/2009(UTC)
Posts: 7

I assume by trade log you meant the Order log that you can see in each report?

I see Margin call. Is that the problem, coz i cant see that thing anywhere else in the signals.

i haven't put any stops.

Still no correct answer.

:(




wabbit  
#10 Posted : Saturday, June 27, 2009 3:36:43 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)
You're probably devoting 100% of your available equity to each trade? and then getting a margin call as soon as the price goes even slightly against you. Just like in real life, if you don't have sufficient margin, your position will be automatically closed by the EST.

Use a better position size algorithm.


wabbit [:D]

STNewbie  
#11 Posted : Saturday, June 27, 2009 8:56:25 AM(UTC)
STNewbie

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/25/2009(UTC)
Posts: 7

wabbit wrote:
You're probably devoting 100% of your available equity to each trade? and then getting a margin call as soon as the price goes even slightly against you. Just like in real life, if you don't have sufficient margin, your position will be automatically closed by the EST.

Use a better position size algorithm.


wabbit [:D]



Thats it. ! That was it. I changed my position sizing algorithm and it worked like a canary singing.

Thank you wabbit.

:D
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.