I am reading and replicating some code from "Professional Automated Trading" by Eugene A. Durenard, Wiley (2013). I'm replicating some of the simpler strategies, and one way he presents the logic of his strategy is through these FSM (finite state machine) matrices. He never explains how to read these and I can kinda reverse engineer it, but it would be really helpful if someone here could explain to me how to read the below picture so I'm totally sure. My absolute biggest confusion is the use of square brackets?

Below you have a picture of the FSM matrix for channel breakout trend following using slow and fast channel. Slow channel is used for entry and fast channel is used for exit.

enter image description here

  • $\begingroup$ The Current State is listed horizontally (Init, Long,...), the Next State is listed vertically. Obviously we start out in state Init. The expression in the box is the transition criteria: ]S,L[ below the Init means when we are in Init as long as the price is strictly between S and L we stay in State Init (see at left). If (second row) the price is greater or equal to L but strictly less than FPL then we go to state Long (so the ] vs [ tells if it is a strict inequality or loose). I assume PFL means "the Previous Value of L, but why F instead of V?? Any clues in the book? $\endgroup$
    – nbbo2
    Apr 23 at 20:40
  • $\begingroup$ The NIL in the transition matrix obviously means this transition cannot occur. For example (first row) from any state other than Init it is impossible to go back to Init (so Init is a transient state). Another ex. from Init we can never go to StopFromLong. I assume you probably already figured out all this? $\endgroup$
    – nbbo2
    Apr 23 at 20:43
  • $\begingroup$ On second thought PFL means profit from long !! It is the threshold at which we will take profit, i.e sell. Once the price is is greater or equal to PFL but strictly less than infinity we go to ProfitFromLong, i.e. we sell. Still not clear exactly how this PFL is set. $\endgroup$
    – nbbo2
    Apr 23 at 21:03
  • $\begingroup$ Probably PFL is set a fixed percentage above L at the time you enter the Long or Short state from another state (see comment in 4th row). The whole thing is pretty easy to figure out with a little guesswork, no? What is your specific question(s)? $\endgroup$
    – nbbo2
    Apr 23 at 22:47
  • $\begingroup$ @nbbo2 - I made the same guesswork. Still the brackets is not clear. You write, the ] vs [ tells if it is a strict inequality or loose. I agree, first row we have ]S, L[ => S<P<L. Now, I'm just trying to figure out how L[ and [L is different? What is the difference between S] and ]S? So for example how do you read the difference between [L, S] and ]S, L[. I think it is just the direction of the bracket that is somewhat confusing to me, as I'm used to think in inequalities! $\endgroup$ Apr 24 at 13:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.