protected double dblCalculateTP(AdvisorOrderType _ordertype, int mode) { if (mode == 0) { if ((int)_ordertype == (int)AdvisorOrderType.Sell) { if (LevelSR1) { if (Instrument.Bid < PivotS1) { return((double)Math.Round(PivotS2, Instrument.PriceScale)); } else { return((double)Math.Round(PivotS1, Instrument.PriceScale)); } } else { return((double)Math.Round(PivotS2, Instrument.PriceScale)); } } if ((int)_ordertype == (int)AdvisorOrderType.Buy) { if (LevelSR1) { if (Instrument.Ask > PivotR1) { return((double)Math.Round(PivotR2, Instrument.PriceScale)); } else { return((double)Math.Round(PivotR1, Instrument.PriceScale)); } } else { return((double)Math.Round(PivotR2, Instrument.PriceScale)); } } } else { if ((int)_ordertype == (int)AdvisorOrderType.Sell) { return((double)Math.Round(Instrument.Bid - (PivotS2 - PivotS3), Instrument.PriceScale)); } if ((int)_ordertype == (int)AdvisorOrderType.Buy) { return((double)Math.Round(Instrument.Ask + (PivotR3 - PivotR2), Instrument.PriceScale)); } } return((double)0.0); }
protected int intCalculateTP(AdvisorOrderType _ordertype, int mode) { if (mode == 0) { if ((int)_ordertype == (int)AdvisorOrderType.Sell) { if (LevelSR1) { if (Instrument.Bid < PivotS1) { return((int)Math.Round((Instrument.Bid - PivotS2) / Instrument.Point, 0)); } else { return((int)Math.Round((Instrument.Bid - PivotS1) / Instrument.Point, 0)); } } else { return((int)Math.Round((Instrument.Bid - PivotS2) / Instrument.Point, 0)); } } if ((int)_ordertype == (int)AdvisorOrderType.Buy) { if (LevelSR1) { if (Instrument.Ask > PivotR1) { return((int)Math.Round((PivotR2 - Instrument.Ask) / Instrument.Point, 0)); } else { return((int)Math.Round((PivotR1 - Instrument.Ask) / Instrument.Point, 0)); } } else { return((int)Math.Round((PivotR2 - Instrument.Ask) / Instrument.Point, 0)); } } } else { if ((int)_ordertype == (int)AdvisorOrderType.Sell) { return((int)Math.Round((PivotS2 - PivotS3) / Instrument.Point, 0)); } if ((int)_ordertype == (int)AdvisorOrderType.Buy) { return((int)Math.Round((PivotR3 - PivotR2) / Instrument.Point, 0)); } } return(0); }