PDA

View Full Version : Error finding in coding


Richard Blatchford
31st May 2008, 08:29 AM
Hi there,
I am fairly new to coding TradeSim/Metastock.
I have read Leon Wilsons' book "Breakthrough Trading"
The coding below is Leon's work.
Is it OK to list it on the forum without Leon's permission?
I have tried to find some way to contact Leon but he does not seem to have an internet site any more. (Google can not find him, except for book stores selling his books)
If it is OK to list the code on the forum, what I am trying to do is modify his coding out of various sections of his book and combine the various code into one search.

The code is attempting to find the 21 day initial high.
It is also looking for the close entry price to be higher than the XAO "upper channel" of the Relative strength comparison to the XAO.
Lastly it is using Leon's "Mean Close" stop loss.

Although it is using Leons coding from various sections of the book combined together it does not work. Obviously I have done something wrong as it has lots of errors when run through Metastock. (Metasock 10, TradeSim-Enterprise)
Could someone who is famililar with coding and Leon's work help me?

Kind Regards
Richard


{Initial high/Relative Strength Price Channel ASX, Mean Close Stop -TradeSim}
HH:=21;
SetUp:=If(Ref(HIGH,-HH)>=HHV(HIGH,HH),HHV(HIGH,HH),If(Ref(HIGH,-HH)<HHV( HIGH,HH),PREV,O));
Pds:=34;
ASX:=Security("C:\MetaStock\ASX\X0\XAO",CLOSE);
Comp:=CLOSE/ASX;
Index:=RSI(Comp,Pds);
NZU:=Index -55;
NeutUp:=CLOSE-(CLOSE*(NZU/100));
Stop:=CLOSE-((Sum(Abs(CLOSE-Ref(CLOSE,-1)),21 )/21)*6);
EntryTrigger:=Cross(CLOSE,SetUp) AND CLOSE>NeutUp;
EntryPrice := CLOSE;
ExitTrigger:=CLOSE<Stop AND (Ref(CLOSE,-1)>=Ref(Stop,-1));
ExitPrice := CLOSE;
InitialStop:=0;
ExtFml( "TradeSim.Initialize");
ExtFml( "TradeSim.SetValue",SystemID,0);
ExtFml("TradeSim.SetStartRecordDate",1,1,2000);
ExtFml("TradeSim.SetStopRecordDate",30,6,2005);
ExtFml("TradeSim.EnableDelayOfEntryByOneBar") ;
ExtFml("TradeSim.EnableDelayOfAllExitsByOneBar");
ExtFml("TradeSim.RecordTrades",
"TradeSim Initial High RSC-ASX Mean Close",
{Trade Database Filename}
LONG,{ Trade Position Type }
EntryTrigger,{ Entry Trigger }
EntryPrice, { Entry Price}
InitialStop,{ Initial Stop}
ExitTrigger,{Exit Trigger}
ExitPrice,{Exit Price}
START);{ Recorder Control}

Jose
29th September 2008, 12:03 PM
Sorry Richard, but I'm soo far behind on contracted work and other major projects, that I can no longer help with private requests. Unraveling others' code is definitely out of the question with my lack of resources.

Try plotting the code as an indicator in order to see if it does what it is supposed to do.


Regards,
jose