PDA

View Full Version : SHort and Long results together


Dave
22nd September 2003, 04:40 AM
What a great product!

I am very new to this software and I am trying to setup some basic strategies that look at both long and short trades. From what I read, it is possible, but my results always only show one side of the trading (either long or short), depending on which is stated first.

here is one of my explorations
------------------------------------
{Entry Exit parameters}
LongTrigger:=(Mov(C, 5,W) >= Mov(C,55,W)) and Cross(Swing(3),0);
ShortTrigger:=(Mov(C, 5,W) <= Mov(C,55,W)) and Cross(0,Swing(3));
EntryPrice:=Ref(OPEN,-1);
ExitTriggerLong:=(Mov(MACD(),9,E)>= MACD()) or (Mov(C, 5,W) <= Mov(C,55,W));
ExitTriggerShort:=(Mov(MACD(),9,E)<= MACD()) or (Mov(C, 5,W) >= Mov(C,55,W));
ExitPriceLong:=ref(open,-1);
ExitPriceShort:=ref(open,-1);
{END SETUP}
{------------------------------------}
ExtFml( "TradeSim.Initialize");
ExtFml( "TradeSim.RecordTrades",
"Strategy 01c", { Trade Data Filename }
LONG, { Trade Position Type }
LongTrigger, { Long Trigger }
EntryPrice, { Entry Price }
0, { Optional Initial Stop }
ExitTriggerLong, { Exit Trigger }
ExitPriceLong, { Exit Price }
START); { Start Symbol }
ExtFml( "TradeSim.RecordTrades",
"Strategy 01c", { Trade Data Filename }
SHORT, { Trade Position Type }
ShortTrigger, { Short Trigger }
EntryPrice, { Entry Price }
0, { No Optional Initial Stop }
ExitTriggerShort, { Exit Trigger }
ExitPriceShort, { Exit Price }
CONTINUE); { }
--------------------------------

Can anyone point out what I am doing wrong?

David Samborsky
22nd September 2003, 11:59 AM
Hello

If I replace the ref(OPEN,-1) with OPEN everything works ok otherwise the error checking rejects trades if the entry price falls outside the daily range.

If you want to use yesterdays price make sure you condition it with todays range otherwise the trades will be rejected.

For example something like the following could be used:-

Entryprice:=if(ref(OPEN,-1)>H,H,if(ref(OPEN,-1)<L,L,ref(OPEN,-1)));

David Samborsky
22nd September 2003, 01:27 PM
Just to let you know that in the next release of the tradesim dll I will incorporate an optional price filter in the RecordTrades function so that prices can be restrained automatically within the daily range.

It's syntax will be

ExtFml( "TradeSim.EnablePriceFilter");

Dave
22nd September 2003, 10:22 PM
Thanks David

I see my faults now.

All is working well!