spread indicator

Created at 07 Feb 2013, 10:13
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
MaXeY's avatar

MaXeY

Joined 06.02.2013

spread indicator
07 Feb 2013, 10:13


Hello

anyone have spread indicator for Ctrader ?


@MaXeY
Replies

Scott
07 Feb 2013, 20:20

RE: spread indicator
MaXeY said:

Hello

anyone have spread indicator for Ctrader ?

I use this one at the momment it almost in sink with the actual spread Tick Chart /algos/show/207 

or you could use Lables for Charts /algos/show/195  just remove the infomation you dont want and set the indicator to false so that its not on your chart and in your way, I triying to work out how to calculate the pip differance between moving averages that will be printed using Lables.  But I can think of a few good thing that could also be added such as RSI.

 


@Scott

rkokerti
08 Feb 2013, 12:09

RE: RE: spread indicator
Scott said:
MaXeY said:

Hello

anyone have spread indicator for Ctrader ?

I use this one at the momment it almost in sink with the actual spread Tick Chart /algos/show/207 

or you could use Lables for Charts /algos/show/195  just remove the infomation you dont want and set the indicator to false so that its not on your chart and in your way, I triying to work out how to calculate the pip differance between moving averages that will be printed using Lables.  But I can think of a few good thing that could also be added such as RSI.

 

Hi Scott, 

Try this...

 

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

namespace cAlgo.Indicators
{
        [Indicator(IsOverlay = true)]
        public class _RI_WriteToChart_v2 : Indicator
        {
//-----------------------------------------------------------------
    [Parameter]
      public DataSeries Source { get; set; }

    [Parameter(DefaultValue = 14)]
      public int PeriodMA1 { get; set; }
      
    [Parameter(DefaultValue = 7)]
      public int PeriodMA2 { get; set; }      
//-----------------------------------------------------------------        
        private Position position;
    private SimpleMovingAverage sma1;
    private SimpleMovingAverage sma2;
    private double Dist;    
//-----------------------------------------------------------------
        protected override void Initialize()
        {
        sma1 = Indicators.SimpleMovingAverage(Source,PeriodMA1);
        sma2 = Indicators.SimpleMovingAverage(Source,PeriodMA2);        
        }
//-----------------------------------------------------------------     
    
        public override void Calculate(int index)
        {

    string Dist = "    " + Math.Round((sma1.Result[index] - sma2.Result[index]) / Symbol.PipSize,0);
    
    ChartObjects.DrawText("Labels", 
    "Dist:" + "\n"
    , StaticPosition.TopLeft, Colors.Yellow);

    ChartObjects.DrawText("Dist", Dist, StaticPosition.TopLeft, Colors.LightBlue);
    }
   } 
}


@rkokerti

Scott
08 Feb 2013, 23:40 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE: RE: spread indicator

Thanks rkokerti

That exactly what I was after, there's one little problem the value is printing on top off the word Dist:

Thank again 


@Scott

rkokerti
09 Feb 2013, 13:28

Hi,

You need to press space button several times between "    ", or press tab button once in this row : string Dist = "    " + Math.Round((sma1.Result[index] - sma2.Result[index]) / Symbol.PipSize,0); 

I hope it helps.


@rkokerti

Scott
10 Feb 2013, 21:23

RE:
rkokerti said:

Hi,

You need to press space button several times between "    ", or press tab button once in this row : string Dist = "    " + Math.Round((sma1.Result[index] - sma2.Result[index]) / Symbol.PipSize,0); 

I hope it helps.

Thanks rkokerti, got it working now, I put in 10 spaces in string Dist = "    " , the tab would move the pipsize to far away.


@Scott