Description
Code desined to help Trader easy to treder with EMA - STO - RSI - DMI index in 1 code.
Red Point for STO Index,
Yellow Point for EMA Index,
Purple Point for RSI Index,
DMI Point for DMI Index.
Include Open Week Price line and Open Month Price Line.
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 WeeklyTradingSignal : Indicator { //EMASignal [Parameter("LongEMA", DefaultValue = 100)] public int LongEMA { get; set; } [Parameter("ShortEMA", DefaultValue = 5)] public int ShortEMA { get; set; } //ADXSignal [Parameter("ADXPeriod", DefaultValue = 10)] public int ADXPeriod { get; set; } //RSISignal [Parameter("RSIPeriod", DefaultValue = 14)] public int RSIPeriod { get; set; } //STOSignal [Parameter("STOKValue", DefaultValue = 9)] public int STOKValue { get; set; } [Parameter("STODValue", DefaultValue = 3)] public int STODValue { get; set; } [Parameter("STOSlow", DefaultValue = 2)] public int STOSlow { get; set; } [Output("ADX Point", Color = Colors.White, PlotType = PlotType.Points, Thickness = 5)] public IndicatorDataSeries ADXPoint { get; set; } [Output("EMA point", Color = Colors.Yellow, PlotType = PlotType.Points, Thickness = 5)] public IndicatorDataSeries EMAPoint { get; set; } [Output("RSI Down Point", Color = Colors.Purple, PlotType = PlotType.Points, Thickness = 5)] public IndicatorDataSeries RSIPoint { get; set; } [Output("STO Point", Color = Colors.Red, PlotType = PlotType.Points, Thickness = 5)] public IndicatorDataSeries STOPoint { get; set; } private ExponentialMovingAverage EMAs, EMAl; private RelativeStrengthIndex rsi; private MarketSeries DailySource, WeeklySource, MonthlySource; private DirectionalMovementSystem ADX; private ExponentialMovingAverage ema10; private ExponentialMovingAverage ema20; private ExponentialMovingAverage ema50; private ExponentialMovingAverage ema200; private StochasticOscillator STO; protected override void Initialize() { DailySource = MarketData.GetSeries(TimeFrame.Daily); WeeklySource = MarketData.GetSeries(TimeFrame.Weekly); MonthlySource = MarketData.GetSeries(TimeFrame.Monthly); ADX = Indicators.DirectionalMovementSystem(ADXPeriod); rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, RSIPeriod); EMAs = Indicators.ExponentialMovingAverage(MarketSeries.Close, ShortEMA); EMAl = Indicators.ExponentialMovingAverage(MarketSeries.Close, LongEMA); ema10 = Indicators.ExponentialMovingAverage(DailySource.Close, 10); ema20 = Indicators.ExponentialMovingAverage(DailySource.Close, 20); ema50 = Indicators.ExponentialMovingAverage(DailySource.Close, 50); ema200 = Indicators.ExponentialMovingAverage(DailySource.Close, 200); STO = Indicators.StochasticOscillator(STOKValue, STOSlow, STODValue, MovingAverageType.Exponential); } public int CandleTick() { int results = -1; double OpenClose = MarketSeries.Close.Last(0) - MarketSeries.Open.Last(0); double HighLow = MarketSeries.High.Last(0) - MarketSeries.High.Last(0); double Open = MarketSeries.Open.Last(0); double Close = MarketSeries.Close.Last(0); double Median = MarketSeries.Median.Last(0); if ((OpenClose < HighLow / 3 && Open > Median && Close > Median) || (OpenClose > 0.7 * HighLow)) results = 0; else if ((OpenClose < HighLow / 3 && Open < Median && Close < Median) || (OpenClose > 0.7 * HighLow)) results = 1; return results; } public override void Calculate(int index) { //LongTrendSignal var StaticLongPos = StaticPosition.BottomLeft; string name = "Xu hướng dài hạn"; string LongResults; string DayOfWeek = DailySource.OpenTime.Last(0).DayOfWeek.ToString(); if (ema10.Result.Last(1) > ema20.Result.Last(1) && ema20.Result.Last(1) > ema50.Result.Last(1) && ema50.Result.Last(1) > ema200.Result.Last(1)) LongResults = "Long: Up"; else if (ema10.Result.Last(1) < ema20.Result.Last(1) && ema20.Result.Last(1) < ema50.Result.Last(1) && ema50.Result.Last(1) < ema200.Result.Last(1)) LongResults = "Long: Down"; else LongResults = "Long: Unknow"; //if (LongResults == "Long: Up" && ema10.Result.IsRising() && ema10.Result.Last(0) < MarketSeries.Low.Last(0)) //LongPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 25); //else if (LongResults == "Long: Down" && ema10.Result.IsFalling() && ema10.Result.Last(0) > MarketSeries.High.Last(0)) //LongPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 25); //End //EMASignal string TF = TimeFrame.ToString(); int CandleSignal = CandleTick(); double EMA0 = EMAs.Result.Last(0) - EMAl.Result.Last(0); double EMA1 = EMAs.Result.Last(1) - EMAl.Result.Last(1); double EMA2 = EMAs.Result.Last(2) - EMAl.Result.Last(2); double EMA3 = EMAs.Result.Last(3) - EMAl.Result.Last(3); double EMA4 = EMAs.Result.Last(4) - EMAl.Result.Last(4); double EMA5 = EMAs.Result.Last(5) - EMAl.Result.Last(5); double EMA6 = EMAs.Result.Last(6) - EMAl.Result.Last(6); double EMA7 = EMAs.Result.Last(7) - EMAl.Result.Last(7); double AvgEMA0 = (EMA0 + EMA1 + EMA2) / 3; double AvgEMA1 = (EMA1 + EMA2 + EMA3) / 3; double AvgEMA2 = (EMA2 + EMA3 + EMA4) / 3; double AvgEMA3 = (EMA5 + EMA3 + EMA4) / 3; double DelEMA0 = EMA0 - AvgEMA0; double DelEMA1 = EMA1 - AvgEMA1; double DelEMA2 = EMA2 - AvgEMA2; double DelEMA3 = EMA3 - AvgEMA3; double EmaMin5 = EMAs.Result.Minimum(10); double EmaMax5 = EMAs.Result.Maximum(10); //Trường hợp cắt trên và dưới //if (EMA0 > AvgEMA0 && EMA1 < AvgEMA1 && EMA2 < AvgEMA2) //EMAPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 10); //else if (EMA0 < AvgEMA0 && EMA1 > AvgEMA1 && EMA2 > AvgEMA2) //EMAPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 10); // Trường hợp tạo đỉnh và đáy if (EMA0 > AvgEMA0 && EMA1 < AvgEMA1 && EMA0 > EMA1 && EMA1 <= EMA2 && EMA2 <= EMA3) //&& EMA3 <= EMA4) // && CandleSignal == 0) EMAPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 10); else if (EMA0 < AvgEMA0 && EMA1 > AvgEMA1 && EMA0 < EMA1 && EMA1 >= EMA2 && EMA2 >= EMA3) // && EMA3 >= EMA4) //&& CandleSignal == 1) EMAPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 10); //End //RSISignal double RSIvalue0 = rsi.Result.Last(0); double RSIvalue1 = rsi.Result.Last(1); double RSIvalue2 = rsi.Result.Last(2); double RSIvalue3 = rsi.Result.Last(3); double RSIMin120 = rsi.Result.Minimum(120); double RSIMax120 = rsi.Result.Maximum(120); string RsiResults; if ((rsi.Result.HasCrossedAbove(30, 0) && RSIvalue1 < 30 && RSIvalue2 < 30 && RSIvalue3 < 30)) //(RSIMin120 >= RSIvalue1 && RSIvalue0 >= RSIvalue1 && RSIvalue1 < RSIvalue2 && RSIvalue2 < RSIvalue3) || RSIPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 20); else if ((rsi.Result.HasCrossedBelow(70, 0) && RSIvalue1 > 70 && RSIvalue2 > 70 && RSIvalue3 > 70)) //(RSIMax120 <= RSIvalue1 && RSIvalue0 <= RSIvalue1 && RSIvalue1 > RSIvalue2 && RSIvalue2 > RSIvalue3) || RSIPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 20); if (29 <= rsi.Result.Last(0) && rsi.Result.Last(0) < 30 && RSIvalue1 < 30 && RSIvalue2 < 30 && RSIvalue3 < 30) RsiResults = "RSI: Sell Signal Nearly Appear"; else if (70 < rsi.Result.Last(0) && rsi.Result.Last(0) <= 71 && RSIvalue1 > 70 && RSIvalue2 > 70 && RSIvalue3 > 70) RsiResults = "RSI: Buy Signal Nearly Appear"; else RsiResults = ""; //End //ADXSignal double DIMinus1 = ADX.DIMinus.Last(1); double DIMinus2 = ADX.DIMinus.Last(2); double DIMinus3 = ADX.DIMinus.Last(3); double DIPlus1 = ADX.DIPlus.Last(1); double DIPlus2 = ADX.DIPlus.Last(2); double DIPlus3 = ADX.DIPlus.Last(3); string AdxResults; if (ADX.DIPlus.HasCrossedAbove(ADX.DIMinus, 0) && DIPlus1 < DIMinus1 && DIPlus2 < DIMinus2 && DIPlus3 < DIMinus3) ADXPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 30); else if (ADX.DIPlus.HasCrossedBelow(ADX.DIMinus, 0) && DIPlus1 > DIMinus1 && DIPlus2 > DIMinus2 && DIPlus3 > DIMinus3) ADXPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 30); if (Math.Abs(ADX.DIPlus.Last(0) - ADX.DIMinus.Last(0)) <= 1 && ADX.DIPlus.Last(0) > ADX.DIMinus.Last(0) && DIPlus1 < DIMinus1 && DIPlus2 < DIMinus2 && DIPlus3 < DIMinus3) AdxResults = "ADX: Sell Signal Nearly Appear"; else if (Math.Abs(ADX.DIPlus.Last(0) - ADX.DIMinus.Last(0)) <= 1 && ADX.DIPlus.Last(0) < ADX.DIMinus.Last(0) && DIPlus1 > DIMinus1 && DIPlus2 > DIMinus2 && DIPlus3 > DIMinus3) AdxResults = "ADX: Buy Signal Nearly Appear"; else AdxResults = ""; //End //StoSignal double KValue0 = STO.PercentK.Last(0); double KValue1 = STO.PercentK.Last(1); double KValue2 = STO.PercentK.Last(2); double KValue3 = STO.PercentK.Last(3); double KValue4 = STO.PercentK.Last(4); double KValue5 = STO.PercentK.Last(5); double KValue6 = STO.PercentK.Last(6); double DValue0 = STO.PercentD.Last(0); double DValue1 = STO.PercentD.Last(1); double DValue2 = STO.PercentD.Last(2); double DValue3 = STO.PercentD.Last(3); //Trường hợp giao nhau //if (STO.PercentK.HasCrossedAbove(STO.PercentD, 0) && KValue1 < DValue1 && KValue2 < DValue2 && KValue3 < DValue3) //STOPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 40); //else if (STO.PercentK.HasCrossedBelow(STO.PercentD, 0) && KValue1 > DValue1 && KValue2 > DValue2 && KValue3 > DValue3) //STOPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 40); //Trường hợp đỉnh đáy if (KValue0 > DValue0 && KValue0 > KValue1 && KValue1 < KValue2 && KValue2 < KValue3 && KValue3 < KValue4) //&& KValue4 < KValue5 && KValue5 < KValue6) STOPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 40); else if (KValue0 < DValue0 && KValue0 < KValue1 && KValue1 > KValue2 && KValue2 > KValue3 && KValue3 > KValue4) //&& KValue4 > KValue5 && KValue5 > KValue6) STOPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 40); //End //OpenWeek for (int i = 0; i < 120; i++) { DateTime startOfMonth = MonthlySource.OpenTime.Last(i).Date.AddDays(0); DateTime endOfMonth = startOfMonth.AddMonths(1); DateTime StartOfWeek = WeeklySource.OpenTime.Last(i).Date.AddDays(0); DateTime endOfWeek = StartOfWeek.AddDays(7); DateTime StartOfDay = DailySource.OpenTime.Last(i).Date.AddDays(0); DateTime endOfDay = StartOfDay.AddHours(24); var MonthlyOpen = MonthlySource.Open.Last(i); var WeeklyOpen = WeeklySource.Open.Last(i); var DailyOpen = DailySource.Open.Last(i); ChartObjects.DrawLine("OpenWeek" + i, StartOfWeek, WeeklyOpen, endOfWeek, WeeklyOpen, Colors.Aqua, 1); ChartObjects.DrawLine("OpenMonth" + i, startOfMonth, MonthlyOpen, endOfMonth, MonthlyOpen, Colors.SlateGray, 2); } //End ChartObjects.DrawText(name, LongResults + "\n" + RsiResults + "\n" + AdxResults, StaticLongPos, Colors.Red); } } }
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 WeeklyTradingSignal : Indicator
{
//EMASignal
[Parameter("LongEMA", DefaultValue = 100)]
public int LongEMA { get; set; }
[Parameter("ShortEMA", DefaultValue = 5)]
public int ShortEMA { get; set; }
//ADXSignal
[Parameter("ADXPeriod", DefaultValue = 10)]
public int ADXPeriod { get; set; }
//RSISignal
[Parameter("RSIPeriod", DefaultValue = 14)]
public int RSIPeriod { get; set; }
//STOSignal
[Parameter("STOKValue", DefaultValue = 9)]
public int STOKValue { get; set; }
[Parameter("STODValue", DefaultValue = 3)]
public int STODValue { get; set; }
[Parameter("STOSlow", DefaultValue = 2)]
public int STOSlow { get; set; }
[Output("ADX Point", Color = Colors.White, PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries ADXPoint { get; set; }
[Output("EMA point", Color = Colors.Yellow, PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries EMAPoint { get; set; }
[Output("RSI Down Point", Color = Colors.Purple, PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries RSIPoint { get; set; }
[Output("STO Point", Color = Colors.Red, PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries STOPoint { get; set; }
private ExponentialMovingAverage EMAs, EMAl;
private RelativeStrengthIndex rsi;
private MarketSeries DailySource, WeeklySource, MonthlySource;
private DirectionalMovementSystem ADX;
private ExponentialMovingAverage ema10;
private ExponentialMovingAverage ema20;
private ExponentialMovingAverage ema50;
private ExponentialMovingAverage ema200;
private StochasticOscillator STO;
protected override void Initialize()
{
DailySource = MarketData.GetSeries(TimeFrame.Daily);
WeeklySource = MarketData.GetSeries(TimeFrame.Weekly);
MonthlySource = MarketData.GetSeries(TimeFrame.Monthly);
ADX = Indicators.DirectionalMovementSystem(ADXPeriod);
rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, RSIPeriod);
EMAs = Indicators.ExponentialMovingAverage(MarketSeries.Close, ShortEMA);
EMAl = Indicators.ExponentialMovingAverage(MarketSeries.Close, LongEMA);
ema10 = Indicators.ExponentialMovingAverage(DailySource.Close, 10);
ema20 = Indicators.ExponentialMovingAverage(DailySource.Close, 20);
ema50 = Indicators.ExponentialMovingAverage(DailySource.Close, 50);
ema200 = Indicators.ExponentialMovingAverage(DailySource.Close, 200);
STO = Indicators.StochasticOscillator(STOKValue, STOSlow, STODValue, MovingAverageType.Exponential);
}
public int CandleTick()
{
int results = -1;
double OpenClose = MarketSeries.Close.Last(0) - MarketSeries.Open.Last(0);
double HighLow = MarketSeries.High.Last(0) - MarketSeries.High.Last(0);
double Open = MarketSeries.Open.Last(0);
double Close = MarketSeries.Close.Last(0);
double Median = MarketSeries.Median.Last(0);
if ((OpenClose < HighLow / 3 && Open > Median && Close > Median) || (OpenClose > 0.7 * HighLow))
results = 0;
else if ((OpenClose < HighLow / 3 && Open < Median && Close < Median) || (OpenClose > 0.7 * HighLow))
results = 1;
return results;
}
public override void Calculate(int index)
{
//LongTrendSignal
var StaticLongPos = StaticPosition.BottomLeft;
string name = "Xu hướng dài hạn";
string LongResults;
string DayOfWeek = DailySource.OpenTime.Last(0).DayOfWeek.ToString();
if (ema10.Result.Last(1) > ema20.Result.Last(1) && ema20.Result.Last(1) > ema50.Result.Last(1) && ema50.Result.Last(1) > ema200.Result.Last(1))
LongResults = "Long: Up";
else if (ema10.Result.Last(1) < ema20.Result.Last(1) && ema20.Result.Last(1) < ema50.Result.Last(1) && ema50.Result.Last(1) < ema200.Result.Last(1))
LongResults = "Long: Down";
else
LongResults = "Long: Unknow";
//if (LongResults == "Long: Up" && ema10.Result.IsRising() && ema10.Result.Last(0) < MarketSeries.Low.Last(0))
//LongPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 25);
//else if (LongResults == "Long: Down" && ema10.Result.IsFalling() && ema10.Result.Last(0) > MarketSeries.High.Last(0))
//LongPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 25);
//End
//EMASignal
string TF = TimeFrame.ToString();
int CandleSignal = CandleTick();
double EMA0 = EMAs.Result.Last(0) - EMAl.Result.Last(0);
double EMA1 = EMAs.Result.Last(1) - EMAl.Result.Last(1);
double EMA2 = EMAs.Result.Last(2) - EMAl.Result.Last(2);
double EMA3 = EMAs.Result.Last(3) - EMAl.Result.Last(3);
double EMA4 = EMAs.Result.Last(4) - EMAl.Result.Last(4);
double EMA5 = EMAs.Result.Last(5) - EMAl.Result.Last(5);
double EMA6 = EMAs.Result.Last(6) - EMAl.Result.Last(6);
double EMA7 = EMAs.Result.Last(7) - EMAl.Result.Last(7);
double AvgEMA0 = (EMA0 + EMA1 + EMA2) / 3;
double AvgEMA1 = (EMA1 + EMA2 + EMA3) / 3;
double AvgEMA2 = (EMA2 + EMA3 + EMA4) / 3;
double AvgEMA3 = (EMA5 + EMA3 + EMA4) / 3;
double DelEMA0 = EMA0 - AvgEMA0;
double DelEMA1 = EMA1 - AvgEMA1;
double DelEMA2 = EMA2 - AvgEMA2;
double DelEMA3 = EMA3 - AvgEMA3;
double EmaMin5 = EMAs.Result.Minimum(10);
double EmaMax5 = EMAs.Result.Maximum(10);
//Trường hợp cắt trên và dưới
//if (EMA0 > AvgEMA0 && EMA1 < AvgEMA1 && EMA2 < AvgEMA2)
//EMAPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 10);
//else if (EMA0 < AvgEMA0 && EMA1 > AvgEMA1 && EMA2 > AvgEMA2)
//EMAPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 10);
// Trường hợp tạo đỉnh và đáy
if (EMA0 > AvgEMA0 && EMA1 < AvgEMA1 && EMA0 > EMA1 && EMA1 <= EMA2 && EMA2 <= EMA3)
//&& EMA3 <= EMA4)
// && CandleSignal == 0)
EMAPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 10);
else if (EMA0 < AvgEMA0 && EMA1 > AvgEMA1 && EMA0 < EMA1 && EMA1 >= EMA2 && EMA2 >= EMA3)
// && EMA3 >= EMA4)
//&& CandleSignal == 1)
EMAPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 10);
//End
//RSISignal
double RSIvalue0 = rsi.Result.Last(0);
double RSIvalue1 = rsi.Result.Last(1);
double RSIvalue2 = rsi.Result.Last(2);
double RSIvalue3 = rsi.Result.Last(3);
double RSIMin120 = rsi.Result.Minimum(120);
double RSIMax120 = rsi.Result.Maximum(120);
string RsiResults;
if ((rsi.Result.HasCrossedAbove(30, 0) && RSIvalue1 < 30 && RSIvalue2 < 30 && RSIvalue3 < 30))
//(RSIMin120 >= RSIvalue1 && RSIvalue0 >= RSIvalue1 && RSIvalue1 < RSIvalue2 && RSIvalue2 < RSIvalue3) ||
RSIPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 20);
else if ((rsi.Result.HasCrossedBelow(70, 0) && RSIvalue1 > 70 && RSIvalue2 > 70 && RSIvalue3 > 70))
//(RSIMax120 <= RSIvalue1 && RSIvalue0 <= RSIvalue1 && RSIvalue1 > RSIvalue2 && RSIvalue2 > RSIvalue3) ||
RSIPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 20);
if (29 <= rsi.Result.Last(0) && rsi.Result.Last(0) < 30 && RSIvalue1 < 30 && RSIvalue2 < 30 && RSIvalue3 < 30)
RsiResults = "RSI: Sell Signal Nearly Appear";
else if (70 < rsi.Result.Last(0) && rsi.Result.Last(0) <= 71 && RSIvalue1 > 70 && RSIvalue2 > 70 && RSIvalue3 > 70)
RsiResults = "RSI: Buy Signal Nearly Appear";
else
RsiResults = "";
//End
//ADXSignal
double DIMinus1 = ADX.DIMinus.Last(1);
double DIMinus2 = ADX.DIMinus.Last(2);
double DIMinus3 = ADX.DIMinus.Last(3);
double DIPlus1 = ADX.DIPlus.Last(1);
double DIPlus2 = ADX.DIPlus.Last(2);
double DIPlus3 = ADX.DIPlus.Last(3);
string AdxResults;
if (ADX.DIPlus.HasCrossedAbove(ADX.DIMinus, 0) && DIPlus1 < DIMinus1 && DIPlus2 < DIMinus2 && DIPlus3 < DIMinus3)
ADXPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 30);
else if (ADX.DIPlus.HasCrossedBelow(ADX.DIMinus, 0) && DIPlus1 > DIMinus1 && DIPlus2 > DIMinus2 && DIPlus3 > DIMinus3)
ADXPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 30);
if (Math.Abs(ADX.DIPlus.Last(0) - ADX.DIMinus.Last(0)) <= 1 && ADX.DIPlus.Last(0) > ADX.DIMinus.Last(0) && DIPlus1 < DIMinus1 && DIPlus2 < DIMinus2 && DIPlus3 < DIMinus3)
AdxResults = "ADX: Sell Signal Nearly Appear";
else if (Math.Abs(ADX.DIPlus.Last(0) - ADX.DIMinus.Last(0)) <= 1 && ADX.DIPlus.Last(0) < ADX.DIMinus.Last(0) && DIPlus1 > DIMinus1 && DIPlus2 > DIMinus2 && DIPlus3 > DIMinus3)
AdxResults = "ADX: Buy Signal Nearly Appear";
else
AdxResults = "";
//End
//StoSignal
double KValue0 = STO.PercentK.Last(0);
double KValue1 = STO.PercentK.Last(1);
double KValue2 = STO.PercentK.Last(2);
double KValue3 = STO.PercentK.Last(3);
double KValue4 = STO.PercentK.Last(4);
double KValue5 = STO.PercentK.Last(5);
double KValue6 = STO.PercentK.Last(6);
double DValue0 = STO.PercentD.Last(0);
double DValue1 = STO.PercentD.Last(1);
double DValue2 = STO.PercentD.Last(2);
double DValue3 = STO.PercentD.Last(3);
//Trường hợp giao nhau
//if (STO.PercentK.HasCrossedAbove(STO.PercentD, 0) && KValue1 < DValue1 && KValue2 < DValue2 && KValue3 < DValue3)
//STOPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 40);
//else if (STO.PercentK.HasCrossedBelow(STO.PercentD, 0) && KValue1 > DValue1 && KValue2 > DValue2 && KValue3 > DValue3)
//STOPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 40);
//Trường hợp đỉnh đáy
if (KValue0 > DValue0 && KValue0 > KValue1 && KValue1 < KValue2 && KValue2 < KValue3 && KValue3 < KValue4)
//&& KValue4 < KValue5 && KValue5 < KValue6)
STOPoint[index] = MarketSeries.Low[index] - (Symbol.PipSize * 40);
else if (KValue0 < DValue0 && KValue0 < KValue1 && KValue1 > KValue2 && KValue2 > KValue3 && KValue3 > KValue4)
//&& KValue4 > KValue5 && KValue5 > KValue6)
STOPoint[index] = MarketSeries.High[index] + (Symbol.PipSize * 40);
//End
//OpenWeek
for (int i = 0; i < 120; i++)
{
DateTime startOfMonth = MonthlySource.OpenTime.Last(i).Date.AddDays(0);
DateTime endOfMonth = startOfMonth.AddMonths(1);
DateTime StartOfWeek = WeeklySource.OpenTime.Last(i).Date.AddDays(0);
DateTime endOfWeek = StartOfWeek.AddDays(7);
DateTime StartOfDay = DailySource.OpenTime.Last(i).Date.AddDays(0);
DateTime endOfDay = StartOfDay.AddHours(24);
var MonthlyOpen = MonthlySource.Open.Last(i);
var WeeklyOpen = WeeklySource.Open.Last(i);
var DailyOpen = DailySource.Open.Last(i);
ChartObjects.DrawLine("OpenWeek" + i, StartOfWeek, WeeklyOpen, endOfWeek, WeeklyOpen, Colors.Aqua, 1);
ChartObjects.DrawLine("OpenMonth" + i, startOfMonth, MonthlyOpen, endOfMonth, MonthlyOpen, Colors.SlateGray, 2);
}
//End
ChartObjects.DrawText(name, LongResults + "\n" + RsiResults + "\n" + AdxResults, StaticLongPos, Colors.Red);
}
}
}
HA
haitran0207@gmail.com
Joined on 08.10.2015
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: 1. Weekly Trading Signal.algo
- Rating: 5
- Installs: 4357
- Modified: 13/10/2021 09:54
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.