TS Long Trends

Da traderpedia.
Jump to navigation Jump to search

Trading System "Long Trends"

Formula per Tradestation™:

INIZIO FORMULA

Type : Signal, Name : Long Trends

inputs:NoDays(21), N(22),MULT1(2), MULT2(2);
vars:valuea(0),valueb(0),valuec(0), VAL1(0), VAL2(0);

valuea=highest(high,NoDays);
valueb=lowest(low,NoDays);
VAL1= Average(VALUEA,NODAYS);
VAL2= Average(VALUEB,NODAYS);

IF VALUEA CROSSES ABOVE VAL1 AND VALUEB > VAL2 THEN BUY ON CLOSE;
IF VALUEB CROSSES ABOVE VAL2 AND VALUEA > VAL1 THEN BUY ON CLOSE;
IF VALUEA CROSSES BELOW VAL1 AND VALUEB < VAL2 THEN SELL ON CLOSE;
IF VALUEB CROSSES BELOW VAL2 AND VALUEA < VAL1 THEN SELL ON CLOSE;

VALUE1 = ((HIGHEST (HIGH, N)) - ((LOWEST (LOW, N))));
VALUE2= VALUE1 * MULT1;
VALUE3= VALUE1 * MULT2;
{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

Vedi anche: