Description
Comparaison of Buy/Sell Dom GAP 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 xDomGap : 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 double askVolumeCount = 0;
private double bidVolumeCount = 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)
{
askVolumeCount = 0;
bidVolumeCount = 0;
}
void MarketDepthUpdated()
{
if (Chart.FindAllObjects(ChartObjectType.HorizontalLine) != null)
Chart.RemoveAllObjects();
var index = Bars.ClosePrices.Count - 1;
double askVolumeMax = double.MinValue;
double bidVolumeMax = double.MinValue;
double askVolumeMin = double.MaxValue;
double bidVolumeMin = double.MaxValue;
var askEntryCount = 0;
var bidEntryCount = 0;
foreach (var entry in _marketDepth.AskEntries)
{
double dVolume = Math.Round(entry.VolumeInUnits / 1000000.0, 2);
double entryPrice = entry.Price;
// Chart representation of deep market
Chart.DrawTrendLine("askNumber" + 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);
if (askVolumeMax < entryPrice)
askVolumeMax = entryPrice;
if (askVolumeMin > entryPrice)
askVolumeMin = entryPrice;
askEntryCount++;
}
foreach (var entry in _marketDepth.BidEntries)
{
double dVolume = Math.Round(entry.VolumeInUnits / 1000000.0, 2);
double entryPrice = entry.Price;
// Chart representation of deep market
Chart.DrawTrendLine("bidNumber" + 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);
// maxbid
if (bidVolumeMax < entryPrice)
bidVolumeMax = entryPrice;
if (bidVolumeMin > entryPrice)
bidVolumeMin = entryPrice;
bidEntryCount++;
}
//cumulate
askVolumeCount += ((askVolumeMax - askVolumeMin) / Symbol.PipSize * 10) + 1 - askEntryCount;
bidVolumeCount += ((bidVolumeMax - bidVolumeMin) / Symbol.PipSize * 10) + 1 - bidEntryCount;
//result
AskResult[index] = askVolumeCount;
BidResult[index] = bidVolumeCount;
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 Gap.algo
- Rating: 0
- Installs: 313
- Modified: 10/12/2023 20:34
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.