TradeStation語法分享(2)—AR&BR
input:n(26),up_AR(1.5),up_BR(3),down_AR(0.5),down_BR(0.5);
variable:AR_value1(0),AR_value2(0),BR_value1(0),BR_value2(0),AR(0),BR(0);
AR_value1 = summation(high - open , n);
AR_value2 = summation(open - low , n);
BR_value1 = summation(high - close[1] , n);
BR_value2 = summation(close[1] - low , n);
AR = AR_value1 / AR_value2;
BR = BR_value1 / BR_value2;
if AR > up_AR and BR > up_BR then
sell next bar at market;
if AR < down_AR and BR < down_BR then
exitshort next bar at market;
if AR > up_AR and BR > up_BR then
exitlong next bar at market;
//www.tumamayizhan.com
if AR < down_AR and BR < down_BR then
buy next bar at market;