TS Sideways
Trading System "Sideways"
Formula per Tradestation™:
INIZIO FORMULA
Type : Signal, Name : Sideways
inputs:NoDay(3), MULT11(2), MULT22(2), AVE(4);
vars:valuea(0),valueb(0),LINR(0), VAL1(0), VAL2 (0);
valuea=highest(high,NoDay);
valueb=lowest(low,NoDay);
VAL1 = AVERAGE (VALUEA,NODAY);
VAL2 = AVERAGE (VALUEB, NODAY);
LINR = LinearRegValueFC(C,AVE,0);
IF LINR CROSSES ABOVE VAL2 THEN BUY ON CLOSE;
IF LINR CROSSES ABOVE VAL1 THEN EXITLONG ON CLOSE;
IF LINR CROSSES BELOW VAL1 THEN SELL ON CLOSE;
IF LINR CROSSES BELOW VAL2 THEN EXITSHORT ON CLOSE;
VALUE1 = ((HIGHEST (HIGH, NODAY)) - ((LOWEST (LOW, NODAY))));
VALUE2= VALUE1 * MULT11;
VALUE3= VALUE1 * MULT22;
{VALUE2=TARGET, VALUE3 = STOPLOSS}
IF MARKETPOSITION = 1 THEN BEGIN
EXITLONG TOMORROW AT ENTRYPRICE + VALUE2 LIMIT;
EXITLONG TOMORROW AT ENTRYPRICE - VALUE3 STOP;
END ;
IF MARKETPOSITION = -1 THEN BEGIN
EXITSHORT TOMORROW AT ENTRYPRICE + VALUE3 STOP;
EXITSHORT TOMORROW AT ENTRYPRICE - VALUE2 LIMIT;
END ;
FINE FORMULA