Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/12/2005(UTC) Posts: 141 Location: Brooklyn,NY
|
For the life of me I cant get metastock to close a position on the same day or when a certain condition is met.I can't figure what I'm doing wrong.
In system test:
Buys:open<= (Ref(C,-1)*.98) {this looks for 2% down gap}
Sells:close
In the system editor I have no other parameters,under the sell order tab I tried "market","limit","stop limit","stop".
None gave the result I wanted.All positions where closed on the following bar like if it was being delayed by one bar but I can't find where this is coming from .
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Quote:open<= (Ref(C,-1)*.9 {this looks for 2% down gap}
Not sure about that gap down formula, SR. You should check it out in the Explorer to see if it's what you're wanting. A gap down is when yesterday's low is > today's high. Your formula doesn't make this reference. Check out something like this:
[code:1:cf68b1b9bb]ColA GapDown()
ColB yl:=Ref(L,-1);
(yl-H)/yl*100
Filter colA=1 AND colB>=2[/code:1:cf68b1b9bb]
Compare that to what you're using now and look at the difference.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Sportrider
I'm repeating myself, but as I have no clue how to direct you to a post I made yesterday, here goes again.
Forward reference the Buy Order signal, then delay the application of that signal by using a delay in the simulation. I assume you're using MS 8.01 or above. If you still have 8.0 then get the free update from Equis to get rid of many EST bugs in the first release of the EST.
{Buy Order}
Entry:=Open<= (Ref(C,-1)*.98;
Ref(Entry,+1);
{Sell Order}
Exit:=Open<= (Ref(C,-1)*.98;
Exit;
The Buy Order is advanced by one bar, then delayed in the simulation to apply it to the correct bar. No advances or delays are applied to the Sell Order.
Using a forward reference tricks the EST into checking entry conditions one bar before the exit signal. Then the delay applied in the simulation executes the entry on the bar you intended. The only drawback that I'm aware of with this trick is that the very last bar does not get included in your test, for obvious reasons.
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/12/2005(UTC) Posts: 141 Location: Brooklyn,NY
|
Thanks ,I got it solved with your help.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/12/2005(UTC) Posts: 141 Location: Brooklyn,NY
|
For some reason every time I put the number eight I get the emotion face.
So that number is really a"." with a "nine" and an "eight"after the point.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Put your formulas within the code [] brackets. That will prevent the emoticon shortcuts from appearing.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/12/2005(UTC) Posts: 141 Location: Brooklyn,NY
|
Hello
I think I spoke too soon-I swore I had this one working but somehow when I went to continue my work
for some reason I can't get it to plot like I did before so it makes me figure maybe I was doing something wrong in the first place.Roy I tried your method but I think I'm missing something because I can't get it to work.
This is what I'm trying to test:{2% gap down from previous close}[OPEN<=(REF(C,-1)*.98;]
{ exit when it fills the gap on that bar if not exit at the close of that bar}[H=REF(C,-1); ]
{if this does not happen then exit at close of that bar}[CLOSE;]
Some how when I tell metastock to exit on close it exits on close of next bar.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Sportrider
MetaStock will exit on the current bar as long as it decides there is NOT an entry on the same bar. Don't try to fix the exit because that's not where the problem is.
Your entry formula must be forward referenced in the Buy window (and Price window if used), then delayed by one bar using one of the available tick boxes to realign the Buy timing and couteract the deliberate code offset (1 bar forward reference.)
If you still can't get it to work, email me your code and I'll look at it over the weekend. My address is rlarsen@man.quik.co.nz. I have to do some work with the System Tester anyway so it shouldn't be too much of a chore, but make sure you include all information you can - I won't have access to this site.
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/12/2005(UTC) Posts: 141 Location: Brooklyn,NY
|
Thanks Roy,I will try again before I email you.Thanks .
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Sportrider
As per my private reply, the Buy Order window (and Limit price window) must be forward referenced by one bar, and the Strategic delay enabled for the Buy. Using a Simulation delay to offset the forward reference does not work, probably because that delay is applied to both Buy and Sell signals rather than just the Buy signal.
Roy
MetaStock Tips & Tools
|
|
|
|
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.