logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
etrader808  
#1 Posted : Wednesday, December 25, 2013 2:48:16 AM(UTC)
etrader808

Rank: Newbie

Groups: Registered, Registered Users
Joined: 12/25/2013(UTC)
Posts: 1

Hi

I trying to built a strategy for the futures market to test the day of the week concept with a certain price pattern based on Larry William's long-term secrets to short-term to trading book.

Entry rules:

1. Todays open is less than yesterday (gap on open)

2. Todays close is less than the open

3. If tomorrow is a certain day of the week then place a buy stop above the high of today plus 1% of the 5 day ATR.

Exit rule:

1. Exit on the first profitable open (open is above entry price).

2. Stoploss - exit on the next day open if close is below the entry price - 0.5 * 5day ATR

The problem is sometime the profitable open exit or stoploss exit conditional will be on the wrong day.

Any help will be much appreciated.

//////////////////////////////////////////////////////////////////////////////////////

DayStart := 1; MonthStart := 1; YearStart := 1990;
DayStop :=31; MonthStop :=12; YearStop := 2013;

Limit:= Ref(H + 0.01*ATR(5),-1);

EntryTrigger :=
DayOfWeek()=2
AND H >= Limit
AND Ref(
O < Ref(C,-1)
AND C < O
,-1);

EntryPrice := Limit;
ExitTrigger := O > Ref(EntryPrice,-1);
ExitPrice := O;
InitialStop := EntryPrice - Ref(0.5*ATR(5),-1);

ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.SetStartRecordDate", DayStart, MonthStart, YearStart);
ExtFml("TradeSim.SetStopRecordDate", DayStop, MonthStop, YearStop);
ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml("TradeSim.SetStopGapPriceToOpen");
ExtFml("TradeSim.EnableTradePyramiding",Trigger,0,100);
ExtFml("TradeSim.UseClosingPriceAsStopThreshold");
ExtFml("TradeSim.RecordTrades","DayOfWeek_GapFilling",
LONG,EntryTrigger,EntryPrice,InitialStop,ExitTrigger,ExitPrice,START);

oztrader  
#2 Posted : Thursday, December 26, 2013 3:23:44 AM(UTC)
oztrader

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Just a couple of problems to address:-

a) I have interpreted from your description of the price pattern that the entry would be based on the third bar of the pattern.

b) Not really sure which is the "Gap on Open" bar so that condition has not been included in the code.

c) The code relating to the "take profit" condition must be specific in defining the cost price of the trade and you will notice if you plot your code for "Entry Price" the value will change whereas it needs to be constant.

This is my take on the code.

{SimulationName}

Limit:=
Ref(H + 0.01*ATR(5),-1);

EntryTrigger:=
DayOfWeek()=2 AND
OPEN >= Limit AND
Ref(OPEN,-1)<Ref(OPEN,-2) AND
Ref(CLOSE,-1)<Ref(OPEN,-1);

EntryPrice:=
OPEN;

InitialStop:=
EntryPrice-Ref(0.5*ATR(5),-1);

EntryPriceLine:=
ValueWhen(1,EntryTrigger,EntryPrice);

ExitTrigger:=
OPEN>EntryPriceLine;

ExitPrice:=OPEN;

ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.DisablePriceFilter");
ExtFml("TradeSim.SetStartRecordDate",1,1,1990);
ExtFml("TradeSim.SetStopRecordDate",31,12,2013);
ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml("TradeSim.EnableTradePyramiding",Trigger,0,100);
ExtFml("TradeSim.UseClosingPriceAsStopThreshold");
ExtFml("TradeSim.RecordTrades",
"SimulationName",
LONG,
EntryTrigger,
EntryPrice,
InitialStop,
ExitTrigger,
ExitPrice,
START);

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.