CryptoFib: Automatically Generate Fibonacci Retracement Levels in EasyLanguage
September 8th, 2009WARNING: This is not a recommendation to buy, sell or hold any financial instrument.
I was looking for an indicator that automatically generates Fibonacci retracement levels when a move exceeds a specified number of pips over a specified number of bars.
There must be some indicators out there that do this, but I couldn’t find any in the vast sea of free EasyLanguage code out there.
I decided to write my own. It’s hamfisted, but it’s working as intended. This thing is pretty useless on its own, but maybe someone out there is looking to combine it with other stuff.
Notes:
This is set to look at bullish retracements. Minimumdelta is the change in pips (or whatever units your asset uses) that must have occurred over the high/low extremes of your LookBack length. The high (oHighest) and low (oLowest) become the pivots from which the Fibonacci levels are calculated. Format the indicator in TradeStation/MultiCharts to display as points.
//CryptoFib
//Written by Kevin Flaherty – cryptogon.com – 2009//
Inputs:
LookBack (100),
MinimumDelta (.0030);
Variables:
oLowest (0),
oLowestBarsAgo (0),
oHighest (0),
oHighestBarsAgo (0);
//Find Low
Value1 = ExtremesFC(Low, LookBack, -1, oLowest, oLowestBarsAgo);
//Find High
Value2 = ExtremesFC(High, LookBack, 1, oHighest, oHighestBarsAgo);
Condition1 = (oHighest-oLowest) > MinimumDelta
and oHighestBarsAgo – oLowestBarsAgo < 0;
If condition1 then begin
plot1 (oHighest-(oHighest-oLowest)*.382, ".382");
plot2 (oHighest-(oHighest-oLowest)*.500, ".500");
plot3 (oHighest-(oHighest-oLowest)*.618, ".618");
end;
Here’s how it looks in MultiCharts. It’s active in subchart 1 with the candles:

