Hi Lee
I think a PREV-based latch is tho only way to do
this in MFL. Such a latch allows you to create exit signals based on the entry
price, current price or virtually any other price. Of course the down side is
that the PREV code executes at snails pace. On the plus side, it
works.
Trade:=If(PREV<=0, (entry signal)*(entry
price), If( (independent exit signal) OR C<PREV*0.95 , -PREV {or -1},
PREV));
The Trade variable will set to the value of the
entry price if an entry signal is received and the Trade latch is reset
{=0} or in the process of resetting {<0}. Once the latch is set the first
If() function bypasses all entry signals and passes control to the second If()
function. This second If() function acts on either of two exit conditions
being met {more conditions are possible}. An independent exit signal will
reset the latch by forcing the output of the latch to switch from +PREV to
-PREV, and/or a CLOSE below 95% of the entry price (PREV) will also force an
output of -PREV. You can add other exit conditions ad-nauseum, but remember
that each PREV will slow down the code even more.
Keep in mind that the trade closes on the bar
that Trade goes negative so the trade probably progresses until the close of
the current bar. Adding
Trade:=Abs(Trade);
as the next line of code extends a positive value
output from the latch by one bar.
Back to the first If() function. If there is no
entry signal on the bar after the reset the latch will return to a zero
result. However, an entry signal from this point on will set the new entry
price into latch, indicating that a new trade is active.
Does that make sense?
Regards
Roy
----- Original Message -----
Sent: Tuesday, May 05, 2009 11:44
AM
Subject: [EquisMetaStock Group] Open
Price indicator
Hi there,
Has anyone been successful and solving an indicator that
determines your open price? So you can then create a stop loss or break even
indicator.
Allthough you can use the 'Valuewhen' command to find the
price when an open condition was triggered, there may have been several more
open conditions triggered before you receive a close trigger. Hence the open
price will change on you.
There has to be a simple
fix!
Lee.
__________ NOD32 4052 (20090504)
Information __________
This message was checked by NOD32 antivirus
system.
http://www.eset.com