PDA

View Full Version : Short Trade Stop Problem


GeeBee
21st May 2005, 08:38 AM
I am still going bananas trying to sort out tradesim stops for shorting trades using HHV(H,5) as both Initial and Trailing stop, I have tried both ways below but tradesim takes zero trades no matter which method I use or which trigger/gate combination I use so I assume the problem is with the way I have told TS I want my stops to work, can anyone please point me in the right direction, as always any assistance is greatly appreciated.

METHOD 1
ShortInitialStop:=
ShortEntryPrice+Ref(HHV(H,5),-1);
ShortExitTrigger := ExtFml("TradeSim.TrailingStop",trigger,short,(0),(HHV(H,5)-1),C);

METHOD 2
ShortInitialStop:=
ShortEntryPrice+Ref(HHV(H,5),-1);

ShortExitTrigger := C>Ref(HHV(H,5),-1);
ShortExitPrice := OPEN;

I have also tried

ShortEntryPrice:=OPEN;
ShortInitialStop:=
ShortEntryPrice+Ref(HHV(H,5),-1);
ShortExitTrigger := Cross(C,Ref(HHV(H,5),-1));
ShortExitPrice := OPEN;

With the same zero trades from Tradesim

This is the entire Tradesim thingy that I am using,all I want for now is get the exits right then I will concentrate on refining the entry.

{<==> SET DATE VARIABLES <==>}
DayStart := 1; MthStart := 1; YearStart := 1999;
DayStop := 30; MthStop := 03; YearStop := 2005;

{<==> SHORT TRADES <==>}
ShortEntryTrigger:=Cross(Ref(LLV(L,20),-1),C) AND Mov(C,100,S)<Ref(Mov(C,100,S),-40)-4*ATR(100);
ShortEntryPrice:=OPEN;
ShortInitialStop:=
ShortEntryPrice+Ref(HHV(H,5),-1);
ShortExitTrigger := Cross(C,Ref(HHV(H,5),-1)) ;
ShortExitPrice := OPEN;



ExtFml( "TradeSim.Initialize");
ExtFml( "TradeSim.SetStartRecordDate",DayStart,MthStart,YearStart);
ExtFml( "TradeSim.SetStopRecordDate",DayStop,MthStop,YearStop);
ExtFml( "TradeSim.EnableDelayOfEntryByOneBar");
ExtFml( "TradeSim.EnableDelayOfAllExitsByOneBar");
ExtFml( "TradeSim.EnableProtectiveStop",0);
ExtFml( "TradeSim.UseClosingPriceAsStopThreshold");
ExtFml( "TradeSim.EnableTradePyramiding",Trigger, 0, 200);
ExtFml( "TradeSim.RecordTrades",
"SHORT LLV 1",
SHORT, ShortEntryTrigger,
ShortEntryPrice,
ShortInitialStop,
ShortExitTrigger,
ShortExitPrice,
START);

ERROR DETAILS
************************************************** **************************
4:55:40 PM: Loading C:\TradeSimData\SHORT LLV 20 100.trb
4:55:40 PM: Starting Trade Database Error Report
------------------------------------------------------------------------------
------------------------------------------------------------------------------



Trade Database Error Report Summary
» Total Number of Trades found in Database: 555
» Total Number of Open Trades found in Database: 0
» Total Number of Valid Trades Accepted from the Database: 555
» Total Number of Invalid Trades Rejected from the Database: 0
» Number of Duplicate Trades found in Database: 0
------------------------------------------------------------------------------
4:55:40 PM: Ending Trade Database Error Report
4:55:40 PM: Loading Trade Database Manager with: 'SHORT LLV 20 100'
4:55:40 PM: Trade Database Manager successfully loaded.
4:56:19 PM: Preparing to do a single simulation
4:56:20 PM: Trade Simulation in Progress
4:56:25 PM: Simulation Abnormally Terminated.

Error File Created: [05/21/05-16:52:31]
Trade Database File: [C:\tradesimdata\SHORT LLV 20 100.trb]
================================================== =========

Error Detected in [AZZ] caused by Invalid array index.

Error Detected in [NWS] caused by Invalid array index.

Error Detected in [MAYIYB] caused by Invalid array index.

Error Detected in [MXG] caused by Invalid array index.

Error Detected in [GSA] caused by Invalid array index.

Error Detected in [TSO] caused by Invalid array index.

Error Detected in [VGH] caused by Invalid array index.

Error Detected in [HDF] caused by Invalid array index.

I tried removing these stocks from my list of stocks but I still get zero trades

GeeBee

Adrian Miller
25th May 2005, 11:34 PM
Gee Bee,

Your short inital stop should only be

Ref(HHV(H,5),-1)

You only need to refer to the ShortEntryPrice when using an ATR based stop.

Adrian