protected override void CalcBar() { double m_avg = m_AverageFC[0]; double m_shift = NumAtrs * this.AverageTrueRange(Length); m_UpperBand.Value = m_avg + m_shift; //UB if (Bars.CurrentBar > 1 && Price.CrossesOver(m_UpperBand, ExecInfo.MaxBarsBack)) //CROSS(C,HB); { m_bSetupLE.Value = true; m_CrossingHigh.Value = Bars.High[0]; //HH } else { if (m_bSetupLE.Value && (PublicFunctions.DoubleLess(Price[0], m_avg) || //C<MA PublicFunctions.DoubleGreaterEquals(Bars.High[0], m_CrossingHigh.Value + Bars.Point))) { m_bSetupLE.Value = false; } } if (m_bSetupLE.Value) { m_KltChLE.Send(m_CrossingHigh.Value + Bars.Point); } }
protected override void CalcBar() { m_avgexp.Value = m_xaverage1[0]; if (((displace >= 0) || Bars.CurrentBar > Math.Abs(displace))) { Plot1.Set(displace, m_avgexp.Value); if ((displace <= 0)) { if (((PublicFunctions.DoubleGreater(price[0], m_avgexp.Value) && PublicFunctions.DoubleGreater(m_avgexp.Value, m_avgexp[1])) && PublicFunctions.DoubleLessEquals(m_avgexp[1], m_avgexp[2]))) { Alerts.Alert("Indicator turning up"); } else { if (((PublicFunctions.DoubleLess(price[0], m_avgexp.Value) && PublicFunctions.DoubleLess(m_avgexp.Value, m_avgexp[1])) && PublicFunctions.DoubleGreaterEquals(m_avgexp[1], m_avgexp[2]))) { Alerts.Alert("Indicator turning down"); } } } } }
protected override void CalcBar() { if (PublicFunctions.DoubleGreaterEquals( Volume[0], Volume.Average(avglength) * m_brkoutfactor) ) { Plot1.Set(0, Bars.High[0]); Alerts.Alert(); } }
protected override void CalcBar() { double FloorProfit = IsPositionBasis ? FloorAmt : -StrategyInfo.MarketPosition * FloorAmt; double CoverPrice = m_HighestFC[0]; if (StrategyInfo.MarketPosition < 0 && PublicFunctions.DoubleGreaterEquals(this.MaxPositionProfit(), FloorProfit)) { m_ChTrSX.Send(CoverPrice); } }
protected override void CalcBar() { double FloorProfit = IsPositionBasis ? FloorAmt : FloorAmt * StrategyInfo.MarketPosition; double SellPrice = m_LowestFC[0]; if (StrategyInfo.MarketPosition > 0 && PublicFunctions.DoubleGreaterEquals(this.MaxPositionProfit(), FloorProfit)) { m_ChTrLX.Send(SellPrice); } }
protected override void CalcBar() { if (PublicFunctions.DoubleGreaterEquals(Bars.Close.RateOfChange(length), pctup)) { Plot1.Set(0, Bars.High[0]); Plot2.Set(0, Bars.Low[0]); Alerts.Alert(); } else { Plot1.Reset(); } }
protected override void CalcBar() { m_rs_dailydataarray1.Call(); if (Bars.CurrentBar == 1 || Bars.Time[0].Date != Bars.Time[1].Date) { m_rs_extremes1.Call(); var m_startday = (numdays - oldqualdays); m_qualhi.Value = (PublicFunctions.DoubleLessEquals(m_oprevhighestday.Value, m_startday) && PublicFunctions.DoubleGreater(m_oprevhighestday.Value, newqualdays)); m_quallo.Value = (PublicFunctions.DoubleLessEquals(m_oprevlowestday.Value, m_startday) && PublicFunctions.DoubleGreater(m_oprevlowestday.Value, newqualdays)); } if (((m_qualhi.Value && PublicFunctions.DoubleGreater(Bars.High[0], m_oprevhighest.Value)) && PublicFunctions.IffLogic((m_dataarray[0][((12)), ((m_index.Value))] == m_subarray[0][((3))]), PublicFunctions.DoubleLessEquals(m_subarray[0][((1))], m_oprevhighest.Value), true))) { if ((Bars.Time[0] != m_prevnewhidate.Value)) { Plot1.Set(0, Bars.High[0]); } m_prevnewhidate.Value = Bars.Time[0]; } else { if (((m_quallo.Value && PublicFunctions.DoubleLess(Bars.Low[0], m_oprevlowest.Value)) && PublicFunctions.IffLogic((m_dataarray[0][((12)), ((m_index.Value))] == m_subarray[0][((3))]), PublicFunctions.DoubleGreaterEquals(m_subarray[0][((2))], m_oprevlowest.Value), true))) { if ((Bars.Time[0] != m_prevnewlodate.Value)) { Plot2.Set(0, Bars.Low[0]); } m_prevnewlodate.Value = Bars.Time[0]; } } Plot3.Set(0, m_oprevhighest.Value); Plot4.Set(0, m_oprevlowest.Value); if (m_qualhi.Value) { Plot3.Widths[0] = 2; } if (m_quallo.Value) { Plot4.Widths[0] = 2; } }
protected override void CalcBar() { if ((Bars.LastBarOnChart && (BarsOfData(datanum).Status != EBarState.Close))) { if ((m_barnum.Value != Bars.CurrentBar)) { m_blocktrades.Value = 0; m_barnum.Value = Bars.CurrentBar; } if (PublicFunctions.DoubleGreaterEquals(Bars.StatusLine.LastVolume, blocksize)) { m_blocktrades.Value = (m_blocktrades.Value + 1); } plot1.Set(0, m_blocktrades.Value); } }
protected override void CalcBar() { m_adxvalue.Value = m_adx1[0]; Plot1.Set(0, m_adxvalue.Value); if (PublicFunctions.DoubleGreater(m_adxvalue.Value, m_adxvalue[1]) && PublicFunctions.DoubleLessEquals(m_adxvalue[1], m_adxvalue[2])) { Alerts.Alert("Indicator turning up"); } else { if (PublicFunctions.DoubleLess(m_adxvalue.Value, m_adxvalue[1]) && PublicFunctions.DoubleGreaterEquals(m_adxvalue[1], m_adxvalue[2])) { Alerts.Alert("Indicator turning down"); } } }
protected override void CalcBar() { if (m_SwingHigh[0] > 0) { m_Setup.Value = true; m_PivotHigh.Value = Bars.High[Strength]; } else { if (m_Setup.Value && PublicFunctions.DoubleGreaterEquals(Bars.High[0], m_PivotHigh.Value + Bars.Point)) { m_Setup.Value = false; } } if (m_Setup.Value) { m_PivRevLE.Send(m_PivotHigh.Value + Bars.Point); } }
protected override void CalcBar() { m_dirmovement1.Call(); Plot1.Set(0, m_dirmovement1.ADX.Value); Plot2.Set(0, m_dirmovement1.ADXR.Value); if (PublicFunctions.DoubleGreater(m_dirmovement1.ADXR.Value, m_dirmovement1.ADXR[1]) && PublicFunctions.DoubleLessEquals(m_dirmovement1.ADXR[1], m_dirmovement1.ADXR[2])) { Alerts.Alert("ADXR turning up"); } else { if (PublicFunctions.DoubleLess(m_dirmovement1.ADXR.Value, m_dirmovement1.ADXR[1]) && PublicFunctions.DoubleGreaterEquals(m_dirmovement1.ADXR[1], m_dirmovement1.ADXR[2])) { Alerts.Alert("ADXR turning down"); } } }
protected override void CalcBar() { m_tsf.Value = m_timeseriesforecast1[0]; Plot1.Set(0, m_tsf.Value); if (((PublicFunctions.DoubleGreater(Bars.Close[0], m_tsf.Value) && PublicFunctions.DoubleGreater(m_tsf.Value, m_tsf[1])) && PublicFunctions.DoubleLessEquals(m_tsf[1], m_tsf[2]))) { Alerts.Alert("Indicator turning up"); } else { if (((PublicFunctions.DoubleLess(Bars.Close[0], m_tsf.Value) && PublicFunctions.DoubleLess(m_tsf.Value, m_tsf[1])) && PublicFunctions.DoubleGreaterEquals(m_tsf[1], m_tsf[2]))) { Alerts.Alert("Indicator turning down"); } } }
protected override void CalcBar() { if (PublicFunctions.DoubleGreater(m_price[0], m_price[1])) { m_value1.Value++; } else { m_value1.Value = 0; } if (PublicFunctions.DoubleGreaterEquals(m_value1.Value, consecutivebarsup)) { Plot1.Set(0, Bars.High[0]); Alerts.Alert(); } else { Plot1.Reset(); } }
protected override void CalcBar() { if (Bars.LastBarOnChart && Bars.Status != EBarState.Close) { var m_myvol = Bars.TrueVolume()[0]; if (Bars.CurrentBar > m_mycurrentbar.Value) { m_volumeatbid.Value = 0; m_volumeatask.Value = 0; m_bavolratio.Value = 0; m_voltmp.Value = 0; m_mycurrentbar.Value = Bars.CurrentBar; } if (PublicFunctions.DoubleLess(Bars.StatusLine.Bid, Bars.StatusLine.Ask)) { if (PublicFunctions.DoubleLessEquals(Bars.Close[0], Bars.StatusLine.Bid)) { m_volumeatbid.Value = ((m_volumeatbid.Value + m_myvol) - m_voltmp.Value); } else { if (PublicFunctions.DoubleGreaterEquals(Bars.Close[0], Bars.StatusLine.Ask)) { m_volumeatask.Value = ((m_volumeatask.Value + m_myvol) - m_voltmp.Value); } } } if ((PublicFunctions.DoubleGreater(m_volumeatbid.Value, 0) && PublicFunctions.DoubleGreater(m_volumeatask.Value, 0))) { m_bavolratio.Value = PublicFunctions.Iff(uselog, Math.Log((m_volumeatask.Value / ((m_volumeatbid.Value)))), (m_volumeatask.Value / ((m_volumeatbid.Value)))); } m_voltmp.Value = m_myvol; Plot1.Set(0, m_bavolratio.Value); } Plot2.Set(0, 0); }
protected override void CalcBar() { if (m_criteria(0)) { var m_count = m_criteria.CountIF(length); if (PublicFunctions.DoubleGreaterEquals(m_count, occur)) { Plot1.Set(0, Bars.High[0]); Alerts.Alert(); if (showtext) { m_textid = DrwText.Create(new ChartPoint(Bars.Time[0], Bars.High[0]), m_count.ToString()); m_textid.HStyle = ETextStyleH.Center; m_textid.VStyle = ETextStyleV.Above; m_textid.Color = textcolor; } } } else { Plot1.Reset(); } }
protected override void CalcBar() { m_rs_dailydataarray1.Call(); var m_barnum = m_barnumber1[0]; var m_barssincedayhi = (m_barnum - m_dataarray[0][10, m_index.Value]); var m_barssincedaylo = (m_barnum - m_dataarray[0][11, m_index.Value]); var mBbminus1 = (barsbetween - 1); m_qualhi.Value = PublicFunctions.DoubleGreaterEquals(m_barssincedayhi, mBbminus1); m_quallo.Value = PublicFunctions.DoubleGreaterEquals(m_barssincedaylo, mBbminus1); if (requirereversalgap) { if (((Bars.CurrentBar == 1) || (Bars.Time[0].Date != Bars.Time[1].Date))) { m_rs_extremes1.Call(); var m_gapup = PublicFunctions.DoubleGreater(m_dataarray[0][((1)), ((m_index.Value))], m_oprevhighest.Value); var m_gapdn = PublicFunctions.DoubleLess(m_dataarray[0][((1)), ((m_index.Value))], m_oprevlowest.Value); var m_thirdprevavg = m_rs_average1[0]; var m_secondprevavg = m_rs_average2[0]; var m_prevavg = m_rs_average3[0]; var m_uptrend = (PublicFunctions.DoubleGreater(m_prevavg, m_secondprevavg) && PublicFunctions.DoubleGreater(m_secondprevavg, m_thirdprevavg)); var m_dntrend = (PublicFunctions.DoubleLess(m_prevavg, m_secondprevavg) && PublicFunctions.DoubleLess(m_secondprevavg, m_thirdprevavg)); m_revgapup.Value = (m_dntrend && m_gapup); m_revgapdn.Value = (m_uptrend && m_gapdn); } } else { m_revgapup.Value = true; m_revgapdn.Value = true; } if ((Bars.Time[0].Date == Bars.Time[1].Date)) { var m_newdayhi = (m_barssincedayhi == 0 && m_qualhi[1] && m_revgapup.Value); var m_newdaylo = (m_barssincedaylo == 0 && m_quallo[1] && m_revgapdn.Value); if ((m_newdayhi && m_newdaylo)) { Plot1.Set(0, Bars.Close[0], Color.White); } else { if (m_newdayhi) { Plot1.Set(0, Bars.High[0], Color.Yellow); } else { if (m_newdaylo) { Plot1.Set(0, Bars.Low[0], Color.Cyan); } } } } var _now_time = new DateTime(1, 1, 1, Bars.Time[0].Hour, Bars.Time[0].Minute, Bars.Time[0].Second); if (_now_time < startbartime || _now_time > endbartime) { Plot1.Colors[0] = Color.DarkGray; } if (requirereversalgap) { if (m_revgapup.Value) { Plot2.Set(0, Bars.Close[0], Color.Blue); } else { if (m_revgapdn.Value) { Plot2.Set(0, Bars.Close[0], default(Color)); } } } Plot3.Set(0, m_dataarray[0][((2)), ((m_index.Value))]); Plot4.Set(0, m_dataarray[0][((3)), ((m_index.Value))]); if (m_qualhi.Value) { Plot3.Widths[0] = 2; } if (m_quallo.Value) { Plot4.Widths[0] = 2; } }
protected override void CalcBar() { var m_newswingprice = m_swinghigh1[0]; if ((m_newswingprice != (-1))) { if ((PublicFunctions.DoubleLessEquals(m_tldir.Value, 0) && PublicFunctions.DoubleGreaterEquals(m_newswingprice, (m_swingprice.Value * m_retracefctrup)))) { m_saveswing.Value = true; m_addtl.Value = true; m_tldir.Value = 1; } else { if (((m_tldir.Value == 1) && PublicFunctions.DoubleGreaterEquals(m_newswingprice, m_swingprice.Value))) { m_saveswing.Value = true; m_updatetl.Value = true; } } } else { m_newswingprice = m_swinglow1[0]; if ((m_newswingprice != (-1))) { if ((PublicFunctions.DoubleGreaterEquals(m_tldir.Value, 0) && PublicFunctions.DoubleLessEquals(m_newswingprice, (m_swingprice.Value * m_retracefctrdn)))) { m_saveswing.Value = true; m_addtl.Value = true; m_tldir.Value = (-1); } else { if (((m_tldir.Value == (-1)) && PublicFunctions.DoubleLessEquals(m_newswingprice, m_swingprice.Value))) { m_saveswing.Value = true; m_updatetl.Value = true; } } } } if (m_saveswing.Value) { m_swingprice.Value = m_newswingprice; m_swingtime.Value = Bars.Time[1]; m_saveswing.Value = false; } if (m_addtl.Value) { m_tlref.Value = DrwTrendLine.Create(new ChartPoint(m_swingtime.Value, m_swingprice.Value), new ChartPoint(m_swingtime[1], m_swingprice[1])); m_tlref.Value.ExtLeft = false; m_tlref.Value.ExtRight = false; m_tlref.Value.Size = ((int)(linewidth)); m_tlref.Value.Color = linecolor; m_addtl.Value = false; } else { if (m_updatetl.Value) { m_tlref.Value.End = new ChartPoint(m_swingtime.Value, m_swingprice.Value); m_updatetl.Value = false; } } }
protected override void CalcBar() { m_barnum.Value = m_barnumber1[0]; if ((hilo == 1)) { m_neckswbar.Value = m_swinglowbar1[0]; m_hnsswbar.Value = m_swinghighbar1[0]; m_neckswprice.Value = Bars.Low[0]; m_hnsswprice.Value = Bars.High[0]; } else { if ((hilo == (-1))) { m_neckswbar.Value = m_swinghighbar2[0]; m_hnsswbar.Value = m_swinglowbar2[0]; m_neckswprice.Value = Bars.High[0]; m_hnsswprice.Value = Bars.Low[0]; } } if ((m_neckswbar.Value == neckswstrength)) { m_neckswings[0][((1)), 0] = m_neckswings[0][0, 0]; m_neckswings[0][((1)), ((1))] = m_neckswings[0][0, ((1))]; m_neckswings[0][((1)), ((2))] = m_neckswings[0][0, ((2))]; m_neckswings[0][((1)), ((3))] = m_neckswings[0][0, ((3))]; m_neckswings[0][0, 0] = m_barnum[neckswstrength]; m_neckswings[0][0, ((1))] = Bars.Time[neckswstrength].ToOADate(); m_neckswings[0][0, ((2))] = Bars.Time[neckswstrength].ToOADate(); m_neckswings[0][0, ((3))] = m_neckswprice[neckswstrength]; } if ((m_hnsswbar.Value == hnsswstrength)) { for (var m_value1 = 1; PublicFunctions.DoubleGreaterEquals(m_value1, 0); m_value1 = (m_value1 - 1)) { m_hnsswings[0][m_value1 + 1, 0] = m_hnsswings[0][m_value1, 0]; m_hnsswings[0][m_value1 + 1, ((1))] = m_hnsswings[0][m_value1, ((1))]; m_hnsswings[0][m_value1 + 1, ((2))] = m_hnsswings[0][m_value1, ((2))]; m_hnsswings[0][m_value1 + 1, ((3))] = m_hnsswings[0][m_value1, ((3))]; m_hnsswings[0][m_value1 + 1, ((4))] = m_hnsswings[0][m_value1, ((4))]; } m_hnsswings[0][0, 0] = m_barnum[hnsswstrength]; m_hnsswings[0][0, ((1))] = Bars.Time[hnsswstrength].ToOADate(); m_hnsswings[0][0, ((2))] = Bars.Time[hnsswstrength].ToOADate(); m_hnsswings[0][0, ((3))] = m_hnsswprice[hnsswstrength]; m_hnsswings[0][0, ((4))] = Bars.TrueVolume().Average(hnsswstrength * 2); var m_hororder = ((((m_hnsswings[0][0, 0] > m_neckswings[0][0, 0]) && (m_neckswings[0][0, 0] > m_hnsswings[0][((1)), 0])) && (m_hnsswings[0][((1)), 0] > m_neckswings[0][((1)), 0])) && (m_neckswings[0][((1)), 0] > m_hnsswings[0][((2)), 0])); if ((hilo == 1)) { m_vertorder_hvss.Value = ((m_hnsswings[0][((1)), ((3))] > m_hnsswings[0][((2)), ((3))]) && (m_hnsswings[0][((1)), ((3))] > m_hnsswings[0][0, ((3))])); m_vertorder_nvss.Value = ((m_neckswings[0][0, ((3))] < m_hnsswings[0][((2)), ((3))]) && (m_neckswings[0][((1)), ((3))] < m_hnsswings[0][0, ((3))])); m_necklinelimit.Value = PublicFunctions.Min(m_neckswings[0][0, ((3))], m_neckswings[0][((1)), ((3))]); m_maxnecktoheaddist.Value = (m_hnsswings[0][((1)), ((3))] - m_necklinelimit.Value); } else { if ((hilo == (-1))) { m_vertorder_hvss.Value = ((m_hnsswings[0][((1)), ((3))] < m_hnsswings[0][((2)), ((3))]) && (m_hnsswings[0][((1)), ((3))] < m_hnsswings[0][0, ((3))])); m_vertorder_nvss.Value = ((m_neckswings[0][0, ((3))] > m_hnsswings[0][((2)), ((3))]) && (m_neckswings[0][((1)), ((3))] > m_hnsswings[0][0, ((3))])); m_necklinelimit.Value = PublicFunctions.Max(m_neckswings[0][0, ((3))], m_neckswings[0][((1)), ((3))]); m_maxnecktoheaddist.Value = (m_necklinelimit.Value - m_hnsswings[0][((1)), ((3))]); } } var m_necklinetilt = Math.Abs((m_neckswings[0][0, ((3))] - m_neckswings[0][((1)), ((3))])); if ((m_maxnecktoheaddist.Value != 0)) { m_vertproportion.Value = PublicFunctions.DoubleLess((m_necklinetilt / ((m_maxnecktoheaddist.Value))), vertproportionlimit); } else { m_vertproportion.Value = false; } if ((((m_hororder && m_vertorder_hvss.Value) && m_vertorder_nvss.Value) && m_vertproportion.Value)) { if ((m_color.Value == color2)) { m_color.Value = color1; } else { m_color.Value = color2; } var m_textref = DrwText.Create( new ChartPoint(DateTime.FromOADate(m_hnsswings[0][0, ((2))]), m_hnsswings[0][0, ((3))]), "Shoulder"); m_textref.Color = m_color.Value; m_textref.HStyle = (ETextStyleH)2; m_textref.VStyle = 0; m_textref = DrwText.Create( new ChartPoint(DateTime.FromOADate(m_hnsswings[0][((1)), ((2))]), m_hnsswings[0][((1)), ((3))]), "Head"); m_textref.Color = m_color.Value; m_textref.HStyle = (ETextStyleH)2; m_textref.VStyle = 0; m_textref = DrwText.Create( new ChartPoint(DateTime.FromOADate(m_hnsswings[0][((2)), ((2))]), m_hnsswings[0][((2)), ((3))]), "Shoulder"); m_textref.Color = m_color.Value; m_textref.HStyle = (ETextStyleH)2; m_textref.VStyle = 0; if (confirmvolume) { var m_avgvolfast = Bars.TrueVolume().Average(hnsswstrength); string m_msg; if ((PublicFunctions.DoubleGreater(m_avgvolfast, m_hnsswings[0][0, ((4))]) && PublicFunctions.DoubleGreater(m_avgvolfast, m_hnsswings[0][((2)), ((4))]))) { m_msg = "Volume confirm"; } else { m_msg = "Vol non-confirm"; } m_textref = DrwText.Create( new ChartPoint(DateTime.FromOADate(m_neckswings[0][((1)), ((2))]), m_necklinelimit.Value), m_msg); m_textref.Color = m_color.Value; m_textref.HStyle = 0; m_textref.VStyle = (ETextStyleV)1; } if (drawneckline) { m_tlref = DrwTrendLine.Create( new ChartPoint(DateTime.FromOADate(m_neckswings[0][((1)), ((2))]), m_neckswings[0][((1)), ((3))]), new ChartPoint(DateTime.FromOADate(m_neckswings[0][0, ((2))]), m_neckswings[0][0, ((3))])); m_tlref.ExtLeft = false; m_tlref.ExtRight = false; m_tlref.Color = m_color.Value; m_confirmbarnum.Value = m_barnum.Value; } } } if ((null != m_tlref && m_tlref.Exist && m_lastcrossedtl.Value != m_tlref.ID && PublicFunctions.DoubleLessEquals((m_barnum.Value - m_confirmbarnum.Value), barspast))) { var m_tl_value = m_tlref.PriceValue(Bars.Time[0]); if ((((hilo == 1) && PublicFunctions.DoubleLess(Bars.Close[0], m_tl_value)) || ((hilo == (-1)) && PublicFunctions.DoubleGreater(Bars.Close[0], m_tl_value)))) { Plot1.Set(0, m_neckswprice.Value, m_color.Value); Alerts.Alert(); m_lastcrossedtl.Value = m_tlref.ID; } else { Plot1.Reset(); } } }