2009年10月5日星期一

Fibonacci Line



you can combine this code with the pivot point for intraday chart.

#This script is for intraday.
#length is for 800 minutes of the canddles.
#Use this with 1 Minute chart.

declare fullrange;
input length =800;

def DayHigh = HighestAll(high);
def DayLow = LowestAll(low);
Plot dh = DayHigh;
Plot dl = DayLow;

def hi = GetMaxValueOffset(high);
def lo = GetMinValueOffset(low);


def hitime = GetMaxValueOffset(DayHigh , length);
def lotime = GetMinValueOffset(DayLow , length);
def updown = if hitime >= lotime then 1 else 0;


def ud23 = if ( updown, 0.236, (1 - 0.236));
def ud38 = if ( updown, 0.382, (1 - 0.382));
def ud61 = if ( updown, 0.618, (1 - 0.618));
def ud78 = if ( updown, 0.786, (1 - 0.786));

plot uFib50 = (Dayhigh - DayLow) / 2 + DayLow;
plot uFib23 = (Dayhigh - DayLow) * ud23 + DayLow;
plot uFib382 = (Dayhigh - DayLow) * ud38 + DayLow;
plot uFib618 = (Dayhigh - DayLow) * ud61 + DayLow;
plot uFib786 = (Dayhigh - DayLow) * ud78 + DayLow;

沒有留言:

發佈留言