I need Help translating code to TOS

U

Utajiri

New member
Hi, can anyone help with these scripts? I currently use this on a different platform (TC2000), but I am trying to translate this to TOS...

Swing High –

IIF(H4 >= GREATEST(MAXH4, MAXH13.5) AND H4 > GREATEST(MINH4, MINH13.5), H4, 0)

The swing high formula checks for the high of 4 bars ago to be at or above both the highest highs of the previous 13 bars and following 4 bars and above both the lowest highs of the previous 13 bars and the following 4 bars. It returns the high of 4 bars ago if this 18 bar pattern ends on the current bar and returns zero if it doesn't. It doesn't check for any previous bars.


Swing Low–

IIF(H4 <= LEAST(MINH4, MINH13.5) AND H4 < LEAST(MAXH4, MAXH13.5), L4, 0)

The swing low formula checks for the low of 4 bars ago to be at or below both the lowest lows of the previous 13 bars and following 4 bars and below both the highest lows of the previous 13 bars and the following 4 bars. It returns the low of 4 bars ago if this 18 bar pattern ends on the current bar and returns zero if it doesn't. It doesn't check for any previous bars.

This is just a swing high and swing low formulas which allows for ties in the pattern as long as the central high is higher than at least some of the highs on both sides or the central low is below at least some of the lows on both sides.

I also want this to have a multi-time frame feature we can overlay on different (smaller) time frames. I would like a dot marked on the high of the candle where the event takes place for a swing high and vice versa for a swing low.... I would also like a horizontal line drawn out from the point where the event happened too.

Thanks for your help as always guys!
@Townsend @tomsk
 

Similar threads

Top