Category Other  Published on 12/05/2014

Draw Spread

Description

Spread is the difference between the bid and the ask price of the symbol.

This indicator draws Spread on the chart in pips.


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class DrawSpread : Indicator
    {
        public override void Calculate(int index)
        {
            if (IsLastBar)
                DisplaySpreadOnChart();
        }

        private void DisplaySpreadOnChart()
        {
            var spread = Math.Round(Symbol.Spread / Symbol.PipSize, 2);
            string text = string.Format("{0}", spread);
            ChartObjects.DrawText("Label", "Spread:", StaticPosition.TopLeft, Colors.Yellow);
            ChartObjects.DrawText("spread", "\t" + text, StaticPosition.TopLeft, Colors.White);
        }
    }
}


GO
gorin

Joined on 16.07.2013

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Draw Spread.algo
  • Rating: 5
  • Installs: 18991
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
DE
deividam78 · 5 months ago

Hello.
This indicator is possible for Mac iOS.
Thank you!

FC
fcarabat · 2 years ago

sir, please sir can you tell me what code and where to put the font size? I would like ot make it at least double the current size.  that would be most appreciated!

FC
fcarabat · 2 years ago

simple and works :)  just what i was looking for. thanks!

IR
IRCtrader · 3 years ago

Please add color parameter. enable $disable label, position on chart parameter

WA
WakasKhan · 4 years ago

Very useful indicator, but can u please allow the option to have it displayed at the top centre rather than top left. 

 

Thank you 

SO
socalfxtrader · 8 years ago

Thank you Gorin. Very useful indicator.

Is anyone aware of an indicator that can draw the ATR in pips (in the same way this "draw spread" indicator works)? 

I like to remove as much noise and have the least amount of oscillators / indicators beneath my charts. 

Thanks,

K9
k90211lee · 9 years ago

Simple and very useful indicator. I use it with MT4.  I'm glad I found it here. :)

I use grey back ground chart, like to change the font and spread to red to more visual.  I can't change red it above code.  Thank you in advance!

K. 

TH
ThePhantomRaven · 10 years ago

This is very useful and simplest indicator ever for scalpers.

Nice idea.

aisaac's avatar
aisaac · 10 years ago

ok solved the problem, i change the text.PadLeft(12), in text.PadLeft(19),  line 36 editor.

aisaac's avatar
aisaac · 10 years ago

this indicator in my graph not seen spread level.

http://fxpro.ctrader.com/c/Fmjnn

CM
cmureza · 10 years ago

Hi

the number of spread is inside the word "spread" and i can't read it

please help