Category Other  Published on 09/05/2016

Custom Bid and Ask Lines

Description

DonateCustom Bid and Ask lines.

  • can be set to plot from current bar with displacement or to infinite (as default)
  • custom line style
  • custom thickness
  • custom color

 

Make a Donation

  • If you like my work and effort then please consider to make a kind donation thru PayPal or any Credit Card at the top right corner.

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BidAsk : Indicator
    {
        [Parameter("To Infinite", DefaultValue = true)]
        public bool ToInfinite { get; set; }

        [Parameter(DefaultValue = 0)]
        public int Displacement { get; set; }

        [Output("Ask", Color = Colors.DodgerBlue, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Ask { get; set; }

        [Output("Bid", Color = Colors.Red, PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries Bid { get; set; }

        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            if (!IsLastBar)
                return;

            Bid[index + Displacement - 1] = double.NaN;
            Ask[index + Displacement - 1] = double.NaN;

            for (int i = ToInfinite ? -MarketSeries.Close.Count : Displacement; i < 200; i++)
            {
                Ask[index + i] = Symbol.Ask;
                Bid[index + i] = Symbol.Bid;
            }
        }
    }
}


whis.gg's avatar
whis.gg

Joined on 31.08.2015

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: BidAsk.algo
  • Rating: 4
  • Installs: 2570
  • Modified: 13/10/2021 09:55
Comments
Log in to add a comment.
matt92's avatar
matt92 · 5 years ago

Is this no longer available? Also I just updated my ctrader and the copy I had of this indicator is no longer working.. Any suggestions?

matt92's avatar
matt92 · 5 years ago

is this no longer available? It wont let me click on the box to download ?? just trying to get my 2nd pc up and running with same goods as on my main pc, my cTrader is equipped with this beautiful tool already, but seems i cant download it on my 2nd pc for some reason... Any idea as to why this might be? Thanks 

IR
ironmine · 8 years ago

Ok, I got it. Very good indicator! It cleans the chart.

Actually, several weeks ago, I requested exactly this feature through the Feedback window in cAlgo. I never understood, why they made the Bid and Ask price lines stretching to infinity...

MaVe's avatar
MaVe · 8 years ago

After installing,

Right click on the chart. Under viewing options: disable the default Bid Price Line & Ask Price Line. Then you can see the custom Bid and Ask Lines...

whis.gg's avatar
whis.gg · 8 years ago

What you mean by nothing happened? Did you put it on your chart as any other custom indicator?

IR
ironmine · 8 years ago

I installed this indicator, but nothing happened.