Forums › ProRealTime English forum › ProOrder support › Fibonacci retrace backtest for PRT – collaboration project › Reply To: Fibonacci retrace backtest for PRT – collaboration project
Great – that’s a question I was looking for.
There are a few options to chose from. At present I am suggesting this as a simple starting point:
First long of the cycle triggered by price >= 23.6% retrace of the down move; soft targets on each fib level (reducing 1/4 of the position with each touch of a new level).
1 2 3 |
if (not onMarket) and fibSet and (close < t236) then BUY positionSize CONTRACTS AT t236 STOP endif |
If the fib range is extended down after it’s first drawn (as per your example above) no trade is likely to be triggered. The probability of further retracement is much increased if 23.6% level is actually hit.
On the event of a false break of 23.6% the cycle is negated if the probability of break even on the first trade is reduced to below x% – need a hit rate and risk:reward analysis to set sensible stop loss criteria. Contemplating a degree of martingale style (“grid”) retries up to a degree of tolerance if probability of upturn increases – to be researched (Remember this should not yet be adapted to any one market’s idiosyncratic behavior – that will come much later).
To my mind we identify possible setups and their possible outcome scenarios. From there we identify what set of entry and exit rules would work the best (mathematically speaking) and using hindsight. Many “trading systems” employ one rigid set of entry and exit rules. What I propose is that the library (albeit top-down code) contain a sub-loop of entry and exit rule combinations (sub strategies). The intelligent piece will be to allocate a given sub-strategy based upon what’s happening with price action. This is how you would trade as a human. Furthermore oftentimes trading sytems stop “monitoring” price action as soon as a trade goes on :
1 2 3 4 5 6 7 8 |
if not onMarket then // do some analysis of price action endif if longOnMarket then // do some maths about our position // forget about anything that's going on with price action endif |
The former is as if you were closing your eyes and going to sleep immediately after placing at trade (You may as well have bought a binary option). Sometimes that is what you need. But I propose something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
if not onMarket then // analyse price action // allocate an entry and exit system from several to chose from endif if longOnMarket then if strategy1 then // test against strategy 1 conditions endif if strategy2 then // test against strategy2 conditions endif // re-analyse price action // ... if (priceActionCondition) then // switch to a different strategyX currentStrategy = 3 endif endif |
This nested approach is a step closer to “inteligence” and more closely models the decision making of a human trader. One may argue that this models a “second guess” mentality but it may be worth being more dynamic in certain cases. We “trade what we see”. Think about possible price action scenarios post setup and what we can learn from hindsight. Also think about the indicator itself and how “sensitive” it should be in finding a valid setup?
ps: Not received any pull request off GitHub? Will take another look.