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

Notification

Icon
Error

Options
Go to last post Go to first unread
Flexi  
#1 Posted : Friday, November 25, 2011 4:36:17 AM(UTC)
Flexi

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/27/2006(UTC)
Posts: 135

Exittrigger:=H>REF(Mov(C,100,S),-1);
Exitprice:=REF(Mov(C,100,S),-1);
Want to exit with price on REF(Mov(C,100,S),-1);
The exitprice on the trades have no problem but putting on an extra exit on 60 bars, the trades exiting on 60 bars have exit price on the high of the bar rather on the close
How to adjust to allow those trades exiting on 60 bars to exit on the close using tradesim?

jjstein  
#2 Posted : Friday, November 25, 2011 10:16:19 AM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
It's not clear what "60 bars" has to do with your code...I'd think ExitPrice would have to be OHLC or the HL range, rather than an MA.

Flexi  
#3 Posted : Friday, November 25, 2011 1:23:55 PM(UTC)
Flexi

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/27/2006(UTC)
Posts: 135

60 bar is another exit and want the exit to be on close but why tradesim use high rather the close?
jjstein  
#4 Posted : Friday, November 25, 2011 3:15:34 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
If you are using a trailing stop, usually the High is used when Short, and the Low when Long.

Otherwise, without seeing the code, I have no idea.

Flexi  
#5 Posted : Sunday, November 27, 2011 3:41:35 AM(UTC)
Flexi

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/27/2006(UTC)
Posts: 135

StoH:=Fml("stoH")
EntryTrigger := Cross(C,stoH);
EntryPrice := C;
ExitTrigger := H>Ref(Mov(H,100,S),-1);
ExitPrice :=Ref(Mov(H,100,S),-1);
ActualExitPrice :=If(ExitPrice<O,O,ExitPrice);

ExtFml( "TradeSim.Initialize");
ExtFml( "TradeSim.EnableProtectiveStop",0);
ExtFml( "TradeSim.EnablePriceFilter");
ExtFml( "TradeSim.SetTimStop",60);

Those trades exit without exittrigger are on H rather on C
jjstein  
#6 Posted : Sunday, November 27, 2011 9:22:27 AM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Well, first off, I don't see "RecordTrades", which is where you'd specify the ExitPrice.

Second, merely because you WANT for the ExitPrice to be yesterday's moving average of the High price, does NOT mean the price hit that number -- in fact, it would not happen very often! Plot that 100 MA on the chart and have a look for yourself.

I'd guess you've set ExitPrice above the High price, which is invalid, so it uses the High price instead.

jjstein  
#7 Posted : Monday, November 28, 2011 12:50:29 AM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Flexi -- You might play with this, and see if it does what you want (exit on close), then modify as needed, one item at a time:

{ Entry/Exit on CLOSE }
ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml("TradeSim.EnablePriceFilter");
ExtFml("TradeSim.SetTimeStop",20);

FastD:=Fml("_Stochastic");

EntryTrig:=Cross(FastD,20);
ExitTrig:=Cross(80,FastD);
ExitTrig:=0; { OVERRIDE TO TEST TIME STOP }

ExtFml("TradeSim.RecordTrades",
"_Test",
LONG,
EntryTrig,
CLOSE, { Entry Price }
OPEN-(OPEN*.10), { 10% Initial Stop }
ExitTrig,
CLOSE, { Exit Price }
START);


oztrader  
#8 Posted : Monday, November 28, 2011 5:09:38 PM(UTC)
oztrader

Rank: Advanced Member

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

Try using this as your "ExitPrice" code:- ExitPrice :=If(ExitTrigger,Ref(Mov(H,100,S),-1),C);
jjstein  
#9 Posted : Monday, November 28, 2011 5:24:02 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
oz -- Won't that just result in a bunch of "invalid price data" warnings, since ExitPrice won't be in the range of Low-to-High?

oztrader  
#10 Posted : Monday, November 28, 2011 10:04:18 PM(UTC)
oztrader

Rank: Advanced Member

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

Hi Johnathan, "The exitprice on the trades have no problem but putting on an extra exit on 60 bars, the trades exiting on 60 bars have exit price on the high of the bar rather on the close How to adjust to allow those trades exiting on 60 bars to exit on the close using tradesim?" Above is the original question which Flexi posted so I was only concentrating on providing a solution which forces TradeSim to use the closing price in all other circumstances. I believe that the ExitTrigger shown is only for example purposes as it could be applicable on the day the Buy signal was triggered! To avoid using invalid data I use the following code:- ExtFml("TradeSim.DisablePriceFilter"); ExtFml("TradeSim.ShowRejectedTradeDetails"); Cheers oz
Flexi  
#11 Posted : Thursday, January 12, 2012 3:03:58 AM(UTC)
Flexi

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/27/2006(UTC)
Posts: 135

How to round off the the entry and exit price to 2 decimals?
Users browsing this topic
Guest (Hidden)
Similar Topics
Exit price - Expert problem (Formula Assistance)
by Pawelpipi 1/7/2008 6:17:54 AM(UTC)
Exit Price (Formula Assistance)
by Flexi 12/5/2007 7:12:50 AM(UTC)
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.