Fibonacci Queen | Trading Reviews and Vendors - futures trading strategies, market news, trading charts and platforms

Trading Reviews and Vendors

Discuss and review vendors of commercial trading products, trading rooms and services, trading indicators or third-party paid add-ons


Fibonacci Queen

  #55 (permalink)

Trading Experience: Beginner
Favorite Futures: MES
snax's Avatar
Posts: 548 since Feb 2019
Thanks: 1,782 given, 1,347 received


Dug through my github repos to find some old SICP exercises, this one is mostly "borrowed" I sure didn't come up with the mathematical derivation, and I didn't write any tests ><. Its a neat way to do the computation fast though.

;; Exercise-1.19
;; There is a clever algorithm for computing the Fibonacci numbers in a logarithmic
;; number of steps. Recall the transformation of the state variables 'a' and 'b' in
;; the fib-iter process of section 1.2.2: (a <- a+b) and (b <- a). Call this transformation 'T',
;; and observe that applying 'T' over and over again 'n' times, starting with 1 and 0, produces
;; the pair Fib(n+1) and Fib(n).
;; In other words, the Fibonacci numbers are produced by applying T^n, the nth power of the
;; transformation T, starting with the pair (1,0). Now consider T to be the special case of p = 0 and
;; q = 1 in a family of transformations Tpq, where Tpq transforms the pair (a, b) according to
;; (a <- bq + aq + ap) and (b <- bp + aq). Show that if we apply such a transformation Tpq twice,
;; the effect is the same as using a single transformation Tp'q' of the same form, and compute p' and q'
;; in terms of p and q.
;; This gives us an explicit way to square these transformations, and thus we can compute T^n using
;; successive squaring, as in the fast-expt procedure. Put this all together to complete the following
;; procedure, which runs in a logarithmic number of steps:
;; (define (fib n)
;;   (fib-iter 1 0 0 1 n))
;; (define (fib-iter a b p q count)
;;   (cond ((= count 0) b)
;;         ((even? count)
;;          (fib-iter a
;;                    b
;;                    (??)    ; compute p'
;;                    (??)    ; compute q'
;;                    (/ count 2)))
;;         (else (fib-iter (+ (* b q) (* a q) (* a p))
;;                         (+ (* b p) (* a q))
;;                         p
;;                         q
;;                         (- count 1)))))

;; ----------------------------------
;; When transformation is applied two times and equations formed to be
;; the same for 1st and 2nd application it gets obvious that 
;; p' = p^2 + q^2
;; q' = 2pq + q^
;; @see
;; when replaced the solution is following.
(ns sicp.ch01 (:use clojure.test))

(defn fib
  (defn fib-iter
    [a b p q cnt]
      (zero? cnt) b
      (even? cnt) (fib-iter
                    (+ (square p) (square q))
                    (+ (square q) (* 2 p q)) (dv cnt 2))
      :else (fib-iter 
              (+ (* b q) (* a q) (* a p)) 
              (+ (* b p) (* a q)) p q (dec cnt))))
  (fib-iter 1 0 0 1 n))

;; unit-tests

trendisyourfriend View Post
This discussion belongs to the past. It has been discussed at length on this forum. People are using tools which speak to them. It can be VWAP, Fibonacci retracement and extentions levels, Volume profile with its Low/High volume nodes or Pivot points and finally Moving average like the 50 EMA or 200EMA often mentionned to gauge price action.

Despite your arguments @centaurer people are making money using them because they worked on their price action reading skills. I would encourage you to look at Damian Castilla's youtube channel to educate yourself on how a profitable trader uses the Fibonnaci tool.

I quite like this discussion! It demonstrates how we are all unique and bring different ideas, concepts, and personal beliefs to the market. Thus, I don't think we should bury it in the past, the market is always evolving and so are we!

centaurer View Post
So fib levels work because there are so many people using them?
Come on. The amount of money being bet using fib levels is absolutely nothing in 2019 as % of all capital bet.


So you are saying then that fib levels have a property that a set of random levels do not. I was thinking about this after I posted the response driving around and I don't think this is testable. What are we even saying fib lines do exactly to start with to sample from and have a distribution of what? Is price attracted to them? Is price repelled by them? Does price bounce off them like a bouncing ball hitting a concrete floor? Then we would have to test whatever that is against random sets of retracement lines.

Then we are saying this works the same on monthly real estate prices in Chile, Corn futures data from 1985-1990 AND tick data of the cryptocurrency TRON? Every market displays this because of human psychology and crowd behavior no matter how different the market?

Have you not seen this happen? I'm quite surprised! One interesting quirk I have found is if you plot out the pHOD/pLOD and set the retracements between those high/low levels (I wrote a simple python script to compute them and round them off to the nearest 0.25 tick for /ES for example), you might, from time to time, see an amusing phenomenon where price surges and then bounces off the "golden ratio" as if it were made of titanium.

All of it works and None of it works, that is one of the mysteries of trading.


Visit my futures io Trade Journal Reply With Quote
The following 3 users say Thank You to snax for this post: