An Anchored VWAP Channel For Congested Markets
In his article “An Anchored VWAP Channel For congested Markets”, Andrew Coles has demonstrated how one can identify price reversals using an indicator that combines channel and envelope methodologies.
Using Tradecision’s Indicator Builder, one needs to create four indicators: PDB_Daily_Top indicator, PDB_Daily_Bottom indicator, PDB_Intraday_Top indicator and PDB_Intraday_Bottom indicator:
PDB_Daily_Top indicator:
{user defined input}
input
start_month:"startng month", 1, 1, 12;
start_day:"starting day of month", 1, 1, 31;
start_year:"starting year", 2000, 1980, 2100;
upper_perc:"percentage-upper", 1, 1, 50;
end_input
var
start:=start_day = DayOfMonth() and start_month =
Month() and start_year = Year();
denom:=0;
pv:=0;
M:=0;
end_var
{mid price}
pv:=MedianPrice() * v;
{Midas calculation}
denom:=iff(cum(V) - NthValueWhen(1, start,
Cum(V)) = 0, 1, Cum(V) - NthValueWhen(1, start,
Cum(V)));
{Adding percent displacement bands}
M:=iff(BarsSince(start)>0, (Cum(pv) -
NthValueWhen(1, start, Cum(pv))) / denom,
MedianPrice());
return M * (1 + (upper_perc/100));
PDB_Daily_Bottom:
{user defined input}
input
start_month:"startng month", 1, 1, 12;
start_day:"starting day of month", 1, 1, 31;
start_year:"starting year", 2000, 1980, 2100;
lower_perc:"percentage-lower", 1, 1, 50;
end_input
var
start:=start_day = DayOfMonth() and start_month =
Month() and start_year = Year();
denom:=0;
pv:=0;
M:=0;
end_var
{mid price}
pv:=MedianPrice() * v;
{Midas calculation}
denom:=iff(cum(V) - NthValueWhen(1, start,
Cum(V)) = 0, 1, Cum(V) - NthValueWhen(1, start,
Cum(V)));
{Adding percent displacement bands}
M:=iff(BarsSince(start)>0, (Cum(pv) -
NthValueWhen(1, start, Cum(pv))) /
denom, MedianPrice());
return M * (1 - (lower_perc/100));
PDB_Intraday_Top:
{user defined input}
input
start_month:"startng month", 1, 1, 12;
start_day:"starting day of month", 1, 1, 31;
start_year:"starting year", 2000, 1980, 2100;
start_hour:"hour", 1, 1, 24;
start_min:"minute", 0, 0,60;
upper_perc:"percentage-upper", 0.001, 0.001, 2;
end_input
var
start:=start_day = DayOfMonth() and start_month =
Month() and start_year = Year() and start_hour =
Hour() and start_min = Minute();
denom:=0;
pv:=0;
M:=0;
end_var
{mid price}
pv:=MedianPrice() * v;
{Midas calculation}
denom:=iff(cum(V) - NthValueWhen(1, start,
Cum(V)) = 0, 1, Cum(V) - NthValueWhen(1,
start, Cum(V)));
{Adding percent displacement bands}
M:=iff(BarsSince(start)>0, (Cum(pv) -
NthValueWhen(1, start, Cum(pv))) /
denom, MedianPrice());
return M * (1 - (upper_perc/100));
PDB_Intraday_Bottom:
{user defined input}
input
start_month:"startng month", 1, 1, 12;
start_day:"starting day of month", 1, 1, 31;
start_year:"starting year", 2000, 1980, 2100;
start_hour:"hour", 1, 1, 24;
start_min:"minute", 0, 0,60;
lower_perc:"percentage-lower", 0.001, 0.001, 4;
end_input
var
start:=start_day = DayOfMonth() and start_month =
Month() and start_year = Year() and start_hour =
Hour() and start_min = Minute();
denom:=0;
pv:=0;
M:=0;
end_var
{mid price}
pv:=MedianPrice() * v;
{Midas calculation}
denom:=iff(cum(V) - NthValueWhen(1, start,
Cum(V)) = 0, 1, Cum(V) - NthValueWhen(1,
start, Cum(V)));
{Adding percent displacement bands}
M:=iff(BarsSince(start)>0, (Cum(pv) -
NthValueWhen(1, start, Cum(pv))) /
denom, MedianPrice());
return M * (1 - (lower_perc/100));
|