Discussions
»
Product and Service Development
»
Formula Assistance
»
get stoped out by trailing stop before initial fix stop
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 3/28/2008(UTC) Posts: 4
|
Hi All,
I got a problem in defining exit strategy. The major problem is the trailing stop argument which was kickin in before the initial stop. So I always get stop out even before the initial stop.Can someone in this forum assist me with
IF function ???
this is a sample logic tradesim
LongEntryTrigger := a;
LongEntryPrice := OPEN;
LongInitialStop := If(Ref(C,-1)> 0.91*LongEntryPrice,0.91*LongEntryPrice,Ref(C,-1));
LongExitTrigger := ExtFml( "TradeSim.TrailingStop",TRIGGER,LONG,3*ATR(10),High,Low);
LongExitPrice := O;(I think it is here the major problem)
thank you for your assistant
regards
asx trader
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/28/2004(UTC) Posts: 110
|
asx trader,
Difficult to tell if "O" is alpha or numeric.
If alpha it would stand for open and means that your entry and exit are the same. If its zero then you have waited too late.
I would think that your exit price if long would be the open but only if you are lower than the LongExitTrigger low.
Evaluating a snippet of code is nearly impossible. It helps to see the complete code when asked to consider system logic.
Preston
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 3/28/2008(UTC) Posts: 4
|
O is OPEN
The entry arguments is fine but when it come to initial stop and trail stop it turns out to be daisy.
lets assume the long exit trigger is close and the openign trade is open. I believe the logic sequence is clear.
Appreciate if any one who have any ideas with if fucntion or any additional function
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Hi ASX Trader,
I take it from the code that this is a Long System?
For the InitialStop try something along these lines:-
LongInitialStop :=0.91*LongEntryPrice;
It might pay to check the ExitPrice code with the Tradesim Manual but it will probably look similar to this:-
LongExitPrice:=If(O<Ref(LongExitTrigger,-1),O,Ref(LongExitTrigger,-1);
or perhaps:-
LongExitPrice:=If(O<LongExitTrigger,O,LongExitTrigger);
Your ExitTrigger refers to HIGH & LOW which I believe is more often used for an intraday exit whereas HIGH & CLOSE are used for next day exit.
Cheers,
ozt
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/28/2004(UTC) Posts: 110
|
asx trader,
With an EOD system you would need to reference yesterday's exit trigger. An if statement is difficult to use because you would not be able to satisfy both the else and then equations necessary. ValueWhen should do the trick. Like this:
LongExitPrice :=ValueWhen(1,Ref(LongExitTrigger,-1),Open) ;
I don't believe that you will need a value argument for LongExitTrigger since you simply need the condition to be true. If the output of the LongExitTrigger is a continuous value then something like
LongExitPrice :=ValueWhen(1,ref(close,-1) < Ref(LongExitTrigger,-1),Open) ;
should do the trick.
Hope this helps,
Preston
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 3/28/2008(UTC) Posts: 4
|
To Oz trader and Preston
Thanks for the response , but I think It will be clear when I give more explanation. For example let's pull out SMM(Summit Resources) the trading signal was on 29/12/06 and the next following morning I enter the trade at predefined limit price. Now, here comes the major issues i.e. at 11/1/2007 I got stoped out by trailling stp. It should have wait the initial stop before it did its duties
can value when fuction or alert and if fuction prevent this early trailing stop ? if it can how?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Hi asx trader,
Unfortunately you are making it a bit awkward to comment in that you haven't posted your TradeSim instruction code for the system.
Now at least we can relate your sytem code to SMM which should make things easier!
Given that SMM triggered on 29/12/06 and you entered at OPEN on the next bar ($3.12) then the system stop loss is "0.91*LongEntryPrice" which would equal $2.8392 on the data I use.
Your code (If(Ref(C,-1)> 0.91*LongEntryPrice) seems somewhat unusual for an InitialStop as in IMO you need to give the Long trade a chance to develop and would thus use Ref(CLOSE,-1) < 0.91*LongEntryPrice. However, as stimulated, that is just my opinion.
The "reason" for the ExitTrigger trailing stop, as I understand it, is to hopefully protect profits and thus activate an EXIT which is above our InitialStop.
So lets calculate the ExitTrigger value given on 10/1/2007 based on the code posted:-
(ExtFml( "TradeSim.TrailingStop",TRIGGER,LONG,3*ATR(10),High,Low));
which is approxiamately $3.0326 (i.e. higher than the InitialStop of $2.8392) and therefore a valid ExitTrigger!
Whilst the ExitPrice depends on the TradeSim code used in the system I would suggest it is probably at $3.02 which is the value of the OPEN on 11/1/2007.
Hope this all makes sense and I haven't missed any issues.
All the best asx trader,
ozt
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 3/28/2008(UTC) Posts: 4
|
thanks for your response. by changing > to < symbol it even change the equity curve worst.
it should have a solution to this function.
I just try to simulate a trading performance close to reality, I dont think any one will exit the trade by his/ her trail stop before the initial stop get triggerred.
I think I might ask David Sambrosky about this issues.
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
get stoped out by trailing stop before initial fix stop
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.