ThinkScripter AutoFibLines

UPDATE to the UPDATE: After AutoFibLevels flatlined with last weekend’s TOS release, I had to re-write the script to entirely remove the ZigZag function. After a week in the ThinkScripter laboratory fueled with generous amounts of Shiner Bock, the script lives again and has several enhancements. As before, the AutoFibs will automatically draw a set of user-defined fib levels and extensions based on the previous swing high and low. The user defines the price/percentage reversal required to establish a reversal has occurred. The new version is now functional on all charts/symbols including FOREX.

UPDATE : This script had been rendered inoperable as of 12 Dec 09 due to changes in the TOS ZigZag function. I will leave it posted as a reference for coders to examine the script methodology. The new version does not use the Zig Zag and is available to PRO Subscribers.

Ever found yourself trading a very fast paced market and wanted some reference to the Fibonacci retracements/extensions but didn’t want to keep drawing and erasing them using the standard ToS tool? I have – so I created the AutoFibLines study. AutoFibLines looks for price reversals greater than a user defined threshold and then captures the swing highs and lows. Using these levels, it then plots a series of seven user defined Fibonacci ratio levels as well as the previous swing high and low. The Fibonacci ratios are fully user configurable and can be both positive numbers (in the direction of the current price swing) or negative numbers (opposite to the current price swing). The Fib levels are plotted in the empty space to the right of the current bar and so you must have some “Right bars” specified in the style settings. The study updates continuously with price action so there is no user interaction required beyond initial configuration. You can run multiple copies of the study with different reversal thresholds specified to see major, minor, and micro levels at once. (Note: There is currently a bug in TOS build 1324 and up causing this study to be intermittent on TICK charts. TOS is addressing the issue)

ThinkScripter AutoFibs

ThinkScripter AutoFibs


Code Now Available in the ThinkScripter Forum

This entry was posted in Indicator and tagged , , , . Bookmark the permalink.

22 Responses to ThinkScripter AutoFibLines

  1. icm63 says:

    I assume one can go bull and bear auto fibs, looks good !

  2. rickf says:

    Heh – I was just talking about this exact thing on Friday to a fellow trader during a quiet lull in the session……what are you, tapping our chatroom? ;)

  3. Ryan says:

    I’m loving this script! As an avid “ambush” trader, this will be just a fantastic addition to the toolbox. Thanks!

  4. Brian says:

    Eric,
    I am very impressed with yet another fantastic effort . It is amazing to watch how many of the small reversals during the day happen between the 50-62% fibs. Thank you very much. Expect another donation from this trader!

  5. Chad says:

    How do you set up the Major, Minor, Micro. I played around with the used defined. What does that mean?is this based on bars? How far of a time frame can you set this on?

    • Chad,
      For example, you can have three copies of the AutoFibs running at once. For the first, set the reversal amount to whatever you consider a “Major” trend move to be. Let’s say for the ES you define this to be 50 points. For the second copy of AutoFibs set the reversal amount to a smaller number, say 10 ES points. This will capture smaller moves not seen by the first copy of AutoFibs. Lastly, for the third copy of AutoFibs, set the reversal amount to 3 for example. This will reverse often with most of the micro moves in the ES while the two other copies only reverse when their threshold has been met. The reversal amount is purely based on price action and is limited in time to whatever you can display on your screen. If a reversal of the magnitude specified exists on your displayed time period, it will be captured by AutoFibs. Hope I answered your question. If not let me know.
      Eric

  6. KS says:

    Eric,
    I am new here. I uploaded this code into my TOS chart and nothing came up. Is there a trick? I also trade the Ambush and looking forward to testing it out.
    Thank you.

    • Ensure you have a reasonable number set for the reversal amount. Try various numbers until the study appears. Also you must have some number of bars in the right margin showing by setting it on the style panel.
      Eric

  7. JimS says:

    Hi Eric,

    It looks like this doesn’t work with the Forex charts. I tried it on /ES and it was fine.

    As near as I can figure, the ToS ZigZag functions look for whole numbers as input, and use the default value if you try to enter anything fractional. For instance, they choke if I enter 0.002 (20 pips). It just defaults to 1, and I’m unlikely to have a 10,000 pip move any time soon! :)

    Any idea what is going on inside those things so I can just code the ZigZag function?

    Thanks!

    • Jim,
      Yes, this chokes on anything down so low. I have a workaround in mind that I’ll give a shot. I don’t really know what makes the ZigZag tick or I would just code around it.
      Eric

  8. Alex says:

    Its not coming up on my charts for some reason…I tried on 15min, 30min, hour;ly and daily, all with different reversal settings…still not showing…any ideas as to why? (the chart is expanded to right by 50)

    Thanx

  9. David McHugh says:

    Hi Eric, always impressed when I visit your site…great looking scripts to try out!

    I am using auto fibs but want to clear lines that have been crossed to unclutter the chart; as I use a black background I attempted to just color them black using:

    f1. AssignValueColor (if modeup and low > f1 then color.black else if modedown and high < f1 then color.black else color.magenta);

    but not working…Please help….mac

  10. Jeff says:

    Eric

    What are the green and/or red arrows this study draws?

    TIA

  11. Eric says:

    Eric…I just put on the AutoFibLines study on my charts that has the /CL crude oil on it and the swing hi and low lines come from the previous day. I have it set at 1 day 1 min and have put it at today 1 min and it is the same. The day starts at 6 pm and runs till 5:15 pm. How can I set it to get the coreect opening time for this study.

    Thanks and Love your site and studies

    Eric/Hguru

    • ThinkScripter says:

      The swings are completely time independent and only depend on price action and the settings you have used for the indicator. Only changing the amount required for reversals will affect the fibs.
      -Eric

  12. thinkscripter says:

    Really you can put whatever ratios of the last swing high-low you want. The standard configuration has fib lines at 0.382, 0.50, 0.618, 0.786, -0.236, -0.382, and -0.5 (as well as 0.0 and 1.0). This is set up for an ambush reversal at 50%-61.8% counter to the direction of the last reversal. The negative values then provide extension targets.
    -Eric

  13. David Brennan says:

    Thanks for the great script.

    If I want to only show the fibs at a certain other event, such as showing the fibs only when two moving averages cross, how would I incorporate that code into your script?
    Thanks.

  14. You will need to create a binary variable for your additional conditions and then use it in the plot statements to avoid plotting when the conditions are false.
    -Eric

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>