MA
Topics
08 Jul 2020, 13:26
1133
2
17 Oct 2019, 17:16
1169
3
Replies
MarkDawson
23 Oct 2019, 20:49
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class RSI_Sound : Indicator
{
private RelativeStrengthIndex rsi;
[Parameter("Sound ON", DefaultValue = 0, MaxValue = 1, MinValue = 0)]
public bool PlaySound { get; set; }
[Parameter("Media File", DefaultValue = "C:\\alarm.mp3")]
public string MediaFile { get; set; }
[Parameter("Source", Group = "RSI")]
public DataSeries Source { get; set; }
protected override void Initialize()
{
rsi = Indicators.RelativeStrengthIndex(Source, 14);
}
public override void Calculate(int index)
{
{
if (rsi.Result.hasCrossedAbove(30);
Notifications.PlaySound(MediaFile);
else if (rsi.Result.hasCrossedAbove(50)
Notifications.PlaySound(MediaFile);
else if (rsi.Result.hasCrossedBelow(50)
Notifications.PlaySound(MediaFile);
else if (rsi.Result.hasCrossedBelow(70)
Notifications.PlaySound(MediaFile);
}
}
}
}
I'm looking for an RSI alert as well, but can't find one. I resorted to try and code myself but my lack of experience is showing here.
I don't think I'm using the hasCrossed function correctly. I just want an alert to beep whenever the rsi crossed the 30, 50, 70 mark.
@MarkDawson
MarkDawson
17 Oct 2019, 17:39
Hmm, after a while, I was able to enter again without doing anything special.
@MarkDawson
MarkDawson
24 Oct 2019, 09:03
Thanks Paul, but not exactly what I had in mind. Just looking for a simple one that will beep when rsi crossed/touch the 30,50,70 line
@MarkDawson