PDA

View Full Version : Pyramiding and Tradesim problems?


Adrian Miller
13th May 2004, 11:50 PM
Hi all,

2 simple questions.

1. Pyramiding
I have included in my Metastock code ExtFml( "TradeSim.EnableTradePyramiding", PercentProfit,3,20);

However when I run Tradesim there is no difference in results for pyramiding enabled and disabled.

In the trade log all transactions are the first order. Any clues as to the issue here

2. Tradesim preferences

When analysing the performance of a trading system using different risk parameters (set $ risk, position size, float size etc) more often than not the results from one simulation will be exactly the same as the former simulation.

If I run the simulation a number of time then the results may change.

Why is Tradesim doing this? Surely when you change the risk parameters the results would change from simulation to simulation?

Do I have a bug in my Tradesim program? Is it related to the pyramiding issue above?

Your concerned

David Samborsky
14th May 2004, 01:44 AM
1. Are there pyramid trades (level>0) in the trade database? Also try enabling "Favour trade pyramids" in the trade preferences.

2. When entering values in an edit field make sure you push the return key after you have entered a new value.

Adrian Miller
17th May 2004, 12:03 AM
Hi David,

Thanks for replying

All trades in the databse are 0 level trades

I have also selected 'favour trade pyramids'

Results are exactly the same as for a non-pyramiding strategy

When I check the Metastock rejected trades window it rejects all securities (in the top 200), with the message 'invalid security data detected' along side every security in the top 200

Does this have something to do with it?

I do not understand the relationship between the Metastock explorer message, and the fact that there are still trades in the trade database, but only o level trades.

I have attached the code for the long side

Thanks

Adrian


LongEntryTrigger:=Mov(C,200,S) > Ref(Mov(C,200,S),-50)+4.5*ATR(10) AND
C > 1 AND
ATR(10)/C > .01 AND
ATR(10)/C < .04 AND
Mov(C,50,S)*Mov(V,50,S) >= 400000
AND
BarsSince(Mov(C,20,S)-Ref(Mov(C,20,S),-1)< 0) <=20 AND
Ref(H,1)>=H+0.5*ATR(10);

LongEntryPrice:=Ref(H+0.5*ATR(10),-1);
LongEntryPrice:=If(LongEntryPrice < O,O,LongEntryPrice);

LongExitTrigger:= ExtFml("TradeSim.TrailingStop", trigger, long, 4.5*ATR(30),H,L);

LongExitPrice:=
Ref(ExtFml("TradeSim.TrailingStop", band, long, 4.5*ATR(30),H,L),-1);
LongExitPrice:=If(LongExitPrice > O,O,LongExitPrice);
LongExitPrice:=If(LongExitPrice < L,L,LongExitPrice);
LongInitialStop:=LongEntryPrice-2.0*Ref(ATR(10),-1);

ExtFml( "TradeSim.Initialize");
ExtFml( "TradeSim.SetExitPriceToInitialStop");
ExtFml( "TradeSim.EnableProtectiveStop",0);
ExtFml( "TradeSim.SetStopGapPriceToOpen");
ExtFml( "TradeSim.EnableDelayOfEntryByOneBar");
ExtFml( "TradeSim.EnableTradePyramiding", PercentProfit, 6, 20);
ExtFml( "TradeSim.SetStartRecordDate", 31,01,1997);
ExtFml( "TradeSim.SetStopRecordDate", 29,2,2004);
ExtFml( "TradeSim.RecordTrades", "RLSCFD6 final top 200",
Long,
LongEntryTrigger,
LongEntryPrice,
LongInitialStop,
LongExitTrigger,
LongExitPrice,
START);

David Samborsky
17th May 2004, 02:06 AM
You may find that your profit threshold of 6% is a bit agressive. Try winding it back to 1% or less otherwise you will hit the exit trigger before you find any pyramid trades.

Adrian Miller
17th May 2004, 11:36 PM
David,

There are a large number of trades in the database with a profit inexcess of 6%

Why is a profit factor of 6% too agressive??

My understanding of the pyramid trade function is that as soon as the trade is in profit of 6%, then another trade entry is triggered.

I would not want to get into trades when the profit is only 1%

Am I missing something?

Also, any suggestion as to why the Metastock explorer produces the error, but there are trades in the Tradesim database?

Adrian

David Samborsky
19th May 2004, 12:40 AM
My understanding of the pyramid trade function is that as soon as the trade is in profit of 6%, then another trade entry is triggered.


But if you get your exit trigger before a 6% profit gain you will not get any pyramid trades as the pyramid will be closed off prematurely with only a level 0 trade.

Also check the Error Log for more details as why trades have been rejected.