Category Trend  Published on 04/01/2023

Show Spread on the chart

Description

This code simply displays the current spread on the chart.

You can change its position or color.

My current unit is Points (0.1 pips).

- Visit https://ctrader.com/users/profile/55833 to see my other robots.

- Visit http://fx4u.net/robot/ to download my other robots file.

 


using System;
using cAlgo.API;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Spread : Indicator
    {   
        public override void Calculate(int index)
        {
            Chart.DrawStaticText(" ", Math.Round(Symbol.Spread/Symbol.TickSize).ToString(), VerticalAlignment.Bottom, HorizontalAlignment.Right, Color.DarkBlue);
        }
    }
}


FX
Fx4U.net

Joined on 30.10.2021

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Spread.algo
  • Rating: 5
  • Installs: 1946
  • Modified: 04/01/2023 16:35
Comments
Log in to add a comment.
JS
JS15 · 2 months ago

Hi I love this version of the spread. I'm so terrible with code. How would I change this code to show a decimal. Thanks

BY
bylgan · 11 months ago

Dzień dobry. 
Możesz mi napisać jak zmienić kolor i położenie? 
Pozdrawiam.