Building your own Technical Analysis Charts

This topic contains 0 replies, has 1 voice, and was last updated by Seer Seer 6 years, 5 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #610
    Seer
    Seer
    Keymaster

    The process of building your own technical analysis charts is straightforward, as you simply specify what columns you want plotting and the style you want them plotting in. For example, to plot a candlestick chart with two moving averages you would use:

     

    PlotPrice('Candle');
    PlotColumn(EMA(Close,13),Blue);
    PlotColumn(EMA(Close,50),Cyan);
    PlotTellTale(Close,Red);

    Technical Analsis chart, EURUSD daily plotting two EMA's and Japanese candlesticks

     

    Layered Technical Analysis charts

    You can also produce layered charts, where each layer isn’t related to the previous layer. This is typically used to plot several different unrelated indicators (such as ADX with price) on top of each other on the same chart. Each new layer is defined with the PlotSetScale function, which sets the scaling for all subsequent plots. For example, if you wanted to plot the ADX indicator which ranges from 0 to 100 on a price chart you would use:

     

    PlotPrice('Candle');
    my ($adx,$up,$down)=ADX(14);
    PlotSetScale(0,100);
    PlotColumn($adx,Blue);
    PlotColumn($up,Green);
    PlotColumn($down,Red);

    Technical Analsis chart, EURUSD daily, layered chart with price (Japanese candlesticks) and ADX Technical Indicator

    In the above example, we are plotting the OHLC has a Japanese candlestick chart. If no scaling has been set (which is the case in this example), PlotPrice defaults to using High and Low. We then retrieve the ADX columns in the variables $adx, $up and $down. We now set the scaling to 0,100 – which means that the lowest value for all subsequent plots is 0 while the highest is 100. We then plot the ADX columns as blue, green and red lines.

     

    Interactive charts

    You can also build charts that accept parameters from the GUI. The functions ChartInputSlider and ChartInputCombobox form the base of this functionality. When a chart uses these functions, a default value is returned which is then used in the chart construction. When the user moves the mouse button to the top left of the chart, a window will be displayed allowing the user to change the parameter.

    Consider this simple chart:

     

    PlotColumn(EMA(Close,12),Blue);

    Here we are simply plotting a 12 bar EMA of the close.

     

    PlotColumn(EMA(Close,ChartInputSlider('EMA Bar',12,2,20)),Blue);

    In the above chart we are constructing the same chart – a 12 bar EMA of the close – but this time, we’re using a parameter returned by the function ChartInputSlider. When the chart is first run, ChartInputSlider returns 12 (the default value). If we move the mouse to the top left of the chart, we will be shown a slider that we can interact with. The slider will range from 2 to 20 and every time we move the slider, the chart will be rerun with ChartInputSlider returning a different value.

    Marking a bar on the chart

    Marking a specific bar on a chart is an extremely useful way of visually viewing conditions inside a system. The function Markbar can be called from any event from a running system. For example, to visually see when a moving average crossover occurs on a chart, you would add the following code to the Bar event:

     

    Markbar(Red) if Crossover(EMA(Close,12),EMA(Close,26));

    In price based charts (candle and bar) you’ll see a small circle with a stick in red when there is a moving average crossover. For non price based charts you’ll see a small red circle at the bottom of the chart.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.