Color BarsThe lessons laid the foundation for a program's structure, variables, operators, expressions, procedures, and functions. Now let's turn our efforts to creating useful scripts.Cut the following script from this page and paste it in the ESPL Script Editor. Click on the RUN button to compile and run the script. Hopefully, nothing happens. That means the script did not contain a compile error. Now display any chart and click on the ESPL RUN button on the Chart Controls toolbar. The following ESPL panel shows. Click button 42 in the Color Bars column. This will execute the script with the ESPL variable set to a value of 42. The bars on the chart will be painted shades of red and green.
What does this script do? It performs seven tests that indicate upward or downward strength by comparing a bar with its neighbor on the left. This strength is then converted into a shade of red or green with the strongest upward strength being a bright red and the strongest downward strength being a bright green. procedure ColorBar42; if Open(i)>Last(j) then inc(iRed); if
Open(i)<=Last(j) then inc(iGreen); j:=iRed-iGreen; SetBar(eColor,i,c); {----- MAIN PROGRAM -----} |