This ProBuilder code snippet demonstrates how to visually represent buy and sell zones on a trading chart by filling areas between the closing price and the SAR (Stop and Reverse) indicator using colored triangles. The color fill changes based on whether the closing price is above (buy zone) or below (sell zone) the SAR indicator.
indicator1 = SAR[0.02,0.02,0.2]
achat = close > indicator1
If achat then
drawtriangle(barindex[1], close[1], barindex, indicator1, barindex[0], close[0]) coloured(0,100,0,25) bordercolor(0,100,0,0)
drawtriangle(barindex, indicator1, barindex[1], indicator1[1], barindex[1], close[1]) coloured(0,100,0,25) bordercolor(0,100,0,0)
else
drawtriangle(barindex[1], close[1], barindex, indicator1, barindex[0], close[0]) coloured(100,0,0,25) bordercolor(0,100,0,0)
drawtriangle(barindex, indicator1, barindex[1], indicator1[1], barindex[1], close[1]) coloured(100,0,0,25) bordercolor(0,100,0,0)
Endif
return
Explanation of the Code:
This visual representation helps traders quickly identify potential buy or sell zones based on the position of the closing price relative to the SAR indicator.
Check out this related content for more information:
https://www.prorealcode.com/topic/colorier-une-zone-entre-deux-lignes/#post-172073
Visit Link