Support and Resistance Levels:
Support Level: This is calculated by finding the lowest price (low) over a specified period (supportLength). This represents the level where the price tends to bounce upwards.
Resistance Level: This is calculated by finding the highest price (high) over a specified period (resistanceLength). This represents the level where the price tends to reverse downwards.
Plotting: The support and resistance levels are plotted on the chart with green and red lines, respectively.
Moving Averages (MA):
Short MA: A simple moving average (SMA) calculated over a short period (shortMA_length).
Long MA: A simple moving average (SMA) calculated over a longer period (longMA_length).
Plotting: The short MA is plotted in blue, and the long MA is plotted in orange on the chart.
Buy and Sell Signals (MA Cross):
Buy Signal: A buy signal occurs when the short MA crosses above the long MA (crossover function), and the price closes above the support level.
Sell Signal: A sell signal occurs when the short MA crosses below the long MA (crossunder function), and the price closes below the resistance level.
Plotting: Buy signals are displayed below the bars with the text "BUY" in green, and sell signals are displayed above the bars with the text "SELL" in red.