PDA

View Full Version : Errors in Exploration


Barrie
4th November 2003, 03:24 AM
I'd be very grateful for some help with TradeSim from someone who is more familiar with this package than me.

I am trying to develop a system trading the ASX top 20 which uses a trigger of close above 5 day moving average and entry of previous day's high plus 0.5 ATR(1).

Stop is lowest low of last 4 days.

Exit Trigger should give price is below or equal to lowest price in last 4 days.

The system is reversed for short trades.

I have reproduced below the code I am using.

This system is supposed to run trades of $10,000 with a float of $150,000.

For simplicity I haven't included here the code for the Short side version, which is the inverse of the Long code.

When I run this I get errors like:-

Error found in LONG trade [AMC] on 19-Aug-1998 caused by Invalid Entry Price Data.
Details: [Entry Price(5.456474)] < [Entry Price Low(5.464451)]


EntryTrigger :=REF(C,-1)>Mov(C,5,S) AND H>REF(H,-1)+0.5*ATR(1);

EntryPrice := Ref(H,-1)+0.5*ATR(1);

ExitPrice :=LLV(L,4);

ExitTrigger :=L<=LLV(L,4);

InitialStop :=0;

ExtFml("TradeSim.Initialize");

ExtFml("TradeSim.EnableProtectiveStop",0);


ExtFml( "TradeSim.SetStartRecordDate",01,06,1995);

ExtFml( "TradeSim.SetStopRecordDate",30,09,2003);


ExtFml("TradeSim.RecordTrades",

"Top 20",

LONG,

EntryTrigger,

EntryPrice,

InitialStop,

ExitTrigger,

ExitPrice,

START);


Any help will be greatly appreciated.

Barrie Davis

David Samborsky
4th November 2003, 12:52 PM
Error found in LONG trade [AMC] on 19-Aug-1998 caused by Invalid Entry Price Data.
Details: [Entry Price(5.456474)] < [Entry Price Low(5.464451)]

The reason why you are getting these errors is because you trying to force the price to lie outside the price range on the day of entry. TradeSim precludes this from occuring for the simple reason that the price did not occur in reality and hence the simulation would be bogus.

Try constraining the price to lie withing the daily range and the errors will go away. As a test replace your Entry price with OPEN.

Version 4.1.0 of the TradeSim.dll available from our download site has the ability to automatically filter prices so that they are always constrained within the daily price range.

Barrie
5th November 2003, 12:18 AM
Hi David

Thanks for your prompt reply, yes changing the Entry Price to Open removed the errors.

However, I'm a bit confused about the operation of the software. I had thought that the Entry Trigger ensured that a trade was not looked at unless the Entry Trigger conditions were met.

My Entry Trigger conditions called for the stock to have closed above the 5 day moving average and reached a high 0.5 ATR(1) above the previous high. If the stock has not reached that level, should the Entry Trigger not be met and therefore the trade be rejected? In that event, isn't the Entry Price irrelevant?

If the stock has reached the high plus 0.5*ATR(1) level, surely my Entry Price then falls within the required range?

I guess I don't understand what is happening here, so I'd be grateful if you could clarify it for me.

Barrie Davis

David Samborsky
5th November 2003, 12:28 AM
My Entry Trigger conditions called for the stock to have closed above the 5 day moving average and reached a high 0.5 ATR(1) above the previous high. If the stock has not reached that level, should the Entry Trigger not be met and therefore the trade be rejected? In that event, isn't the Entry Price irrelevant?

Yes your EntryTrigger determines the entry into a trade providing that your EntryPrice lies within the price range at the point of entry.

If the stock has reached the high plus 0.5*ATR(1) level, surely my Entry Price then falls within the required range?

It also applies to the high of the day of entry. If your entry price lies above the high of the day then the trade will be rejected as well.

What you will find is that the EntryPrice will lie within in the daily range only some of the times and these are the cases where the trades will be accepted.

The whole argument regarding price rules also applies to the ExitPrice as well.

Version 4.1.0 of the TradeSim.dll contains an automatic price filter which can be enabled by calling ExtFml( "TradeSim.EnablePriceFilter"). This forces the entry and exit prices to be constrained within the daily range of the entry and exit points respectively.