Tuesday, February 17, 2009

Rotation Factor (Market Profile)

vars: aa(0), bb(0), cc(0), dd(0), ee(0), firstbar(0), length(0);

if date > date[1] then begin
firstbar=currentbar;
end;

length=currentbar-firstbar;

if h>h[1] then aa=1 else aa=0;
if hif h=h[1] then cc=0 else cc=0;

if l>l[1] then dd=-1 else dd=0;
if lif l=l[1] then cc=0 else cc=0;

value1=aa+bb+cc+dd+ee;

value2=summation(value1,length);

plot1(value2,"RF");
plot2(12,"12");

Saturday, September 27, 2008

H or L First Indicator






if h>highd(0)-.01 then value1=1;
if l

if h>highd(0)-.01 and time>829 and date=date[1] and date[1]=date[2] and date[2]=date[3] and date[3]=date[4] then
plot1(value1,"cc");
if l829 and date=date[1] and date[1]=date[2] and date[2]=date[3] and date[3]=date[4] then
plot2(value2,"cc");



plot3(0,"0");

Saturday, August 23, 2008

High or Low Made First Code (30-Min Chart)



vars: aa(0), cc(0), dd(0), firstbar(0), length(0);
if date>date[1] then begin
firstbar=currentbar;
end;
length=(currentbar-firstbar)+1;

cc=(highd(0)-lowd(0));
dd=-(highd(0)-lowd(0));

condition1=lowest(l,9)<(lowd(0)+0.25) or highest(h,9)>(highd(0)-0.25);
condition2=highest(h,9)<(highd(0)-0.25) and lowest(l,9)>(lowd(0)+0.25) ;

if highestbar(h,length)>lowestbar(l,length) then aa=dd;
if highestbar(h,length)

if time>1539 and time<1601 then
plot1(aa,"cc");


plot3(0,"-18");


if condition1 and aa>0 then
setplotcolor(1,green);
if condition1 and aa<0 then
setplotcolor(1,red);

Thursday, April 3, 2008

Std Dev vs Mean (VWAP) Code







vars:
PriceW(0),
ShareW(0),
Count(0),
VolWAPValue(0),
VolWAPVariance(0),
VolWAPSD(0),
aa(0),
bb(0),
cc(0),
dd(0),
ee(0);

if date > date[1] then begin
PriceW = 0;
ShareW = 0;
Count = -1;
Value1 = 0;
Value2 = 0;
VolWAPValue = 0;
end;
PriceW = PriceW + (AvgPrice * (UpTicks+DownTicks));
ShareW = ShareW + (UpTicks+DownTicks);
Count = Count + 1;
Value3 = 0;
if ShareW > 0 then VolWAPValue = PriceW / ShareW;
{Calculate the individual variance terms for each intraday bar starting with the current
bar and looping back through each bar to the start bar. The terms are each normalized
according to the Variance formula for each level of volume at each price bar }
For Value1 = 0 To Count Begin
Value2 = ((UpTicks[Value1]+DownTicks[Value1])/ShareW) * (Square(AvgPrice[Value1]-VolWAPValue));
Value3 = Value3 + Value2;
End;
VolWAPVariance = Value3;
VolWAPSD = SquareRoot(VolWAPVariance);
value1=volwapsd;

if time=600 then aa=volwapsd;
if time=700 then bb=volwapsd;
if time=800 then cc=volwapsd;
if time=900 then dd=volwapsd;
if time=1000 then ee=volwapsd;

if time>500 and time<600 then
plot2(aa,"am");

if time>600 and time<700 then
plot2(bb,"am");

if time>700 and time<800 then
plot2(cc,"am");

if time>800 and time<900 then
plot2(dd,"am");

if time>900 and time<1000 then
plot2(ee,"am");


value2=(value1[203]+value1[406]+value1[609])/3;
value3=(value1+value2)/2;
value4=value3*2;
Plot1(value1, "vwap");
{Plot3(value3, "Avg of Avg");}

Range vs Avg Range





value1=highd(0)-lowd(0);

value2=(value2[203]+value2[406]+value2[609])/3;

Plot1(value1, "today");
Plot2(value2, "3-Day Avg");
if time>1000 then begin
Plot3(20.0,"20");
Plot4(30.0,"30");

end;

Friday, March 21, 2008

Tails




vars: vwap1(0), close1(0), aa(0), bb(0), cc(0), dd(0), ee(0), firstbar(0), length(0);


condition1{Buying Tail}=c>(l+3) and o>(L+3) and (o-c)>-5 and lcondition2{Selling Tail}=c<(h-3) and o<(h-3) and (c-o)<5 and h>highest(h,2)[1];



if condition1 and o>=c then dd=l-c;
if condition1 and c>o then dd=l-o;

if condition2 and c>=o then dd=h-o;
if condition2 and c
if time<831 and dd<-3 and condition1 then
plot1(dd, "tail");

if time<831 and dd>3 and condition2 then
plot1(dd, "tail");

plot2(0,"0");

if dd<0 then
setplotcolor(1,green);
if dd>0 then
setplotcolor(1,red);


if h>highd(1) and condition2 then begin
setplotwidth(1,5);
setplotcolor(1,red);
end;

if hsetplotwidth(1,1);
setplotcolor(1,white);

end;

if lsetplotwidth(1,5);
setplotcolor(1,green);
end;

if l>lowd(1) and condition1 then begin
setplotwidth(1,1);
setplotcolor(1,white);
end;


3/10 Oscillator With Price/Osc Markts




Inputs: Price(Close), Avg1(3), Avg2(10), Avg3(16), StdDsp(1);

Value1=(Average(Price,Avg1)-Average(Price,Avg2))/AvgTrueRange(20);

Value2=(Average(Value1,Avg3));


Plot1(Value1,"3/10Line");
Plot2(Value2,"16Line");
Plot3(0,"ZeroLine");
Plot4(.9,"+Impulse");
Plot5(-.9,"-Impulse");
Plot6(Value1,"3/10 Pt");

condition1=highest(value1,3)>highest(value1,20)[3] and c>vwap_h;
condition2=highest(high,3)>highest(h,20)[3];

condition3=lowest(value1,3)condition4=lowest(low,3)
if condition1 and condition2 then begin
setplotcolor(6, blue);
setplotwidth(6, 4);
end;
if condition3 and condition4 then begin
setplotcolor(6, red);
setplotwidth(6, 4);
end;