Hi,
I'm trying to write a simple EL exit strategy to sell or buytoclose when the price comes back to VWAP
I have a code that is functional but when it is employed it seems to actually sell or buy at at a 20MA, not VWAP. Inputs and variables below:
inputs: VWAPLength(20);
variables: VWAPValue(0); VWAPValue = Average(close, VWAPLength);
if close crosses above VWAPValue then sell next bar at market;
else if close crosses below VWAPValue then buy to cover next bar at market;
Any ideas as to why this would be happening?
Thanks
Dan
I'm trying to write a simple EL exit strategy to sell or buytoclose when the price comes back to VWAP
I have a code that is functional but when it is employed it seems to actually sell or buy at at a 20MA, not VWAP. Inputs and variables below:
inputs: VWAPLength(20);
variables: VWAPValue(0); VWAPValue = Average(close, VWAPLength);
if close crosses above VWAPValue then sell next bar at market;
else if close crosses below VWAPValue then buy to cover next bar at market;
Any ideas as to why this would be happening?
Thanks
Dan