InvestorsHub Logo
Followers 11
Posts 2529
Boards Moderated 1
Alias Born 04/03/2009

Re: A deleted message

Wednesday, 03/07/2012 3:31:22 PM

Wednesday, March 07, 2012 3:31:22 PM

Post# of 3631
Fibonacci Pivot Formula redone below. The extra code was moving the points around (forgot about that.)

I may remove the extra code from the regular Pivots after I figure out what the Bear and Bull market calc is trying to accomplish. I haven't looked at it that closely.


#####


input marketThreshold = 0.00;
input timeFrame = {default DAY, "2 DAYS", "3 DAYS", "4 DAYS", WEEK, MONTH, "OPT EXP"};
input showOnlyToday = no;


def PP2 = high(period = timeFrame)[2] + low(period = timeFrame)[2] + close(period = timeFrame)[2];

plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;

if showOnlyToday and !IsNaN(close(period = timeFrame)[-1])
then {
R1 = Double.NaN;
R2 = Double.NaN;
R3 = Double.NaN;
PP = Double.NaN;
S1 = Double.NaN;
S2 = Double.NaN;
S3 = Double.NaN;

} else {

PP = (high(period = timeFrame)[1] + low(period = timeFrame)[1] + close(period = timeFrame)[1]) / 3;
R1 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* .382);
R2 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* .618);
R3 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* 1.0);

S1 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* .382);
S2 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* .618);
S3 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* 1.0);

}

PP.SetDefaultColor(GetColor(0));
R1.SetDefaultColor(GetColor(2));
R2.SetDefaultColor(GetColor(8));
R3.SetDefaultColor(GetColor(3));
S1.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(1));
S3.SetDefaultColor(GetColor(3));


PP.SetStyle(Curve.firm);
R1.SetStyle(Curve.SHORT_DASH);
R2.SetStyle(Curve.SHORT_DASH);
R3.SetStyle(Curve.SHORT_DASH);
S1.SetStyle(Curve.SHORT_DASH);
S2.SetStyle(Curve.SHORT_DASH);
S3.SetStyle(Curve.SHORT_DASH);

def paintingStrategy = if timeframe == timeframe.WEEK then PaintingStrategy.DASHES else if timeFrame == timeFrame.MONTH or timeFrame == timeFrame."OPT EXP" then PaintingStrategy.DASHES else PaintingStrategy.DASHES;

PP.SetPaintingStrategy(paintingStrategy);
R1.SetPaintingStrategy(paintingStrategy);
R2.SetPaintingStrategy(paintingStrategy);
R3.SetPaintingStrategy(paintingStrategy);
S1.SetPaintingStrategy(paintingStrategy);
S2.SetPaintingStrategy(paintingStrategy);
S3.SetPaintingStrategy(paintingStrategy);

#####

Join the InvestorsHub Community

Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.