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



Go to last post Go to first unread
#1 Posted : Tuesday, October 15, 2019 4:43:15 PM(UTC)

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 10/13/2019(UTC)
Posts: 2

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)

Hi all,

I feel a bit embarassed since I have to bother you here, but been trying to understand this issue for a couple days and I am a step away from giving up. Feeling (sort of) comfortable with basic formulas and systems, but there came a twist that is sort of above me.

To make it a bit organized, wanna tell you a buit about the background. Developed some external indicator for investment strategy. Calling it investment strategy, since the signals come once a year only and, as of now, I am focused on making the best of these.

Converted it into MS file as if it was some security, call it "the Thingy". One signal per year, so it's the same value for each day of the year.

The strategy is simplistic. When the Thingy is positive, I go long. When it turns negative, I reverse and go short. Decided to optimize it to know the best day to enter (and exit). Turned out that moving averages do the trick.

So for I got something like this (writing from memory, but it works like a charm):

Buy: Security("...\THINGY",C)>0 AND C>MOV(C,200,S)

Sell: Security("...\THINGY",C)<0 AND C<MOV(C,200,S)

Sell short: Security("...\THINGY",C)<0 AND C<MOV(C,200,S)

Buy to cover: Security("...\THINGY",C)>0 AND C>MOV(C,200,S)

As you may see, there are no stops or capital management: once the position is open, it will stay there until (at least) the next year. However, I would like to add certain condition that would close the position and wait until the next year. Intuitively, it would be something like (referring to long positions only):

Sell: ( Security("...\THINGY",C)<0 {the old condition} AND {the old condition} C<MOV(C,200,S) {the old condition} ) OR {assuming that coming back under MOV50 means we want to disappear from the market} C>MOV(C,200,S)

Problem: As you may see already, stop may take me out easily. However, in the very same year, I can be taken back (and, possibly out again and back again), which is not what I want. I am desperate for a solution that would allow to either limit the number of entries per year (eg. 1 would mean that trade is entered, but once the stop is triggered, I won't be taken back) or set some cooldown period (eg. once the stop is triggered, there won't be any new positions for as long as, say 100 days).

How can I do it without getting PhD in programming?

Bonus question: I have noticed that: C<MOV(C,200,S) produces slightly different results than: CROSS(C,MOV(C,200,S))

Could you please explain why?

Thank you in advance - have a great week!

MS Support  
#2 Posted : Friday, October 18, 2019 8:52:16 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,722

Thanks: 62 times
Was thanked: 145 time(s) in 141 post(s)


You might be able to use some combination of BarsSince{Sell Condition} > 100 AND IsDefined{Sell Condition} but there could be a few different ways to accomplish what you are looking to do for use in the System Tester. You can also reach out to our formula team at https://www.metastock.com/customer/resources/formulas/customformulaform.aspx if you have difficulty or do not find help here.

Cross is designed to identify only the point of crossover (i.e. a moving average crossing from below to above another moving average). "Greater than" identifies every point where one value is greater than another.

thanks 1 user thanked MS Support for this useful post.
slowthinker on 10/18/2019(UTC)
#3 Posted : Saturday, October 19, 2019 11:08:55 PM(UTC)

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 10/13/2019(UTC)
Posts: 2

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)

Thank you so much, but it turned out such formula is not compatible with System Tester's generic stop loss.

Imposed 10% stop loss on my positions. And once the 10% got triggered (that is: got kicked off my position at 10% loss), the System (correctly) checks whether the conditions to buy are met. They are, unfortunately, so the position gets renewed.

So I have to:

1. Be able to refer to the purchase price (which, apparently, is very tricky) and define my 10% stop loss not as Metastock's generic stop loss, but as sell condition). And I simply don't know how to do that in a simple way.


2. Stick to Metastock's generic stop loss, have it triggered and then suspend/freeze the formular for particular time. Which, I believe, is as tricky as the former case.

Any additional support would be really appreciated since I feel I may run out of options here.

thanks 1 user thanked slowthinker for this useful post.
MS Support on 10/21/2019(UTC)
Users browsing this topic
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.