//---------------------------------------//
//PRC_ICT Swing High/Low Detector
//version = 0
//20.09.2024
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//---------------------------------------//
//----Function to detect swing low-------//
//---------------------------------------//
isSwingLow = low[2]<low[3] and low[1]>low[2]
//---------------------------------------//
//----Function to detect swing High------//
//---------------------------------------//
isSwingHigh = high[2]>high[3] and high[1]<high[2]
//---------------------------------------//
//--------Detect swing points------------//
//---------------------------------------//
swingLowDetected=isSwingLow and high>high[1]
swingHighDetected=isSwingHigh and low<low[1]
//---------------------------------------//
//--------Plot swing points--------------//
//---------------------------------------//
if swingLowDetected then
drawtext("▲",barindex,low) coloured("green")
drawtext("SL",barindex[2],low[2]) coloured("green")
elsif swingHighDetected then
drawtext("▼",barindex,high) coloured("red")
drawtext("SH",barindex[2],high[2]) coloured("red")
endif
//---------------------------------------//
return