[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Code question



PureBytes Links

Trading Reference Links

I'm trying to code the following system:

 The market makes a new a 20-day high, then after a pullback of 5 to 8 days a 
new 5 day low is made.  At that point I'd like to buy.  

I have put this together but I know it's not right and I'm kinda stumped:

VAR:  PHI(FALSE);

CONDITION1 = H > HIGHEST(HIGH, 20)[1];

IF CONDITION1 THEN PHI = (TRUE);

CONDITION2 = L < LOWEST(LOW, 5)[1];

IF  PHI  THEN BEGIN

IF CONDITION2 THEN BUY;

EXITLONG AT LOWEST(LOW, 24)[1] STOP;  

END;


The old supercharts code is:

Input: Xdays (14);
If Highest Bar(High,20)[1] < 7 and Low< Lowest
(Low,5)[l]then buy tomorrow on the open:
If BarsSinceEntry - Xdays then exitlong at the close:

I'd like to know how to code this into TS 4.0.  

Thanks in advance for any help.

Vince