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);
}
}
}
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
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!
simple and works :) just what i was looking for. thanks!
Please add color parameter. enable $disable label, position on chart parameter
Very useful indicator, but can u please allow the option to have it displayed at the top centre rather than top left.
Thank you
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,
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.
This is very useful and simplest indicator ever for scalpers.
Nice idea.
ok solved the problem, i change the text.PadLeft(12), in text.PadLeft(19), line 36 editor.
this indicator in my graph not seen spread level.
Hi
the number of spread is inside the word "spread" and i can't read it
please help
Hello.
This indicator is possible for Mac iOS.
Thank you!