Bill and Mike,

Yes, this is the book I was referring to. I learned not to trust anything, so I 
test anything I read and Larry Connor's systems do match the results he 
publishes in his books.

Mike, thanks for the hint for the "4 out of 5". I thought about using SUM() 
function for this but, that was after seeing how you applied it in the scale-in 
code.

Kind Regards
Richard


--- In [email protected], "Mike" <sfclimb...@...> wrote:
>
> Charting the interesting bars makes it a little easier to see
> 
> Colors = IIF(InterestingBar, colorRed, colorDarkGrey);
> Plot(Close, "Price", Colors, styleBar);
> PlotShapes(Trigger * shapeUpArrow, colorGreen);
> 
> Mike
> 
> --- In [email protected], "Mike" <sfclimbers@> wrote:
> >
> > Hi,
> > 
> > Which book/course are you guys referring to?
> > 
> > As for "programming with ease", the best you can do is read lots and lots 
> > of coding examples. The rest you're born with. For better or for worse, 
> > your brain just works that way or it doesn't.
> > 
> > As for 4 out of 5, no loop necessary. Loops should be treated as a last 
> > resort. Instead, try something like the following:
> > 
> > InterestingBar = Low < Ref(Low, -1) AND High < Ref(High, -1);
> > Trigger = Sum(InterestingBar, 5) >= 4;
> > 
> > Plot(Close, "Price", colorDarkGrey, styleBar);
> > PlotShapes(Trigger * shapeUpArrow, colorGreen);
> > 
> > Mike
> > 
> > --- In [email protected], "Richard" <richpach2@> wrote:
> > >
> > > Bill and Mike,
> > > 
> > > Thanks for sharing your coding skills. Coincidently I was looking at the 
> > > same system.
> > > If this is TPS then, it is one down and six to go. I have to say that 
> > > this one was the hardest to code from the book. I have two questions, if 
> > > I may.
> > > How do one gain the skills necessary to program in AFL with such 
> > > (perceived) ease?
> > > Have you coded MDU system? How did you solve the AFL definition for "4 
> > > out of last 5 bars making lower low and lower high"? 
> > > Do I need a loop for this?
> > > 
> > > Kind Regards
> > > Richard
> > > 
> > > 
> > > --- In [email protected], "longt3rm" <longt3rm@> wrote:
> > > >
> > > > Mike,
> > > > 
> > > > Fantastic, it works!
> > > > 
> > > > Thank you for your help!
> > > > 
> > > > Bill
> > > > 
> > > > --- In [email protected], "Mike" <sfclimbers@> wrote:
> > > > >
> > > > > Bill,
> > > > > 
> > > > > You would need to calculate the trigger first (i.e. ExRem of position 
> > > > > state), then use ValueWhen.
> > > > > 
> > > > > e.g. Something like the following:
> > > > > 
> > > > > thirdTrigger = ExRem(inThirdPos, Sell);
> > > > > bull400 = Close < ValueWhen(thirdTrigger, Close) AND inThirdPos AND 
> > > > > Ref(inThirdPos, -1);
> > > > > 
> > > > > The key being that Flip will give all 1's for the duration that we 
> > > > > are in the position, whereas ExRem will remove redundant 1's leaving 
> > > > > only those bars where the condition was first met. Thus, ValueWhen 
> > > > > gives the Close of the most recent bar meeting that condition.
> > > > > 
> > > > > Mike
> > > > > 
> > > > > --- In [email protected], "longt3rm" <longt3rm@> wrote:
> > > > > >
> > > > > > Mike,
> > > > > > 
> > > > > > Thank you! That helps significantly!!
> > > > > > 
> > > > > > The one item I'm not able to figure out is how to track the last 
> > > > > > entry price so we can check to see if the current close is lower 
> > > > > > than our last entry. 
> > > > > > 
> > > > > > I believe (I could be mistaken) the sample you kindly provided is 
> > > > > > checking to see if today's close is less than yesterday's close. I 
> > > > > > would like to compare today's close to our last entry price.
> > > > > > 
> > > > > > Thanks again for helping so much. I am slow to grasp AFL.
> > > > > > 
> > > > > > Sincerely,
> > > > > > 
> > > > > > 
> > > > > > Bill
> > > > > > 
> > > > > > --- In [email protected], "Mike" <sfclimbers@> wrote:
> > > > > > >
> > > > > > > Hi,
> > > > > > > 
> > > > > > > I posted some code to a related question here:
> > > > > > > http://finance.groups.yahoo.com/group/amibroker/message/146956
> > > > > > > 
> > > > > > > Short answers:
> > > > > > > 1. Use Flip function to capture current position "state".
> > > > > > > 2. Use state captured above AND'ed with next criteria.
> > > > > > > 
> > > > > > > See if that helps.
> > > > > > > 
> > > > > > > Mike
> > > > > > > 
> > > > > > > --- In [email protected], "longt3rm" <longt3rm@> wrote:
> > > > > > > >
> > > > > > > > Hello,
> > > > > > > > 
> > > > > > > > Goal Description: 
> > > > > > > > 1) Initial $500 position opened when RSI(2) < 25
> > > > > > > > 2) Add $1000 to position when entry price for #1 is less than 
> > > > > > > > current close. (regardless of value for RSI(2))
> > > > > > > > 3) Add $1500 to position when entry price for #2 is less than 
> > > > > > > > current close. (regardless of value for RSI(2))
> > > > > > > > 4) If all three positions are entered, we would have a total 
> > > > > > > > position of $3,000
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Two questions / problems:
> > > > > > > > 1) What is the most efficient way to determine if we have a 
> > > > > > > > position and if we do, is it the first ($500) or second 
> > > > > > > > ($500+$1000=$1500)?
> > > > > > > > 2) If the initial buy is "Buy = RSI(2)", how do we tell 
> > > > > > > > AmiBroker that RSI(2) is not longer needed, we just need 
> > > > > > > > current close > last position entry price.
> > > > > > > > 
> > > > > > > > Thanks for any suggestions.
> > > > > > > > 
> > > > > > > > Sincerely,
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Bill
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>


Reply via email to