Rank: Newbie
Groups: Registered, Registered Users Joined: 9/15/2009(UTC) Posts: 7
|
Hi at all!
I'm new to MS and I'm here to ask your help. I develop a trading system into strategy tester with great result.
Now I want to apply it to the italian future (Fib) and for this reason I need to pass my forumula from system tester to expert advisor. It seems that no automatic way to do this exist. So I've some question for you.
Have I to rewrite totally my system? Is there any "simply" way to do that?
Strategy tester and Expert advisor have different form, so how do I implements take profit, stop, strategy delay and so on? There exist any tutorial do to this work?
Thanks a lot Massimo
PS: I'm workin on Metastock 10.1
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 5/20/2008(UTC) Posts: 53
|
There are no tutorial for doing that, to my best knowledge.
One way to do it would be to create a formula for you buy & sell signals. Then, in your expert advisor, you'd create the buy & sell signals, and the take profit, stop, strategy delay etc. You would have to write some code but that isn't too difficult.
Let's create a function called "Massimo.Buy" which is your buy signal..
Then you'd create the system "Massimo System".
Then the first signal which would be "Buy" and its code would be : Fml("massimo.buy")
Then you'd create the signal "Stop Buy", coded like that : [censored]y:=20; Cross(C<=valuewhen(1,Fml("massimo.buy"),C)-[censored]y,.1) It means that when the close is lower than the entry price - 20, it would produce a signal.
Then you'd create the signal "Take Profit Buy", code like that : TPbuy:=50;
Cross(C>=valuewhen(1,Fml("massimo.buy"),C)+TPbuy,.1)
And if you want a delayed buy signal, that would be : delay:=5; barssince(Fml("Massimo.Buy"))=delay
Of course that's just a basic overview but I hope I've given you an idea of what you should do. That being said, in order to avoid too much clutter on your graph, you might want to add some additional conditions to your take profit and stop buy signals. A cleaner take profit would be something like : TPbuy:=50;
TPsignal:=Cross(C>=valuewhen(1,Fml("massimo.buy"),C)+TPbuy,.1); TPsignal and ref(Sum(Fml"massimo.buy"-TPsignal,60),-1)>=1
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/15/2009(UTC) Posts: 7
|
Thanks a lot your suggest.
Can I ask you a little more help?
Can you please be more precisely?
I mean...I know only how strategy tester works and only others little thing about MS.
You say:
"Let's create a function called "Massimo.Buy" which is your buy signal.."
Where do I have to create it? As new "Indicator Builder" or as new "Expert Advisor"?
Then, you say:
"Then you'd create the system "Massimo System"."
This I think is simple, just create a new expert advisor :D
And for last: signal has to be implmented under symbols, highlight or Alerts?
So, can you rewrite your previous suggestion like a "Step by step" tutorial, the formula are not important, what I don't understand are the path to do.
Thx
Massimo
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 5/20/2008(UTC) Posts: 53
|
Ok let's try again ^_^
Let's create a function called "Massimo.Buy" which is your buy signal. That should be done using the Indicator Builder.
Then you'd create the system "Massimo System" with the Expert Advisor.
Then the first signal (in Symbols) which would be "Buy" and its code would be : Fml("massimo.buy")
Then you'd create the signal "Stop Buy" (in Symbols), coded like that : [censored]y:=20; Cross(C<=valuewhen(1,Fml("massimo.buy"),C)-[censored]y,.1) It means that when the close is lower than the entry price - 20, it would produce a signal.
Then you'd create the signal "Take Profit Buy" (in Symbols), code like that : TPbuy:=50;
Cross(C>=valuewhen(1,Fml("massimo.buy"),C)+TPbuy,.1)
And if you want a delayed buy signal, that would be : delay:=5; barssince(Fml("Massimo.Buy"))=delay {that's a 5 bars delays ; you can change the 5 as you want}
Placing these in symbols will just plot them on your chart. If you want Metastock to alert you when there a new symbol, you should also create these signals in Alerts. Alerts are pop-ups associated with a sound or an email but that's complicated so I never use the email function.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 5/20/2008(UTC) Posts: 53
|
giomax wrote:So, can you rewrite your previous suggestion like a "Step by step" tutorial, the formula are not important, what I don't understand are the path to do.
Thx
Massimo Oh, the abstract path ! Let me try to explain it. You've built a system, it works fine and you want to create an expert advisor that reproduce its functions. Unfortunately, Metastock does not provide an easy conversion from System to Expert Advisor. Basically, Expert Advisors should only give you entry signals (buy & short) but you also would like to see take profit & stop loss. Oh, before I say anything more, let me remind you that you broker does that automatically if you tell him to ! That process is called the OCO orders. Normally you don't want metastock's expert advisor to display stop loss & take profit because they are automatic and will only clutter your screen. Should I continue to explain the whole thing or would you stick to create an expert advisor with the Buy/Sell signals and using your broker for the Stop Loss/Take profit ?
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/15/2009(UTC) Posts: 7
|
Thanks a lot.
This evening I'll try to apply all these suggestions.
I'll hope to have success.
Otherwise.....I'll back :D
Thank you again.
I'll let you know.
Bye
Max
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/15/2009(UTC) Posts: 7
|
I start to make the work, following your suggestion.
I create an (empy) strategy in Expert advisor and I defined two formulas for Long Buy and Long sell copy and pasting the formulas defined into strategy tester.
With these two formula I've tried to define two Symbols, one for buy and one for sell.
Some problem come to me:
- Ms draw multiple buy and sell order, and to follow the system I need that only once operation is open at time, so the operation flow shold be Buy,Sell,Buy,Sell and so on.
The problem is that now MS print as follows: Buy, buy, Sell, Buy, Sell, Sell , Sell.
Is there a control to define to let me see only one operation open?
I tried, for example, with:
BarsSince(Fml("Roberto.Long.Sell")) < BarsSince(Fml("Roberto.Long.Buy"));
To control that the system close the position only if one is open
Where "Roberto.Long.Sell" is my sell long formula and "Roberto.Long.Buy" is my buy formula.
This does't work...
Any idea?
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/15/2009(UTC) Posts: 7
|
Sorry, I found how to do this reading pdf found on Files section.
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/15/2009(UTC) Posts: 7
|
Please, can you help me a little more?
In my strategy tester formula I set a Limit/Stop order like (for buy case):
H + 10
Or for sell case;
L - 10
How can I report this functionality on Expert Advisor?
Missing this steps the trading system perform really worst.
How can I add it?
At the moment my signal for buy is:
delay := 1;
[censored]y:= 10;
f1 := BarsSince(Fml("Roberto.Long.Buy")) = delay;
f2 := BarsSince(Fml("Roberto.Long.Sell")) = delay;
BarsSince(Ref(f1 , -1)) > BarsSince(Ref(f2, -1)) AND f1
I try do this stuff with f0:
delay := 1;
[censored]y:= 10;
f0 := Cross(H >= (ValueWhen(1,Fml("Roberto.Long.Buy"),H)) + [censored]y,.1);
f1 := BarsSince(Fml("Roberto.Long.Buy")) = delay;
f2 := BarsSince(Fml("Roberto.Long.Sell")) = delay;
BarsSince(Ref(f1 , -1)) > BarsSince(Ref(f2, -1)) AND f1 AND f0;
but doesn't work...
Can you help me?
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 1/25/2010(UTC) Posts: 2
|
I am facing the same problem. I have made my system in system tester now I want to put it in adviser. How do I put the Stop loss, Trailing stop loss and profit target. in the adviser. I want all the 3 to be calculated on tick price. Also How do I put the condition that if Iam long 1 I should not get a second entry signal. Please provide me the steps.
Thanks.
Data wrote:giomax wrote:So, can you rewrite your previous suggestion like a "Step by step" tutorial, the formula are not important, what I don't understand are the path to do.
Thx
Massimo Oh, the abstract path ! Let me try to explain it. You've built a system, it works fine and you want to create an expert advisor that reproduce its functions. Unfortunately, Metastock does not provide an easy conversion from System to Expert Advisor. Basically, Expert Advisors should only give you entry signals (buy & short) but you also would like to see take profit & stop loss. Oh, before I say anything more, let me remind you that you broker does that automatically if you tell him to ! That process is called the OCO orders. Normally you don't want metastock's expert advisor to display stop loss & take profit because they are automatic and will only clutter your screen. Should I continue to explain the whole thing or would you stick to create an expert advisor with the Buy/Sell signals and using your broker for the Stop Loss/Take profit ?
|
|
|
|
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.