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

Notification

Icon
Error

Options
Go to last post Go to first unread
Alan R  
#1 Posted : Sunday, December 12, 2010 8:58:33 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

I have an Expert Advisor that shows my buy and sell signals. However, it also shows multiple buy signals without an intervening sell signal. I am trying to us the Latch function to solve this problem I have added the forum.dll but don't know how to implement the latch code. In my expert advisor under the Symbols tab I have added a Buy signal with the following code: LE:= Cross(LinRegSlope(CLOSE ,310 ), Mov(LinRegSlope(CLOSE ,310 ),3,S)); LX:= Cross(Mov(LinRegSlope(CLOSE ,310 ),3,S),LinRegSlope(CLOSE ,310 )); Z:= ExtFml("forum.Latch",LE,LX,0,0); EnterLong:=Z = 1 AND Ref(Z,-1) 1; ExitLong:=Z = 0 AND Ref(Z,-1) = 1; EnterLong; ExitLong; The Sell indicator has the following code: LE:= Cross(LinRegSlope(CLOSE ,240 ), Mov(LinRegSlope(CLOSE ,240 ),5,S)); LX:= Cross(Mov(LinRegSlope(CLOSE ,240 ),5,S),LinRegSlope(CLOSE ,240 )); Z:= ExtFml("forum.Latch",LE,LX,0,0); EnterLong:=Z = 1 AND Ref(Z,-1) 1; ExitLong:=Z = 0 AND Ref(Z,-1) = 1; EnterLong; ExitLong; I think this in incorrect but I don't know how to do it correctly. I am still getting multiple buy signals in a row. What am I doing wrong? Can someone guide me through implementing this correctly?
henry1224  
#2 Posted : Sunday, December 12, 2010 4:09:17 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
in your expert Advisor

long signal:

LE:= Cross(LinRegSlope(CLOSE ,310 ), Mov(LinRegSlope(CLOSE ,310 ),3,S));
LX:= Cross(Mov(LinRegSlope(CLOSE ,310 ),3,S),LinRegSlope(CLOSE ,310 ));

Z:= ExtFml("forum.Latch",LE,LX,0,0);
Z = 1 AND Ref(Z,-1) <> 1



sell signal:

LE:= Cross(LinRegSlope(CLOSE ,240 ), Mov(LinRegSlope(CLOSE ,240 ),5,S));
LX:= Cross(Mov(LinRegSlope(CLOSE ,240 ),5,S),LinRegSlope(CLOSE ,240 ));

Z:= ExtFml("forum.Latch",LE,LX,0,0);
Z = 0 AND Ref(Z,-1) = 1;



Alan R  
#3 Posted : Wednesday, December 15, 2010 4:24:20 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

Thanks Henry1224 for correcting my code. However, I must still have something wrong. When I create an Advisor with the corrected code under the Symbols Tab with separate Buy and Sell signals I still see multiple Buy symbols without a Sell symbol in between. Same with multiple Sell symbols without a Buy symbol in between. For example when I open a Clean chart for DIA I see three Sell symbols in October 2010 without Buy symbols in between.

Do I need to update the Forum.dll? It has been a year or more since I installed it. Has there been an update to solve this problem or am I still not implementing the code correctly?

Thanks for your help.

henry1224  
#4 Posted : Wednesday, December 15, 2010 5:01:21 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
without using the latch

Long entry

Z:=If(LinRegSlope(C,310 )>Mov(LinRegSlope(C,310 ),3,S),1,
If(Mov(LinRegSlope(C,310 ),3,S)>LinRegSlope(C,310 ),-1,0));

Z=1 and Ref(Z,-1)<>1

Long exit

Z:=If(LinRegSlope(C,310 )>Mov(LinRegSlope(C,310 ),3,S),1,
If(Mov(LinRegSlope(C,310 ),3,S)>LinRegSlope(C,310 ),-1,0));

Z=<>1 and Ref(Z,-1)=1

Short Entry

Z:=If(LinRegSlope(C,310 )>Mov(LinRegSlope(C,310 ),3,S),1,
If(Mov(LinRegSlope(C,310 ),3,S)>LinRegSlope(C,310 ),-1,0));

Z=-1 and Ref(Z,-1)<>-1

Short Exit

Z:=If(LinRegSlope(C,310 )>Mov(LinRegSlope(C,310 ),3,S),1,
If(Mov(LinRegSlope(C,310 ),3,S)>LinRegSlope(C,310 ),-1,0));

Z=<>-1 and Ref(Z,-1)=-1
henry1224  
#5 Posted : Wednesday, December 15, 2010 5:17:13 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
just a note about your system

UserPostedImage

the system doesn't preform well in a sideway market
henry1224  
#6 Posted : Wednesday, December 15, 2010 5:26:10 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
using a shorter LRS

UserPostedImage
Alan R  
#7 Posted : Wednesday, December 15, 2010 5:38:22 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

Here is the results of my Simulation. Next reply will show the System. Summary !My LR Trading System S&P 500 INDEX (.SPX) Simulation Date 12/11/2010 11:28:48 AM 2515 Daily Bars 1/3/2000 Through 12/31/2009 (3650 Days) Optimized System
Performance Profit $70273.84 Performance 140.55 % Annualized Performance 14.05 % Buy & Hold Profit $-12051.10 Buy & Hold Performance -24.10 % Buy & Hold Annualized Performance -2.41 %

Trade Summary Total Trades 32 Trade Efficiency 18.31 % Average Profit/Average Loss 3.19

Profitable Trades Total 21 Long 11 Short 10 Average Profit $4003.40 Highest Profit $21627.04 Lowest Profit $5.84 Most Consecutive 5

Unprofitable Trades Total 11 Long 5 Short 6 Average Loss $-1254.32 Highest Loss $-3649.76 Lowest Loss $-259.82 Most Consecutive 2

Maximum Position Excursions Long Favorable $15498.48 Short Favorable $27900.00 Long Adverse $-8507.42 Short Adverse $-3982.40

Trade Efficiency Average Entry 57.88 % Average Exit 60.44 % Average Total 18.31 % Average Long Entry 61.35 % Average Long Exit 67.67 % Average Long Total 29.01 % Average Short Entry 54.41 % Average Short Exit 53.21 % Average Short Total 7.62 %

Performance Indices Buy & Hold Index 683.13 % Profit/Loss Index 83.59 % Reward/Risk Index 96.62 %

Accounting Initial Equity $50000.00 Trade Profit $84071.40 Trade Loss $-13797.57 Commissions $640.00 Interest Credited $0.00 Interest Charged $0.00 Final Equity $120273.84 Open Positions $0.00

Account Variation Highest Account Balance $133281.84 Lowest Account Balance $881.97 Highest Portfolio Value $65552.04 Highest Open Drawdown $-2454.59 Highest Closed Drawdown $-740.65

Account Events Margin Calls 0 Overdrafts 5

Profitable Timing Average Trade Length 87 Longest Trade Length 382 Shortest Trade Length 2 Total Trade Length 1844

Unprofitable Timing Average Trade Length 27 Longest Trade Length 95 Shortest Trade Length 1 Total Trade Length 304

Out of Market Timing Average 122 Longest 366 Total 367

Optimization Variables OPT1 310.00 OPT2 3.00 OPT3 240.00 OPT4 5.00 OPT5 N/A OPT6 N/A OPT7 N/A OPT8 N/A OPT9 N/A OPT10 N/A

Alan R  
#8 Posted : Wednesday, December 15, 2010 5:40:05 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

System Details !My LR Trading System Optimized Yes Order Bias Long Portfolio Bias Single Position Limit 1 Notes

Buy Order Order Type Market Order Expiration Good Until Cancelled Entry Size Method Use Default Size Signal Formula Cross(LinRegSlope(CLOSE ,OPT1 ), Mov(LinRegSlope(CLOSE ,OPT1 ),OPT2,S)) Price Formula Entry Size Formula Strategic Delay Tick Minute Day # of Bars 0 0 0

Sell Short Order Order Type Market Order Expiration Good Until Cancelled Entry Size Method Use Default Size Signal Formula Cross(Mov(LinRegSlope(CLOSE ,OPT3 ),OPT4,S),LinRegSlope(CLOSE ,OPT3 )) Price Formula Entry Size Formula Strategic Delay Tick Minute Day # of Bars 0 0 0 Sell Order Order Type Market Order Expiration Good Until Cancelled Signal Formula Cross(Mov(LinRegSlope(CLOSE ,OPT3 ),OPT4,S),LinRegSlope(CLOSE ,OPT3 )) Price Formula Strategic Delay Tick Minute Day # of Bars 0 0 0 Buy to Cover Order Order Type Market Order Expiration Good Until Cancelled Signal Formula Cross(LinRegSlope(CLOSE ,OPT1 ), Mov(LinRegSlope(CLOSE ,OPT1 ),OPT2,S)) Price Formula Strategic Delay Tick Minute Day # of Bars 0 0 0 Stops BreakEven Stop Positions None Floor Level 0.00 % Stop Loss Positions None Stop Value 0.00 % Trailing Stop Positions None Profit Risk Value 0.00 % Trailing Periods 0.0 Inactivity Stop Positions None Minimum Value 0.00 % Periods 0.0 Profit Target Positions None Target Value 0.00 % Simulation Options General Options Points Only Test No Initial Equity 50000. Default Size $50000.00 Cost Trade Long Yes Trade Short Yes Optimization Results 5

Trade Execution Options Realistic Market Prices Yes Buy Price N/A Sell Price N/A Sell Short Price N/A Buy To Cover Price N/A Delay To Open 1 Slippage Buy 0.00 % Sell 0.00 % Sell Short 0.00 % Buy to Cover 0.00 %

Broker Options Interest Rates Margin 0.00 % Money Market 0.00 % Margin Requirement Long Initial 100.00 % Long Maintenance 0.00 % Short Initial 150.00 % Short Maintenance 130.00 % Commissions Entry $10.00 Per Transaction Exit $10.00 Per Transaction So I'm probably not implementing the code correctly.
Alan R  
#9 Posted : Wednesday, December 15, 2010 5:41:43 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

I have to go for now. Will review any response about 4AM Texas time tomorrow. Thanks for all your help today.
henry1224  
#10 Posted : Wednesday, December 15, 2010 6:09:13 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
here is the SPX using your system over a 12 year period

UserPostedImage
henry1224  
#11 Posted : Wednesday, December 15, 2010 6:41:24 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
here is the SPX short using your optimized system 240 /5 ma smoothing

UserPostedImage
henry1224  
#12 Posted : Wednesday, December 15, 2010 7:35:55 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Alan,

Do not think that your code is incorrect!

The difference between my charts and your enhanced system tester is that I used the VST pro add-on from www.metastocktools.com . The EST that comes with Metastock is a pile of junk
IMHO. When it was re written years ago,several users complained to no avail.

yes your figures look good in the reports, but when you apply them to the chart,you will see that the buy and sell arrows do not match up.

There is no mumbo jumbo with VST Pro! What you see is what you get!

The following features of metatsock are useless IMHO

the enhanced system tester, Optionscope, and Reuters Powerscreener

The VST Pro is a far superior product than EST.
http://www.optionvue.com/ is a better choice than Optionscope
and most online brokerages have better screeners than Reuters Powerscreener

unless Equis corrects these issues, they will continue to see their sales dropping.
With the advances in computers and operating systems, Metastock still uses only 1 core and doesn't support multi thread processing. Buying a new laptop with Quad core processors
is to no advantage running 1.7 cpu vs a duo core at 2.5cpu

If you follow the changes that metastock has made from the early versions 6.5 and on
version 7.0 and on has allowed dll's and the explorer now allows for more than 6 columns
and the ability to run explorations from the results of prior explorations.

that it, all of the other upgrades feature new add-ons formulas

Metastock needs to overhaul it's software

starting with the downloader's ability to rename files due to symbol changes. a utility file to maintain the data files would help.
the formula language should be expanded with new functions,and they need to address the limits in the expert advisor , indicator builder,system tester,and explorer
the boxes in the formula builder and experts should be expanded into full page boxes.
also the ability to copy a highlight or symbol in the expert advisor would help
they should rewrite the system tester entirely, based on 4 entry conditions long entry, long exit, short entry, and short exit. It should enable portfolio testing and Monte Carlo simulations as well as walk forward testing.
they should create a portfolio application,where you could track your holdings. It could have the expert advisors attached to it, so when you click on the symbol your chart would pop up with the expert attached.
Sorry for the rant,

henry


billtrudeau  
#13 Posted : Wednesday, December 15, 2010 10:15:02 AM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

I have been using MetaStock for close to 20 years. Equis once had a portfolio program called Pulse and a market analysis program called the Technician. They discontinued those programs at least 10 years ago, maybe longer. It would be nice if they would provide a little guidance as to what the future direction for MetaStock will be. Is it now just a cash cow that is going to slowly fade away or will they update it to include many on the features that most users would like to see included?
Alan R  
#14 Posted : Thursday, December 16, 2010 3:38:14 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

Henry:

Thanks for the enlightenment about MetaStock as I was not aware of these weaknessess. Guess I need to backup and regroup.

Question: Does the VST Free version allow for testing my own trading system or is it locked to the one installed when VST is downloaded?

Alan,

henry1224  
#15 Posted : Thursday, December 16, 2010 4:27:26 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
The VST pro is like system testing on steroids.
you get more indicators,more systems,more templates, and no bs.

it will show you which system is better,based on risk.
it will determine the size of trade.
it has built in market trend filters,stoploss

It is the most superior add-on that I have ever seen


Alan R  
#16 Posted : Thursday, December 16, 2010 4:44:47 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

I would like to try out the FREE version before making the big plunge into the PRO version. Do you know if I can test out my own trading system with the FREE version?

I am just getting started with trying to design a trading system and I would like to see some sign that I can be successful before making a big investment.

Alan R  
#17 Posted : Thursday, December 16, 2010 5:03:05 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

Bill:

How are you using MetaStock successfully with your experience. I have only had MetaStock for about 9 months and am still learning about the software.

Alan R  
#18 Posted : Tuesday, January 18, 2011 3:50:46 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

I am trying to use the latching idea without the external latching DLL as suggested. However I have changed the indicators. The following is the new code but I still get mulitiple LONG and SHORT signals. (I wanted to add a chart but did not see how to do so).

LONG:

Z:= If(LinRegSlope(CLOSE,10) > 0 AND Cross(RSquared(CLOSE,10), .4),1,
If(LinRegSlope(CLOSE,10) < 0 AND Cross(RSquared(CLOSE,10), .4),-1,0));

Z=1 AND Ref(Z,-1)<>1

SHORT:

Z:= If(LinRegSlope(CLOSE,10) > 0 AND Cross(RSquared(CLOSE,10), .4),1,
If(LinRegSlope(CLOSE,10) < 0 AND Cross(RSquared(CLOSE,10), .4),-1,0));

Z=-1 AND Ref(Z,-1)<>-1

johnl  
#19 Posted : Tuesday, January 18, 2011 6:52:42 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

Here is the original latch code from Wabbit:

x:=BarsSince(a1)<BarsSince(a2); {latch}
x:=Alert(x,2) AND a2; {first a2 after a1}
x;

I use this code to clean up signals.
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.