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

Notification

Icon
Error

Options
Go to last post Go to first unread
mav67  
#1 Posted : Thursday, August 27, 2009 10:43:54 AM(UTC)
mav67

Rank: Newbie

Groups: Registered, Registered Users
Joined: 6/1/2009(UTC)
Posts: 3

Hello, I've run into a little problem using Metastock/TradeSim. To get a visual picture of my trading system, I inputted my trading system into the Expert Advisor using the Symbols option and get the Buy and Sell signals on the chart as expected. After looking at the chart and signals, it is obvious that my system really only works when the entry point is the FIRST entry signal generated since the last exit signal. This is because if the entry is made on the 2nd, 3rd, or even 10th entry signal, then the market will have run up too much already. Therefore, when I backtest my trading system using TradeSim, I do NOT want it to blindly enter a position based on any buy signal, but to instead ONLY have it enter if the previous signal was a sell.

Is there a function in Metastock that I have missed which can perform the above function?

I hope the issue I described makes sense. Thank you very much!
Data  
#2 Posted : Thursday, August 27, 2009 2:04:12 PM(UTC)
Data

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/20/2008(UTC)
Posts: 53

Here's a way to do it.

Create an indicator named System.Sell that is your sell signal and another one named System.Buy that is your buy signal.

Now create an expert called " My System" (the space are necessary because they'll put your system at the top of the list and you won't go crazy looking for it). Go the signals panel and create a buy signal. The code should be something like that :
Ref( Barssince(Fml("System.Sell")) < Barssince(Fml("System.Buy")) , -1) AND Fml("System.Buy")

The code is the opposite for the sell signal :
Ref( Barssince(Fml("System.Sell")) > Barssince(Fml("System.Buy")) , -1) AND Fml("System.Sell")


The code is quite straight-forward but I can explain it to you if you want.

One important thing : you can only use this code if you have a lot of data before the time when you start trading. That's because you MUST have had a buy and a sell signal for this code to be effective. If you are day-trading on five minute charts, use at least 2 days of data. On daily charts, at least 2 years.
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.