Problem latching trade signal

I am trying to latch a buy/sell signal, that once triggered the up/down arrow stays forever regardless if the price goes up or down from the the trigger event.

I am using:

By = IIf(trend == 1 , 1 , Null );
Sl = IIf( trend == -1 , 1 , Null );
Flip(by,sl);
Buy = ExRem(By,Sl);
Sell = ExRem(Sl,By);

With this if the price runs opposite to the trigger the signal goes on and off as the prices oscillates above and below the trigger point.

Once triggered I need to latch the trigger point forever.

Would someone be so kind to correct my error?

rgds, J

@Jaye,

Have you seen the request for everyone to get "Verified"?

When posting a question, you need to be a verified user. Also, we ask that you post your code in code blocks (that way we can easily test it out).

We also ask that you post "complete" code. Yours shows a variable "trend" but not how you calculate it.

Please SEARCH the term "Verified" and follow the steps to get verified.

The advice I will give you now (before you are verified) is to use an Exploration to watch your results over several bars to see what your signals are actually doing.

2 Likes