Hi All, Just wanted to bump up this message to the top again just in case anyone can help me out with it. I've tried to resolve the issue myself but am getting strange results and consequently seem unable to find a solution.
Any help or advice would be most welcome.... Thanks all, Chorlton --- In [email protected], "chorlton_c_hardy" <chorlton-c- [EMAIL PROTECTED]> wrote: > > > Hello All, > > I've managed to find some code which allows me to export an Amibroker > Exploration File to TradeSim for further analysis. This code is posted > below: > > > > Buy = Ref(Buy,-1); Sell = Ref(Sell, -1); > > Cover = 0; Short = 0; > > TradeStop = LLV(Low,10); // Initial stop for TradeSim > > Equity( 1 ); // evaluates trades and stops > > Filter = Sell;// OR Cover; > > IsLong = Sell; > > dt = DateTime(); > > // Determine values for Explorer > > EntryDate = IIf( IsLong, ValueWhen( Buy, dt ), ValueWhen( Short, dt ) ); > > ExitDate = dt; > > EntryPrice = IIf( IsLong, ValueWhen( Buy, BuyPrice ), ValueWhen( Short, > ShortPrice ) ); // Set buy and sell prices to Open for TradeSim > > ExitPrice = IIf( IsLong, SellPrice, CoverPrice ); > > EntryLow = IIf( IsLong, ValueWhen( Buy, L ), ValueWhen( Short, L ) ); > > EntryHigh = IIf( IsLong, ValueWhen( Buy, H ), ValueWhen( Short, H ) ); > > EntryVolume = IIf( IsLong, ValueWhen( Buy, Ref(V,-1) ), ValueWhen( > Short, Ref(V, -1) ) ); > > InitialStop = IIf( IsLong, ValueWhen( Buy, TradeStop ), ValueWhen( > Short, TradeStop ) ); > > ExitLow = L; > > ExitHigh = H; > > SetOption("NoDefaultColumns", True ); > > AddTextColumn( Name(), "Symbol" ); > > AddColumn( IIf( IsLong, 76, 83 ), "Long/Short", formatChar ); // L or S > letter > > AddColumn( EntryDate, "EntryDate", formatDateTime); > > AddColumn( ExitDate, "ExitDate", formatDateTime); > > AddColumn( InitialStop, "Initial Stop", 1.3 ); > > AddColumn( EntryPrice, "EntryPrice", 1.3 ); > > AddColumn( ExitPrice, "ExitPrice", 1.3 ); > > AddColumn( EntryLow, "EntryLow", 1.3 ); > > AddColumn( EntryHigh, "EntryHigh", 1.3 ); > > AddColumn( L, "ExitLow", 1.3 ); > > AddColumn( H, "ExitHigh", 1.3 ); > > AddColumn( EntryVolume, "EntryVolume", 0.0); > > > > Unfortunately, this code seems to work for LONG trades only. > Consequently, does anyone know how I can modify it to include SHORT > trades? > > I have tried to modify it myself but have run into all kinds of problems > such as incorrect price data, missing price data, etc, etc. > > So far I have made the following changes (which may or may not be > right): > > Cover = Ref(Cover , -1); Short = Ref(Short,-1); (2nd line of code) > > Filter = Sell OR Cover ; (5th line of code) > > In addition, does anyone know how I can incorporate TWO Initial Stops > into the same system (1 Stop for LONG Trades and 1Stop for SHORT Trades) > so that AB & TradeSim know which stop to use depending on whether the > trade is LONG or SHORT?? > > For the system above, the initial stop for Short trades would be: > TradeStop = HHV(High,10); > > > > Any help much appreciated as I'm not sure how to proceed, > > > > Thanks > > Chorlton >
