Description
Comparaison of Buy/Sell DOM Entry.
Have fun, and for any collaboration, contact me !!!
On telegram : https://t.me/nimi012 (direct messaging)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(AccessRights = AccessRights.None)]
public class xDomentrynumber : Indicator
{
[Output("Ask Entries", LineColor = "Lime", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries AskResult { get; set; }
[Output("Bid Entries", LineColor = "Red", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries BidResult { get; set; }
[Output("Ask >", LineColor = "Lime", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries AskPlus { get; set; }
[Output("Bid >", LineColor = "Red", PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries BidPlus { get; set; }
private MarketDepth _marketDepth;
private int askNumberCount = 0;
private int bidNumberCount = 0;
public override void Calculate(int index)
{
}
protected override void Initialize()
{
// Get Market Depth
_marketDepth = MarketData.GetMarketDepth(SymbolName);
// subscribe to event Updated
_marketDepth.Updated += MarketDepthUpdated;
Bars.BarOpened += Bars_BarOpened;
}
private void Bars_BarOpened(BarOpenedEventArgs obj)
{
askNumberCount = 0;
bidNumberCount = 0;
}
void MarketDepthUpdated()
{
if (Chart.FindAllObjects(ChartObjectType.HorizontalLine) != null)
Chart.RemoveAllObjects();
var index = Bars.ClosePrices.Count - 1;
var askNumber = 0;
var bidNumber = 0;
foreach (var entry in _marketDepth.AskEntries)
{
double dVolume = Math.Round(entry.VolumeInUnits / 1000000.0, 2);
double entryPrice = entry.Price;
Chart.DrawTrendLine("Bid" + entryPrice, Bars.OpenTimes.Last(0) + (Bars.OpenTimes.Last(0) - Bars.OpenTimes.Last(((int)dVolume < 1 ? 1 : (int)dVolume) + 1)), entryPrice, Bars.OpenTimes.Last(0) + (Bars.OpenTimes.Last(0) - Bars.OpenTimes.Last(1)), entryPrice, Color.Lime, 5);
askNumber++;
}
foreach (var entry in _marketDepth.BidEntries)
{
double dVolume = Math.Round(entry.VolumeInUnits / 1000000.0, 2);
double entryPrice = entry.Price;
Chart.DrawTrendLine("Ask" + entryPrice, Bars.OpenTimes.Last(0) + (Bars.OpenTimes.Last(0) - Bars.OpenTimes.Last(((int)dVolume < 1 ? 1 : (int)dVolume) + 1)), entryPrice, Bars.OpenTimes.Last(0) + (Bars.OpenTimes.Last(0) - Bars.OpenTimes.Last(1)), entryPrice, Color.Red, 5);
bidNumber++;
}
askNumberCount += askNumber;
bidNumberCount += bidNumber;
AskResult[index] = askNumberCount;
BidResult[index] = bidNumberCount;
AskPlus[index] = AskResult[index] > BidResult[index] ? -5 : double.NaN;
BidPlus[index] = AskResult[index] < BidResult[index] ? -5 : double.NaN;
}
}
}
YE
YesOrNot
Joined on 10.10.2022 Blocked
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: [x]Dom entry number.algo
- Rating: 0
- Installs: 361
- Modified: 10/12/2023 20:31
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.