Alert Notification Calgo
Alert Notification Calgo
121
122
using System;
using System.IO;
using System.Collections.Generic;
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, AutoRescale = false, AccessRights =
AccessRights.FullAccess)]
public class PriceAlarmSound : Indicator
{
const Colors AskColor = Colors.DeepSkyBlue;
const Colors BidColor = Colors.Red;
[Parameter()]
public double Price { get; set; }
bool spotPriceWasAbove;
int tickCount;
bool triggered;
if (BidOrAsk == 1)
spotPriceWasAbove = Symbol.Bid > Price;
else
spotPriceWasAbove = Symbol.Ask > Price;
if (NotificationWasPlayed())
{
triggered = true;
}
}
if (BidOrAsk == 1)
BidTarget[index] = Price;
else
AskTarget[index] = Price;
if (IsRealTime)
{
var color = BidOrAsk == 1 ? BidColor : AskColor;
var spotPrice = BidOrAsk == 1 ? Symbol.Bid : Symbol.Ask;
var distance = Math.Round(Math.Abs(Price - spotPrice) /
Symbol.PipSize, 1);
struct Notification
{
public string Symbol;
public double Price;
public bool BidIsSpotPrice;
}
}