Rank: Advanced Member
Groups: Registered, Registered Users Joined: 6/5/2005(UTC) Posts: 35
|
Let's say we have used the Forum.Latch function to arrive a trinary B variable...
I am trying to reverse the position in the market when things are bad.
Does this seem like a correct and/or reasonable approach for this problem?
Any comments would be appreciated.
[code:1:e27b6846a9]
pr := MP();
alphas := .07;
revPct := 1.015;
itrend := ExtFml("ADSI.ITrend", pr, alphas);
trigger := 2 * itrend - Ref(itrend, -2);
LE:=itrend<trigger;
SE:=itrend>trigger;
LX:=0;
SX:=0;
B:= ExtFml("Forum.Latch",LE,LX,SE,SX);
B;
{save the entry price, on the entry day }
LEBar := B = 1 AND Ref(B,-1) <> 1;
SEBar := B = -1 AND Ref(B,-1) <> -1;
EntryBar := LEBar OR SEBar;
EntryPrice := If(EntryBar, CLOSE, ExtFml("ASI.Ref",CLOSE, -BarsSince(EntryBar)));
{ Reverse the position of we are losing badly }
B := If(B = -1 AND CLOSE > EntryPrice*RevPct, 1, If(B=1 AND CLOSE < EntryPrice/RevPct,-1,B));
{We Update B here, I'm not sure if this will effect the workings of the Latch function...}
B;
[/code:1:e27b6846a9]
Thanks,
Brad Ulrich
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
Brad, anytime the exit/reverse conditions affects the entry (such as in your 1.5% stop), the use of PREV functions are necessary to avoid misalignment between original & new latches. Take a look at this indicator example.
I'm hoping that someone can eventually come up with a PREVless latch DLL for this purpose. ;)
jose '-)
|
|
|
|
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.