Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 9/8/2004(UTC) Posts: 2,266
Was thanked: 1 time(s) in 1 post(s)
|
Ok so I will create a new function for the prev based latch based on Roy's example:
{Example 6}
N:=Fml("set signal");
X:=Fml("reset signal");
Tr:=If(PREV=0,If(N,CLOSE,0),If(X OR C>=PREV*1.2,0,PREV));
Tr;
So a very basic version of this would be:
[code:1:7c2a41f587]
void LatchPrevC (
const MSXDataRec * Data,
const MSXDataInfoRec * Input1,
const MSXDataInfoRec * Input2,
MSXDataInfoRec * Result)
{
int startIdx = Data->sClose.iFirstValid;
int endIdx = Data->sClose.iLastValid;
int i;
Result->iFirstValid = startIdx;
Result->iLastValid = endIdx;
for (i = startIdx; i <= endIdx; i++ )
{
if(i==0) {Result->pfValue[i] = 0;}
else if(Result->pfValue[i - 1] == 0)
{
if(Input1->pfValue[i] == 1){Result->pfValue[i] = Data->sClose.pfValue[i];}
else {Result->pfValue[i] = 0;}
}
else
{
if( Input1->pfValue[i] == 1 || Data->sClose.pfValue[i]>=( Result->pfValue[i-1]*1.2) )
{Result->pfValue[i] = 0;}
else
{Result->pfValue[i] = Result->pfValue[i-1];}
}
}
}
/* Based on
Tr:=If(PREV=0,If(N,CLOSE,0),If(X OR C>=PREV*1.2,0,PREV));
*/
[/code:1:7c2a41f587]
So How do we improve it from here? What is needed? How do you see working? How do we make this more flexible?
Patrick :mrgreen:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Patrick
I've only just seen this thread. I don't have an immediate answer for you, but I may be able to come up with a couple of thoughts in the next 24-48 hours.
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 9/8/2004(UTC) Posts: 2,266
Was thanked: 1 time(s) in 1 post(s)
|
Roy, I would love your feedback on this so take your time ;)
I won't do anything until I get your reply ...
Anyone is welcome to give their opinion as well of course :)
Patrick :mrgreen:
|
|
|
|
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.