Sunday, December 20, 2009

Pivot levels

My TOS platform setup has not changed since my last post. The only difference is I have been watching the dollar (/DX) more closely in my main screen now.

Anyways, I am using this script to calculate the pivot levels for me. But it requires you going into edit studies and entering in the day high, low and close manually every night. As you can see, the code is almost identical to the last post, but this one allows you to put in the values in the edit studies screen.

input day_high = 0;
input day_low = 0;
input day_close = 0;

plot pivot = (day_high + day_low + day_close)/3;
pivot.SetDefaultColor(Color.YELLOW);

plot R1 = pivot * 2 - day_low;
R1.SetDefaultColor(Color.GREEN);
plot S1 = pivot * 2 - day_high;
S1.SetDefaultColor(Color.GREEN);

plot R2 = pivot + R1 - S1;
R2.SetDefaultColor(Color.LIGHT_GRAY);
R2.hide();
plot S2 = pivot - (R1-S1);
S2.SetDefaultColor(Color.LIGHT_GRAY);
S2.hide();

plot R3 = day_high + 2*(pivot-day_low);
R3.SetDefaultColor(Color.LIGHT_GREEN);
R3.hide();
plot S3 = day_low - 2*(day_high - pivot);
S3.SetDefaultColor(Color.LIGHT_GREEN);
S3.hide();