├── Expert_version.txt ├── FSB_Expert_MT4.mq4 ├── FSB_Expert_MT5.mq5 ├── Forexsb.com ├── ActionTrade4.mqh ├── ActionTrade5.mqh ├── Custom │ ├── ChandeMomentumOscillator.mqh │ ├── DayOfMonth.mqh │ ├── GatorOscillator.mqh │ ├── MomentumMT.mqh │ ├── MovingAverageOfOscillator.mqh │ ├── PercentBB.mqh │ ├── VidyaMovingAverage.mqh │ └── Volumes.mqh ├── DataMarket.mqh ├── DataSet.mqh ├── Enumerations.mqh ├── HelperMq4.mqh ├── HelperMq5.mqh ├── Helpers.mqh ├── Indicator.mqh ├── IndicatorComp.mqh ├── IndicatorManager.mqh ├── IndicatorParam.mqh ├── IndicatorSlot.mqh ├── Indicators │ ├── ADX.mqh │ ├── ATRMAOscillator.mqh │ ├── ATRStop.mqh │ ├── AcceleratorOscillator.mqh │ ├── AccountPercentStop.mqh │ ├── AccumulationDistribution.mqh │ ├── Alligator.mqh │ ├── AroonHistogram.mqh │ ├── AverageTrueRange.mqh │ ├── AwesomeOscillator.mqh │ ├── BBPMAOscillator.mqh │ ├── BalanceofPower.mqh │ ├── BarClosing.mqh │ ├── BarOpening.mqh │ ├── BarRange.mqh │ ├── BearsPower.mqh │ ├── BollingerBands.mqh │ ├── BullsBearsPower.mqh │ ├── BullsPower.mqh │ ├── CCIMAOscillator.mqh │ ├── CloseandReverse.mqh │ ├── CommodityChannelIndex.mqh │ ├── CumulativeSum.mqh │ ├── DayClosing.mqh │ ├── DayClosing2.mqh │ ├── DayOpening.mqh │ ├── DaysOfWeek.mqh │ ├── DeMarker.mqh │ ├── DetrendedOscillator.mqh │ ├── DirectionalIndicators.mqh │ ├── DonchianChannel.mqh │ ├── EaseofMovement.mqh │ ├── EnterOnce.mqh │ ├── EntryHour.mqh │ ├── EntryTime.mqh │ ├── Envelopes.mqh │ ├── ExitHour.mqh │ ├── FisherTransform.mqh │ ├── ForceIndex.mqh │ ├── Fractal.mqh │ ├── HeikenAshi.mqh │ ├── HourlyHighLow.mqh │ ├── IchimokuKinkoHyo.mqh │ ├── InsideBar.mqh │ ├── KeltnerChannel.mqh │ ├── LongOrShort.mqh │ ├── MACD.mqh │ ├── MACDHistogram.mqh │ ├── MAOscillator.mqh │ ├── MarketFacilitationIndex.mqh │ ├── Momentum.mqh │ ├── MomentumMAOscillator.mqh │ ├── MoneyFlow.mqh │ ├── MoneyFlowIndex.mqh │ ├── MovingAveragesCrossover.mqh │ ├── MovingAvrg.mqh │ ├── NBarsExit.mqh │ ├── NarrowRange.mqh │ ├── OBOSMAOscillator.mqh │ ├── OnBalanceVolume.mqh │ ├── OscillatorofATR.mqh │ ├── OscillatorofBBP.mqh │ ├── OscillatorofCCI.mqh │ ├── OscillatorofMACD.mqh │ ├── OscillatorofMomentum.mqh │ ├── OscillatorofOBOS.mqh │ ├── OscillatorofROC.mqh │ ├── OscillatorofRSI.mqh │ ├── OscillatorofTrix.mqh │ ├── OverboughtOversoldIndex.mqh │ ├── ParabolicSAR.mqh │ ├── PercentChange.mqh │ ├── PivotPoints.mqh │ ├── PreviousBarClosing.mqh │ ├── PreviousBarOpening.mqh │ ├── PreviousHighLow.mqh │ ├── PriceMove.mqh │ ├── PriceOscillator.mqh │ ├── ROCMAOscillator.mqh │ ├── RSI.mqh │ ├── RSIMAOscillator.mqh │ ├── RateofChange.mqh │ ├── RelativeVigorIndex.mqh │ ├── RossHook.mqh │ ├── RoundNumber.mqh │ ├── StandardDeviation.mqh │ ├── StarcBands.mqh │ ├── SteadyBands.mqh │ ├── Stochastics.mqh │ ├── StopLimit.mqh │ ├── StopLoss.mqh │ ├── TakeProfit.mqh │ ├── TopBottomPrice.mqh │ ├── TrailingStop.mqh │ ├── TrailingStopLimit.mqh │ ├── TrixIndex.mqh │ ├── TrixMAOscillator.mqh │ ├── WeekClosing.mqh │ ├── WeekClosing2.mqh │ └── WilliamsPercentRange.mqh ├── Logger.mqh ├── Position.mqh ├── Strategy.mqh ├── StrategyManager.mqh └── StrategyTrader.mqh └── README.md /Expert_version.txt: -------------------------------------------------------------------------------- 1 | 50 2 | -------------------------------------------------------------------------------- /Forexsb.com/Custom/DayOfMonth.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class DayOfMonth : public Indicator 35 | { 36 | public: 37 | DayOfMonth(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void DayOfMonth::DayOfMonth(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Day of Month"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void DayOfMonth::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | // Reading the parameters 62 | int fromDay = (int)NumParam[0].Value; 63 | int untilDay = (int)NumParam[1].Value; 64 | 65 | // Calculation 66 | int firstBar=2; 67 | double signal[]; ArrayResize(signal,Data.Bars); ArrayInitialize(signal,0); 68 | 69 | // Calculation of the logic 70 | for(int bar=firstBar; bar=fromDay && time.dayuntilDay) 76 | signal[bar]=time.day>=fromDay || time.day 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class Volumes : public Indicator 35 | { 36 | public: 37 | Volumes(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void Volumes::Volumes(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Volumes"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = true; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void Volumes::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | double level =NumParam[0].Value; 62 | int previous=CheckParam[0].Checked ? 1 : 0; 63 | 64 | double volumes[]; ArrayResize(volumes,Data.Bars); ArrayInitialize(volumes,0); 65 | int firstBar=previous+2; 66 | 67 | for(int bar=0; bar volumes[bar - previous - 1] + Sigma() ? 1 : 0; 104 | Component[2].Value[bar] = volumes[bar - previous] > volumes[bar - previous - 1] + Sigma() ? 1 : 0; 105 | } 106 | } 107 | else if(ListParam[0].Text=="Volume falls") 108 | { 109 | for(int bar=previous+1; bar level + Sigma() ? 1 : 0; 120 | Component[2].Value[bar] = volumes[bar - previous] > level + Sigma() ? 1 : 0; 121 | } 122 | } 123 | else if(ListParam[0].Text=="Volume is lower than the Level line") 124 | { 125 | for(int bar=previous; bar 30 | //## Import Start 31 | 32 | class DataMarket 33 | { 34 | public: 35 | string Symbol; 36 | DataPeriod Period; 37 | 38 | bool IsNewBid; 39 | 40 | double OldBid; 41 | double OldAsk; 42 | double OldClose; 43 | double Bid; 44 | double Ask; 45 | double Close; 46 | long Volume; 47 | 48 | datetime TickLocalTime; 49 | datetime TickServerTime; 50 | datetime BarTime; 51 | 52 | double AccountBalance; 53 | double AccountEquity; 54 | double AccountFreeMargin; 55 | 56 | double PositionLots; 57 | double PositionOpenPrice; 58 | datetime PositionOpenTime; 59 | double PositionStopLoss; 60 | double PositionTakeProfit; 61 | double PositionProfit; 62 | PosDirection PositionDirection; 63 | 64 | int ConsecutiveLosses; 65 | int WrongStopLoss; 66 | int WrongTakeProf; 67 | int WrongStopsRetry; 68 | bool IsFailedCloseOrder; 69 | int CloseOrderTickCounter; 70 | bool IsSentCloseOrder; 71 | 72 | int LotSize; 73 | double Spread; 74 | double Point; 75 | int StopLevel; 76 | double TickValue; 77 | double MinLot; 78 | double MaxLot; 79 | double LotStep; 80 | double MarginRequired; 81 | }; 82 | //+------------------------------------------------------------------+ 83 | -------------------------------------------------------------------------------- /Forexsb.com/DataSet.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "3.00" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //## Import Start 32 | 33 | class DataSet 34 | { 35 | public: 36 | // Constructor 37 | DataSet(string chart); 38 | 39 | // Properties 40 | string Chart; 41 | string Symbol; 42 | DataPeriod Period; 43 | 44 | int LotSize; 45 | double Spread; 46 | int Digits; 47 | double Point; 48 | double Pip; 49 | bool IsFiveDigits; 50 | int StopLevel; 51 | double TickValue; 52 | double MinLot; 53 | double MaxLot; 54 | double LotStep; 55 | double MarginRequired; 56 | 57 | int Bars; 58 | 59 | datetime ServerTime; 60 | double Bid; 61 | double Ask; 62 | 63 | datetime Time[]; 64 | double Open[]; 65 | double High[]; 66 | double Low[]; 67 | double Close[]; 68 | long Volume[]; 69 | 70 | // Methods 71 | void SetPrecision(void); 72 | }; 73 | //+------------------------------------------------------------------+ 74 | //| | 75 | //+------------------------------------------------------------------+ 76 | void DataSet::DataSet(string chart) 77 | { 78 | Chart=chart; 79 | string parts[]; 80 | StringSplit(chart,',',parts); 81 | Symbol = parts[0]; 82 | Period = StringToDataPeriod(parts[1]); 83 | } 84 | //+------------------------------------------------------------------+ 85 | //| | 86 | //+------------------------------------------------------------------+ 87 | void DataSet::SetPrecision(void) 88 | { 89 | IsFiveDigits=(Digits==3 || Digits==5); 90 | Point=1/MathPow(10,Digits); 91 | Pip=IsFiveDigits ? (10*Point) : Point; 92 | } 93 | //+------------------------------------------------------------------+ 94 | -------------------------------------------------------------------------------- /Forexsb.com/IndicatorComp.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.00" 27 | #property strict 28 | 29 | #include 30 | //## Import Start 31 | 32 | class IndicatorComp 33 | { 34 | public: 35 | // Constructors 36 | IndicatorComp(); 37 | 38 | // Properties 39 | string CompName; 40 | int FirstBar; 41 | int UsePreviousBar; // Deprecated 42 | IndComponentType DataType; 43 | PositionPriceDependence PosPriceDependence; 44 | bool ShowInDynInfo; 45 | double Value[]; 46 | 47 | // Methods 48 | double GetLastValue(int indexFromEnd); 49 | }; 50 | //+------------------------------------------------------------------+ 51 | //| | 52 | //+------------------------------------------------------------------+ 53 | void IndicatorComp::IndicatorComp() 54 | { 55 | CompName = "Not defined"; 56 | DataType = IndComponentType_NotDefined; 57 | FirstBar = 0; 58 | UsePreviousBar = 0; 59 | ShowInDynInfo = true; 60 | PosPriceDependence = PositionPriceDependence_None; 61 | } 62 | //+------------------------------------------------------------------+ 63 | //| | 64 | //+------------------------------------------------------------------+ 65 | double IndicatorComp::GetLastValue(int indexFromEnd=0) 66 | { 67 | int bars=ArraySize(Value); 68 | double lastValue=(bars>indexFromEnd) ? Value[bars-indexFromEnd-1]: 0; 69 | return (lastValue); 70 | } 71 | //+------------------------------------------------------------------+ 72 | -------------------------------------------------------------------------------- /Forexsb.com/IndicatorParam.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "3.00" 27 | #property strict 28 | //## Import Start 29 | 30 | class ListParameter 31 | { 32 | public: 33 | // Constructors 34 | ListParameter() 35 | { 36 | Caption = ""; 37 | Text = ""; 38 | Index = -1; 39 | Enabled = false; 40 | } 41 | 42 | // Properties 43 | string Caption; 44 | string Text; 45 | int Index; 46 | bool Enabled; 47 | }; 48 | //+------------------------------------------------------------------+ 49 | //| | 50 | //+------------------------------------------------------------------+ 51 | class NumericParameter 52 | { 53 | public: 54 | // Constructor 55 | NumericParameter() 56 | { 57 | Caption = ""; 58 | Value = 0; 59 | Enabled = false; 60 | } 61 | 62 | // Properties 63 | string Caption; 64 | double Value; 65 | bool Enabled; 66 | }; 67 | //+------------------------------------------------------------------+ 68 | //| | 69 | //+------------------------------------------------------------------+ 70 | class CheckParameter 71 | { 72 | public: 73 | // Constructor 74 | CheckParameter() 75 | { 76 | Caption = ""; 77 | Checked = false; 78 | Enabled = false; 79 | } 80 | 81 | // Properties 82 | string Caption; 83 | bool Checked; 84 | bool Enabled; 85 | }; 86 | //+------------------------------------------------------------------+ 87 | -------------------------------------------------------------------------------- /Forexsb.com/IndicatorSlot.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.00" 27 | #property strict 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | //## Import Start 35 | 36 | class IndicatorSlot 37 | { 38 | public: 39 | // Constructors 40 | IndicatorSlot(); 41 | ~IndicatorSlot(); 42 | 43 | // Properties 44 | int SlotNumber; 45 | SlotTypes SlotType; 46 | string IndicatorName; 47 | string LogicalGroup; 48 | int SignalShift; 49 | int SignalRepeat; 50 | string IndicatorSymbol; 51 | DataPeriod IndicatorPeriod; 52 | 53 | Indicator *IndicatorPointer; 54 | 55 | // Methods 56 | bool GetUsePreviousBarValue(void); 57 | string LogicalGroupToString(void); 58 | string AdvancedParamsToString(void); 59 | string GetIndicatorSymbol(string baseSymbol); 60 | DataPeriod GetIndicatorPeriod(DataPeriod basePeriod); 61 | }; 62 | //+------------------------------------------------------------------+ 63 | //| | 64 | //+------------------------------------------------------------------+ 65 | IndicatorSlot::IndicatorSlot(void) 66 | { 67 | } 68 | //+------------------------------------------------------------------+ 69 | //| | 70 | //+------------------------------------------------------------------+ 71 | IndicatorSlot::~IndicatorSlot(void) 72 | { 73 | if(CheckPointer(IndicatorPointer)==POINTER_DYNAMIC) 74 | delete IndicatorPointer; 75 | } 76 | //+------------------------------------------------------------------+ 77 | //| | 78 | //+------------------------------------------------------------------+ 79 | bool IndicatorSlot::GetUsePreviousBarValue(void) 80 | { 81 | for(int i=0; i 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class ATRStop : public Indicator 35 | { 36 | public: 37 | ATRStop(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void ATRStop::ATRStop(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "ATR Stop"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void ATRStop::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | MAMethod maMethod=(MAMethod) ListParam[1].Index; 62 | int period=(int) NumParam[0].Value; 63 | double multipl=NumParam[1].Value; 64 | int previous=CheckParam[0].Checked ? 1 : 0; 65 | 66 | int firstBar=period+previous+2; 67 | 68 | double atr1[]; ArrayResize(atr1,Data.Bars); ArrayInitialize(atr1,0); 69 | 70 | for(int bar=1; bar 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class AccountPercentStop : public Indicator 35 | { 36 | public: 37 | AccountPercentStop(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void AccountPercentStop::AccountPercentStop(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Account Percent Stop"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void AccountPercentStop::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | Component[0].CompName = "Stop to a transferred position"; 62 | Component[0].DataType = IndComponentType_Other; 63 | Component[0].ShowInDynInfo = false; 64 | Component[0].FirstBar = 2; 65 | ArrayResize(Component[0].Value,Data.Bars); 66 | ArrayInitialize(Component[0].Value,0); 67 | } 68 | //+------------------------------------------------------------------+ 69 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/AccumulationDistribution.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.00" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class AccumulationDistribution : public Indicator 35 | { 36 | public: 37 | AccumulationDistribution(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void AccumulationDistribution::AccumulationDistribution(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Accumulation Distribution"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = true; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void AccumulationDistribution::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | int previous=CheckParam[0].Checked ? 1 : 0; 62 | 63 | int firstBar=previous+2; 64 | 65 | double accumulationDistribution[]; 66 | ArrayResize(accumulationDistribution,Data.Bars); 67 | ArrayInitialize(accumulationDistribution,0); 68 | 69 | accumulationDistribution[0]=(Data.Close[0]-Data.Low[0]) -(Data.High[0]-Data.Close[0]); 70 | if((Data.High[0]-Data.Low[0])>0) 71 | accumulationDistribution[0]=accumulationDistribution[0]/(Data.High[0]-Data.Low[0])*Data.Volume[0]; 72 | 73 | for(int bar=1; bar0) 79 | delta=Data.Volume[bar]*(2*Data.Close[bar]-Data.High[bar]-Data.Low[bar])/range; 80 | 81 | accumulationDistribution[bar]=accumulationDistribution[bar-1]+delta; 82 | } 83 | 84 | ArrayResize(Component[0].Value,Data.Bars); 85 | Component[0].CompName = "Accumulation Distribution"; 86 | Component[0].DataType = IndComponentType_IndicatorValue; 87 | Component[0].FirstBar = firstBar; 88 | ArrayCopy(Component[0].Value,accumulationDistribution); 89 | 90 | ArrayResize(Component[1].Value,Data.Bars); 91 | Component[1].FirstBar=firstBar; 92 | 93 | ArrayResize(Component[2].Value,Data.Bars); 94 | Component[2].FirstBar=firstBar; 95 | 96 | if(SlotType==SlotTypes_OpenFilter) 97 | { 98 | Component[1].DataType = IndComponentType_AllowOpenLong; 99 | Component[1].CompName = "Is long entry allowed"; 100 | Component[2].DataType = IndComponentType_AllowOpenShort; 101 | Component[2].CompName = "Is short entry allowed"; 102 | } 103 | else if(SlotType==SlotTypes_CloseFilter) 104 | { 105 | Component[1].DataType = IndComponentType_ForceCloseLong; 106 | Component[1].CompName = "Close out long position"; 107 | Component[2].DataType = IndComponentType_ForceCloseShort; 108 | Component[2].CompName = "Close out short position"; 109 | } 110 | 111 | IndicatorLogic indLogic=IndicatorLogic_It_does_not_act_as_a_filter; 112 | 113 | if(ListParam[0].Text=="AD rises") 114 | indLogic=IndicatorLogic_The_indicator_rises; 115 | else if(ListParam[0].Text=="AD falls") 116 | indLogic=IndicatorLogic_The_indicator_falls; 117 | else if(ListParam[0].Text=="AD changes its direction upward") 118 | indLogic=IndicatorLogic_The_indicator_changes_its_direction_upward; 119 | else if(ListParam[0].Text=="AD changes its direction downward") 120 | indLogic=IndicatorLogic_The_indicator_changes_its_direction_downward; 121 | 122 | OscillatorLogic(firstBar,previous,accumulationDistribution,0,0,Component[1],Component[2],indLogic); 123 | } 124 | //+------------------------------------------------------------------+ 125 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/BarClosing.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class BarClosing : public Indicator 35 | { 36 | public: 37 | BarClosing(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void BarClosing::BarClosing(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Bar Closing"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_AtBarClosing; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void BarClosing::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | Component[0].CompName = "Close Price"; 62 | Component[0].DataType = (SlotType == SlotTypes_Open) ? IndComponentType_OpenPrice : IndComponentType_ClosePrice; 63 | Component[0].FirstBar = 2; 64 | ArrayResize(Component[0].Value,Data.Bars); 65 | ArrayCopy(Component[0].Value,Data.Close); 66 | } 67 | //+------------------------------------------------------------------+ 68 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/BarOpening.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class BarOpening : public Indicator 35 | { 36 | public: 37 | BarOpening(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void BarOpening::BarOpening(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Bar Opening"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_AtBarOpening; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void BarOpening::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | ArrayResize(Component[0].Value,Data.Bars); 62 | Component[0].CompName = "Opening price of the bar"; 63 | Component[0].DataType = IndComponentType_OpenPrice; 64 | Component[0].FirstBar = 2; 65 | ArrayCopy(Component[0].Value,Data.Open); 66 | } 67 | //+------------------------------------------------------------------+ 68 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/BarRange.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class BarRange : public Indicator 35 | { 36 | public: 37 | BarRange(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void BarRange::BarRange(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Bar Range"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = true; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void BarRange::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | int period=(int) NumParam[0].Value; 62 | double level=NumParam[1].Value; 63 | int previous=CheckParam[0].Checked ? 1 : 0; 64 | int firstBar=period + previous + 2; 65 | 66 | double range[]; ArrayResize(range,Data.Bars); ArrayInitialize(range,0); 67 | 68 | for(int bar=firstBar; barmaxHigh) 75 | maxHigh=Data.High[bar-i]; 76 | if(Data.Low[bar-i] 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class BullsPower : public Indicator 35 | { 36 | public: 37 | BullsPower(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void BullsPower::BullsPower(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Bulls Power"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = true; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void BullsPower::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | MAMethod maMethod=(MAMethod) ListParam[1].Index; 62 | int period=(int) NumParam[0].Value; 63 | double level=NumParam[1].Value; 64 | int previous=CheckParam[0].Checked ? 1 : 0; 65 | 66 | int firstBar=period+previous+2; 67 | double ma[]; MovingAverage(period,0,maMethod,Data.Close,ma); 68 | double bulls[]; ArrayResize(bulls,Data.Bars); ArrayInitialize(bulls,0); 69 | 70 | for(int bar=period; bar 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class CloseAndReverse : public Indicator 35 | { 36 | public: 37 | CloseAndReverse(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void CloseAndReverse::CloseAndReverse(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Close and Reverse"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_CloseAndReverse; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void CloseAndReverse::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | } 61 | //+------------------------------------------------------------------+ 62 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/CumulativeSum.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class CumulativeSum : public Indicator 35 | { 36 | public: 37 | CumulativeSum(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void CumulativeSum::CumulativeSum(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Cumulative Sum"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = true; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void CumulativeSum::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | MAMethod maMethod=(MAMethod) ListParam[1].Index; 62 | BasePrice basePrice=(BasePrice) ListParam[2].Index; 63 | int period=(int) NumParam[0].Value; 64 | int smoothing=(int) NumParam[1].Value; 65 | int previous=CheckParam[0].Checked ? 1 : 0; 66 | 67 | int firstBar=period+smoothing+previous+2; 68 | 69 | double price[]; Price(basePrice,price); 70 | double cumulativeSum[]; ArrayResize(cumulativeSum,Data.Bars); ArrayInitialize(cumulativeSum,0); 71 | 72 | cumulativeSum[period-1]=0; 73 | 74 | for(int bar=0; bar 30 | #include 31 | #include 32 | //+------------------------------------------------------------------+ 33 | //| | 34 | //+------------------------------------------------------------------+ 35 | class DayClosing : public Indicator 36 | { 37 | int m_fridayCloseHour; 38 | public: 39 | DayClosing(SlotTypes slotType); 40 | virtual void Calculate(DataSet &dataSet); 41 | }; 42 | //+------------------------------------------------------------------+ 43 | //| | 44 | //+------------------------------------------------------------------+ 45 | void DayClosing::DayClosing(SlotTypes slotType) 46 | { 47 | SlotType = slotType; 48 | IndicatorName = "Day Closing"; 49 | WarningMessage = ""; 50 | IsAllowLTF = true; 51 | ExecTime = ExecutionTime_AtBarClosing; 52 | IsSeparateChart = false; 53 | IsDiscreteValues = false; 54 | IsDefaultGroupAll = false; 55 | m_fridayCloseHour = -1; 56 | } 57 | //+------------------------------------------------------------------+ 58 | //| | 59 | //+------------------------------------------------------------------+ 60 | void DayClosing::Calculate(DataSet &dataSet) 61 | { 62 | Data=GetPointer(dataSet); 63 | 64 | if(m_fridayCloseHour==-1) 65 | m_fridayCloseHour=GetFridayCloseHour(); 66 | 67 | double closePrice[]; ArrayResize(closePrice,Data.Bars); ArrayInitialize(closePrice,0); 68 | 69 | for(int bar=1; barcloseTime; 91 | } 92 | else 93 | { 94 | datetime closeTime=dayOpenTime+23*3600+59*60; 95 | isTimeToClose=Data.ServerTime>closeTime; 96 | } 97 | 98 | if(isTimeToClose) 99 | closePrice[Data.Bars-1]=Data.Close[Data.Bars-1]; 100 | 101 | Component[0].CompName = "Closing price of the day"; 102 | Component[0].DataType = IndComponentType_ClosePrice; 103 | Component[0].FirstBar = 2; 104 | ArrayResize(Component[0].Value,Data.Bars); 105 | ArrayCopy(Component[0].Value,closePrice); 106 | } 107 | //+------------------------------------------------------------------+ 108 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/DayClosing2.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class DayClosing2 : public Indicator 35 | { 36 | public: 37 | DayClosing2(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void DayClosing2::DayClosing2(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Day Closing 2"; 47 | IsAllowLTF = true; 48 | ExecTime = ExecutionTime_DuringTheBar; 49 | IsSeparateChart = false; 50 | IsDiscreteValues = false; 51 | IsDefaultGroupAll = false; 52 | } 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void DayClosing2::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | 60 | int dayClosingHour = (int) NumParam[0].Value; 61 | int dayClosingMin = (int) NumParam[1].Value; 62 | int fridayClosingHour = (int) NumParam[2].Value; 63 | int fridayClosingMin = (int) NumParam[3].Value; 64 | 65 | double closePrice[]; ArrayResize(closePrice,Data.Bars); ArrayInitialize(closePrice,0); 66 | 67 | for(int bar=1; bar=closeTime) 88 | { 89 | closePrice[Data.Bars-1]=Data.Close[Data.Bars-1]; 90 | allowOpenLong[Data.Bars-1]=0; // Prevent long entries after the closing time 91 | allowOpenShort[Data.Bars-1]=0; // Prevent short entries after the closing time 92 | } 93 | 94 | Component[0].CompName = "Closing price of the day"; 95 | Component[0].DataType = IndComponentType_ClosePrice; 96 | Component[0].FirstBar = 2; 97 | ArrayResize(Component[0].Value,Data.Bars); 98 | ArrayCopy(Component[0].Value,closePrice); 99 | 100 | Component[1].DataType = IndComponentType_AllowOpenLong; 101 | Component[1].CompName = "Is long entry allowed"; 102 | Component[1].ShowInDynInfo = false; 103 | Component[1].FirstBar = 2; 104 | ArrayResize(Component[1].Value,Data.Bars); 105 | ArrayCopy(Component[1].Value,allowOpenLong); 106 | 107 | Component[2].DataType = IndComponentType_AllowOpenShort; 108 | Component[2].CompName = "Is short entry allowed"; 109 | Component[2].ShowInDynInfo = false; 110 | Component[2].FirstBar = 2; 111 | ArrayResize(Component[2].Value,Data.Bars); 112 | ArrayCopy(Component[2].Value,allowOpenShort); 113 | } 114 | //+------------------------------------------------------------------+ 115 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/DayOpening.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.00" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class DayOpening : public Indicator 35 | { 36 | public: 37 | DayOpening(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void DayOpening::DayOpening(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Day Opening"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_AtBarOpening; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void DayOpening::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | double openPrice[]; ArrayResize(openPrice,Data.Bars); ArrayInitialize(openPrice,0); 62 | 63 | for(int bar=1; bar 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class DaysOfWeek : public Indicator 35 | { 36 | public: 37 | DaysOfWeek(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void DaysOfWeek::DaysOfWeek(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Day of Week"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = true; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void DaysOfWeek::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | int dowFromDay = ListParam[1].Index; 62 | int dowUntilDay = ListParam[2].Index; 63 | 64 | const int firstBar=1; 65 | double signal[]; ArrayResize(signal,Data.Bars); ArrayInitialize(signal,0); 66 | 67 | for(int bar=firstBar; bar=dowFromDay && timedowUntilDay) 75 | signal[bar]=(time>=dowFromDay || time 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class EnterOnce : public Indicator 35 | { 36 | public: 37 | EnterOnce(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void EnterOnce::EnterOnce(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Enter Once"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = true; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void EnterOnce::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | } 61 | //+------------------------------------------------------------------+ 62 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/EntryHour.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.00" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class EntryHour : public Indicator 35 | { 36 | public: 37 | EntryHour(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void EntryHour::EntryHour(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Entry Hour"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = true; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void EntryHour::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | int entryHour = (int) NumParam[0].Value; 62 | int entryMinute = (int) NumParam[1].Value; 63 | 64 | const int firstBar=2; 65 | double adBars[]; ArrayResize(adBars,Data.Bars);ArrayInitialize(adBars,0); 66 | 67 | for(int bar=firstBar; bar 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class EntryTime : public Indicator 35 | { 36 | public: 37 | EntryTime(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void EntryTime::EntryTime(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Entry Time"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = true; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void EntryTime::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | int fromHour = (int) NumParam[0].Value; 62 | int fromMin = (int) NumParam[1].Value; 63 | int untilHour = (int) NumParam[2].Value; 64 | int untilMin = (int) NumParam[3].Value; 65 | 66 | const int firstBar=2; 67 | double adBars[]; ArrayResize(adBars,Data.Bars);ArrayInitialize(adBars,0); 68 | 69 | int fromTime = fromHour*3600+fromMin*60; 70 | int untilTime = untilHour*3600+untilMin*60; 71 | 72 | for(int bar=firstBar; bar=fromTime && barTimeuntilTime) 80 | adBars[bar]=barTime>=fromTime || barTime 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class ExitHour : public Indicator 35 | { 36 | public: 37 | ExitHour(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void ExitHour::ExitHour(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Exit Hour"; 47 | WarningMessage = "Exit Hour indicator works properly on 4H and lower time frame."+"\n"+ 48 | "It sends close signal when bar closes at the specified hour."; 49 | IsAllowLTF = true; 50 | ExecTime = ExecutionTime_DuringTheBar; 51 | IsSeparateChart = false; 52 | IsDiscreteValues = false; 53 | IsDefaultGroupAll = false; 54 | } 55 | //+------------------------------------------------------------------+ 56 | //| | 57 | //+------------------------------------------------------------------+ 58 | void ExitHour::Calculate(DataSet &dataSet) 59 | { 60 | Data=GetPointer(dataSet); 61 | 62 | int exitHour=(int) NumParam[0].Value; 63 | 64 | const int firstBar=2; 65 | double adBars[]; 66 | ArrayResize(adBars,Data.Bars); 67 | ArrayInitialize(adBars,0); 68 | 69 | for(int bar=firstBar; bar=exitHour) 75 | adBars[bar-1]=Data.Close[bar-1]; 76 | else if(mqlTime1.day_of_year!=mqlTime0.day_of_year && mqlTime1.hour 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class ForceIndex : public Indicator 35 | { 36 | public: 37 | ForceIndex(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void ForceIndex::ForceIndex(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Force Index"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = true; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void ForceIndex::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | MAMethod maMethod=(MAMethod) ListParam[1].Index; 62 | BasePrice basePrice=(BasePrice) ListParam[2].Index; 63 | int period=(int) NumParam[0].Value; 64 | int previous=CheckParam[0].Checked ? 1 : 0; 65 | 66 | int firstBar=period+previous+2; 67 | 68 | double price[];Price(basePrice,price); 69 | double ma[]; MovingAverage(period,0,maMethod,price,ma); 70 | double adFi[]; ArrayResize(adFi,Data.Bars); ArrayInitialize(adFi,0); 71 | 72 | for(int bar=firstBar; bar 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class InsideBar : public Indicator 35 | { 36 | public: 37 | InsideBar(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void InsideBar::InsideBar(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Inside Bar"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = false; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void InsideBar::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | const int firstBar=2; 62 | double insideBar[]; ArrayResize(insideBar,Data.Bars); ArrayInitialize(insideBar,0); 63 | 64 | for(int bar=2; barData.Low[bar-2])) ? 1 : 0; 67 | } 68 | 69 | Component[0].CompName = "Allow long entry"; 70 | Component[0].DataType = IndComponentType_AllowOpenLong; 71 | Component[0].FirstBar = firstBar; 72 | ArrayResize(Component[0].Value,Data.Bars); 73 | ArrayCopy(Component[0].Value,insideBar); 74 | 75 | Component[1].CompName = "Allow short entry"; 76 | Component[1].DataType = IndComponentType_AllowOpenShort; 77 | Component[1].FirstBar = firstBar; 78 | ArrayResize(Component[1].Value,Data.Bars); 79 | ArrayCopy(Component[1].Value,insideBar); 80 | } 81 | //+------------------------------------------------------------------+ 82 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/LongOrShort.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.00" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class LongOrShort : public Indicator 35 | { 36 | public: 37 | LongOrShort(SlotTypes slotType) 38 | { 39 | SlotType = slotType; 40 | IndicatorName = "Long or Short"; 41 | WarningMessage = ""; 42 | IsAllowLTF = true; 43 | ExecTime = ExecutionTime_DuringTheBar; 44 | IsSeparateChart = false; 45 | IsDiscreteValues = false; 46 | IsDefaultGroupAll = true; 47 | } 48 | 49 | virtual void Calculate(DataSet &dataSet); 50 | }; 51 | //+------------------------------------------------------------------+ 52 | //| | 53 | //+------------------------------------------------------------------+ 54 | void LongOrShort::Calculate(DataSet &dataSet) 55 | { 56 | Data=GetPointer(dataSet); 57 | 58 | ArrayResize(Component[0].Value,Data.Bars); 59 | Component[0].CompName = "Is long entry allowed"; 60 | Component[0].DataType = IndComponentType_AllowOpenLong; 61 | Component[0].FirstBar = 0; 62 | 63 | ArrayResize(Component[1].Value,Data.Bars); 64 | Component[1].CompName = "Is short entry allowed"; 65 | Component[1].DataType = IndComponentType_AllowOpenShort; 66 | Component[1].FirstBar = 0; 67 | 68 | if(ListParam[0].Text=="Open long positions only") 69 | { 70 | ArrayInitialize(Component[0].Value, 1); 71 | ArrayInitialize(Component[1].Value, 0); 72 | } 73 | else if(ListParam[0].Text=="Open short positions only") 74 | { 75 | ArrayInitialize(Component[0].Value, 0); 76 | ArrayInitialize(Component[1].Value, 1); 77 | } 78 | } 79 | //+------------------------------------------------------------------+ 80 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/MarketFacilitationIndex.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class MarketFacilitationIndex : public Indicator 35 | { 36 | public: 37 | MarketFacilitationIndex(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void MarketFacilitationIndex::MarketFacilitationIndex(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Market Facilitation Index"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = true; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void MarketFacilitationIndex::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | int previous=CheckParam[0].Checked ? 1 : 0; 62 | double mfi[]; ArrayResize(mfi,Data.Bars) ;ArrayInitialize(mfi,0); 63 | const int firstBar=5; 64 | 65 | for(int bar=0; bar0) 68 | mfi[bar]=10000*(Data.High[bar]-Data.Low[bar])/Data.Volume[bar]; 69 | else 70 | mfi[bar]=10000*(Data.High[bar]-Data.Low[bar]); 71 | } 72 | 73 | ArrayResize(Component[0].Value,Data.Bars); 74 | Component[0].CompName = "Market Facilitation Index"; 75 | Component[0].DataType = IndComponentType_IndicatorValue; 76 | Component[0].FirstBar = firstBar; 77 | ArrayCopy(Component[0].Value,mfi); 78 | 79 | ArrayResize(Component[1].Value,Data.Bars); 80 | Component[1].FirstBar=firstBar; 81 | 82 | ArrayResize(Component[2].Value,Data.Bars); 83 | Component[2].FirstBar=firstBar; 84 | 85 | if(SlotType==SlotTypes_OpenFilter) 86 | { 87 | Component[1].DataType = IndComponentType_AllowOpenLong; 88 | Component[1].CompName = "Is long entry allowed"; 89 | Component[2].DataType = IndComponentType_AllowOpenShort; 90 | Component[2].CompName = "Is short entry allowed"; 91 | } 92 | else if(SlotType==SlotTypes_CloseFilter) 93 | { 94 | Component[1].DataType = IndComponentType_ForceCloseLong; 95 | Component[1].CompName = "Close out long position"; 96 | Component[2].DataType = IndComponentType_ForceCloseShort; 97 | Component[2].CompName = "Close out short position"; 98 | } 99 | 100 | IndicatorLogic indLogic=IndicatorLogic_It_does_not_act_as_a_filter; 101 | 102 | if(ListParam[0].Text=="Market Facilitation Index rises") 103 | indLogic=IndicatorLogic_The_indicator_rises; 104 | else if(ListParam[0].Text=="Market Facilitation Index falls") 105 | indLogic=IndicatorLogic_The_indicator_falls; 106 | else if(ListParam[0].Text=="Market Facilitation Index changes its direction upward") 107 | indLogic=IndicatorLogic_The_indicator_changes_its_direction_upward; 108 | else if(ListParam[0].Text=="Market Facilitation Index changes its direction downward") 109 | indLogic=IndicatorLogic_The_indicator_changes_its_direction_downward; 110 | 111 | NoDirectionOscillatorLogic(firstBar,previous,mfi,0,Component[1],indLogic); 112 | ArrayCopy(Component[2].Value,Component[1].Value); 113 | } 114 | //+------------------------------------------------------------------+ 115 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/MoneyFlow.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class MoneyFlow : public Indicator 35 | { 36 | public: 37 | MoneyFlow(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void MoneyFlow::MoneyFlow(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Money Flow"; 47 | WarningMessage = ""; 48 | IsAllowLTF = true; 49 | ExecTime = ExecutionTime_DuringTheBar; 50 | IsSeparateChart = true; 51 | IsDiscreteValues = false; 52 | IsDefaultGroupAll = false; 53 | } 54 | //+------------------------------------------------------------------+ 55 | //| | 56 | //+------------------------------------------------------------------+ 57 | void MoneyFlow::Calculate(DataSet &dataSet) 58 | { 59 | Data=GetPointer(dataSet); 60 | 61 | int previous=CheckParam[0].Checked ? 1 : 0; 62 | 63 | const int firstBar=previous+2; 64 | double adMf[]; ArrayResize(adMf,Data.Bars);ArrayInitialize(adMf,0); 65 | 66 | for(int bar=1; bardAvg1) 71 | adMf[bar]=adMf[bar-1]+dAvg*Data.Volume[bar]/1000; 72 | else if(dAvg 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class MovingAveragesCrossover : public Indicator 35 | { 36 | public: 37 | MovingAveragesCrossover(SlotTypes slotType) 38 | { 39 | SlotType=slotType; 40 | 41 | IndicatorName="Moving Averages Crossover"; 42 | 43 | WarningMessage = ""; 44 | IsAllowLTF = true; 45 | ExecTime = ExecutionTime_DuringTheBar; 46 | IsSeparateChart = false; 47 | IsDiscreteValues = false; 48 | IsDefaultGroupAll = false; 49 | } 50 | 51 | virtual void Calculate(DataSet &dataSet); 52 | }; 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void MovingAveragesCrossover::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | 60 | BasePrice basePrice=(BasePrice) ListParam[1].Index; 61 | MAMethod fastMAMethod = (MAMethod) ListParam[3].Index; 62 | MAMethod slowMAMethod = (MAMethod) ListParam[4].Index; 63 | int iNFastMA = (int) NumParam[0].Value; 64 | int iNSlowMA = (int) NumParam[1].Value; 65 | int iSFastMA = (int) NumParam[2].Value; 66 | int iSSlowMA = (int) NumParam[3].Value; 67 | int previous=CheckParam[0].Checked ? 1 : 0; 68 | 69 | int firstBar=MathMax(iNFastMA+iSFastMA,iNSlowMA+iSSlowMA)+previous+2; 70 | double price[]; Price(basePrice,price); 71 | double maFast[]; MovingAverage(iNFastMA,iSFastMA,fastMAMethod,price,maFast); 72 | double maSlow[]; MovingAverage(iNSlowMA,iSSlowMA,slowMAMethod,price,maSlow); 73 | double oscillator[]; ArrayResize(oscillator,Data.Bars); ArrayInitialize(oscillator,0); 74 | 75 | for(int bar=firstBar; bar 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class NBarsExit : public Indicator 35 | { 36 | public: 37 | NBarsExit(SlotTypes slotType) 38 | { 39 | SlotType=slotType; 40 | 41 | IndicatorName="N Bars Exit"; 42 | 43 | WarningMessage = ""; 44 | IsAllowLTF = true; 45 | ExecTime = ExecutionTime_AtBarClosing; 46 | IsSeparateChart = false; 47 | IsDiscreteValues = false; 48 | IsDefaultGroupAll = false; 49 | } 50 | 51 | virtual void Calculate(DataSet &dataSet); 52 | }; 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void NBarsExit::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | int nExit=(int) NumParam[0].Value; 60 | 61 | // Saving the components 62 | ArrayResize(Component[0].Value,Data.Bars); 63 | ArrayInitialize(Component[0].Value,0); 64 | Component[0].CompName = "N Bars Exit"; 65 | Component[0].DataType = IndComponentType_ForceClose; 66 | Component[0].ShowInDynInfo=true; 67 | Component[0].FirstBar=1; 68 | } 69 | //+------------------------------------------------------------------+ 70 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/NarrowRange.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | 32 | class NarrowRange : public Indicator 33 | { 34 | public: 35 | NarrowRange(SlotTypes slotType) 36 | { 37 | SlotType = slotType; 38 | 39 | IndicatorName = "Narrow Range"; 40 | 41 | WarningMessage = ""; 42 | IsAllowLTF = true; 43 | ExecTime = ExecutionTime_DuringTheBar; 44 | IsSeparateChart = true; 45 | IsDiscreteValues = false; 46 | IsDefaultGroupAll = false; 47 | } 48 | 49 | virtual void Calculate(DataSet &dataSet); 50 | }; 51 | 52 | void NarrowRange::Calculate(DataSet &dataSet) 53 | { 54 | Data = GetPointer(dataSet); 55 | 56 | int previous = CheckParam[0].Checked ? 1 : 0; 57 | 58 | // Calculation 59 | int stepBack = (ListParam[0].Text == "There is a NR4 formation" ? 3 : 6); 60 | int firstBar = stepBack + previous; 61 | double adNr[]; ArrayResize(adNr, Data.Bars); ArrayInitialize(adNr,0); 62 | double adRange[]; ArrayResize(adRange, Data.Bars); ArrayInitialize(adRange,0); 63 | 64 | for (int bar = 0; bar < Data.Bars; bar++) 65 | { 66 | adRange[bar] = Data.High[bar] - Data.Low[bar]; 67 | adNr[bar] = 0; 68 | } 69 | 70 | // Calculation of the logic 71 | for (int bar = firstBar; bar < Data.Bars; bar++) 72 | { 73 | bool isNarrowRange = true; 74 | for (int i = 1; i <= stepBack; i++) 75 | { if (adRange[bar - i - previous] <= adRange[bar - previous]) 76 | isNarrowRange = false; 77 | } 78 | if (isNarrowRange) 79 | adNr[bar] = 1; 80 | } 81 | 82 | // Saving the components 83 | ArrayResize(Component[0].Value, Data.Bars); 84 | Component[0].CompName = "Bar Range"; 85 | Component[0].DataType = IndComponentType_IndicatorValue; 86 | Component[0].FirstBar = firstBar; 87 | for (int i = 0; i < Data.Bars; i++) 88 | Component[0].Value[i] = MathRound(adRange[i]/Data.Point); 89 | 90 | ArrayResize(Component[1].Value, Data.Bars); 91 | Component[1].CompName = "Allow long entry"; 92 | Component[1].DataType = IndComponentType_AllowOpenLong; 93 | Component[1].FirstBar = firstBar; 94 | ArrayCopy(Component[1].Value, adNr); 95 | 96 | ArrayResize(Component[2].Value, Data.Bars); 97 | Component[2].CompName = "Allow short entry"; 98 | Component[2].DataType = IndComponentType_AllowOpenShort; 99 | Component[2].FirstBar = firstBar; 100 | ArrayCopy(Component[2].Value, adNr); 101 | } 102 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/OnBalanceVolume.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class OnBalanceVolume : public Indicator 35 | { 36 | public: 37 | OnBalanceVolume(SlotTypes slotType) 38 | { 39 | SlotType=slotType; 40 | 41 | IndicatorName="On Balance Volume"; 42 | 43 | WarningMessage = ""; 44 | IsAllowLTF = true; 45 | ExecTime = ExecutionTime_DuringTheBar; 46 | IsSeparateChart = true; 47 | IsDiscreteValues = false; 48 | IsDefaultGroupAll = false; 49 | } 50 | 51 | virtual void Calculate(DataSet &dataSet); 52 | }; 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void OnBalanceVolume::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | 60 | int previous=CheckParam[0].Checked ? 1 : 0; 61 | 62 | double adOBV[]; 63 | ArrayResize(adOBV,Data.Bars); 64 | ArrayInitialize(adOBV,0); 65 | 66 | const int firstBar=5; 67 | 68 | adOBV[0]=(int)Data.Volume[0]; 69 | 70 | for(int bar=1; barData.Close[bar-1]) 73 | adOBV[bar]=adOBV[bar-1]+Data.Volume[bar]; 74 | else if(Data.Close[bar] 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class ParabolicSAR : public Indicator 35 | { 36 | public: 37 | ParabolicSAR(SlotTypes slotType) 38 | { 39 | SlotType=slotType; 40 | 41 | IndicatorName="Parabolic SAR"; 42 | 43 | WarningMessage = ""; 44 | IsAllowLTF = true; 45 | ExecTime = ExecutionTime_DuringTheBar; 46 | IsSeparateChart = false; 47 | IsDiscreteValues = false; 48 | IsDefaultGroupAll = false; 49 | } 50 | 51 | virtual void Calculate(DataSet &dataSet); 52 | }; 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void ParabolicSAR::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | 60 | double dAfMin = NumParam[0].Value; 61 | double dAfInc = NumParam[1].Value; 62 | double dAfMax = NumParam[2].Value; 63 | 64 | // Reading the parameters 65 | double dPExtr; 66 | double dPsarNew=0; 67 | int aiDir[]; ArrayResize(aiDir,Data.Bars); ArrayInitialize(aiDir,0); 68 | double adPsar[]; ArrayResize(adPsar,Data.Bars); ArrayInitialize(adPsar,0); 69 | 70 | //---- Calculating the initial values 71 | adPsar[0]=0; 72 | double dAf=dAfMin; 73 | int intDirNew=0; 74 | if(Data.Close[1]>Data.Open[0]) 75 | { 76 | aiDir[0] = 1; 77 | aiDir[1] = 1; 78 | dPExtr=MathMax(Data.High[0],Data.High[1]); 79 | adPsar[1]=MathMin(Data.Low[0],Data.Low[1]); 80 | } 81 | else 82 | { 83 | aiDir[0] = -1; 84 | aiDir[1] = -1; 85 | dPExtr=MathMin(Data.Low[0],Data.Low[1]); 86 | adPsar[1]=MathMax(Data.High[0],Data.High[1]); 87 | } 88 | 89 | for(int bar=2; bar0 && adPsar[bar]>MathMin(Data.Low[bar-1],Data.Low[bar-2])) 107 | adPsar[bar]=MathMin(Data.Low[bar-1],Data.Low[bar-2]); 108 | else if(aiDir[bar]<0 && adPsar[bar]0 && Data.High[bar]>dPExtr) 116 | { 117 | dPExtr=Data.High[bar]; 118 | dAf=MathMin(dAf+dAfInc,dAfMax); 119 | } 120 | 121 | if(aiDir[bar]<0 && Data.Low[bar]0 ? Data.High[bar]: Data.Low[bar]; 134 | } 135 | } 136 | const int firstBar=8; 137 | 138 | // Saving the components 139 | ArrayResize(Component[0].Value,Data.Bars); 140 | Component[0].CompName = "PSAR value"; 141 | Component[0].DataType = SlotType == SlotTypes_Close ? IndComponentType_ClosePrice : IndComponentType_IndicatorValue; 142 | Component[0].FirstBar = firstBar; 143 | Component[0].PosPriceDependence=PositionPriceDependence_BuyHigherSellLower; 144 | ArrayCopy(Component[0].Value,adPsar); 145 | } 146 | //+------------------------------------------------------------------+ 147 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/PercentChange.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class PercentChange : public Indicator 35 | { 36 | public: 37 | PercentChange(SlotTypes slotType) 38 | { 39 | SlotType=slotType; 40 | 41 | IndicatorName="Percent Change"; 42 | 43 | WarningMessage = ""; 44 | IsAllowLTF = true; 45 | ExecTime = ExecutionTime_DuringTheBar; 46 | IsSeparateChart = true; 47 | IsDiscreteValues = false; 48 | IsDefaultGroupAll = false; 49 | } 50 | 51 | virtual void Calculate(DataSet &dataSet); 52 | }; 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void PercentChange::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | 60 | // Reading the parameters 61 | BasePrice basePrice=(BasePrice) ListParam[1].Index; 62 | int period=(int) NumParam[0].Value; 63 | double level=NumParam[1].Value; 64 | int previous=CheckParam[0].Checked ? 1 : 0; 65 | 66 | // Calculation 67 | int firstBar=period + previous + 2; 68 | double price[]; Price(basePrice,price); 69 | double percentChange[]; ArrayResize(percentChange,Data.Bars); ArrayInitialize(percentChange,0); 70 | 71 | for(int i=period; i 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class PriceMove : public Indicator 35 | { 36 | public: 37 | PriceMove(SlotTypes slotType) 38 | { 39 | SlotType=slotType; 40 | 41 | IndicatorName="Price Move"; 42 | 43 | WarningMessage = ""; 44 | IsAllowLTF = true; 45 | ExecTime = ExecutionTime_DuringTheBar; 46 | IsSeparateChart = false; 47 | IsDiscreteValues = false; 48 | IsDefaultGroupAll = false; 49 | } 50 | 51 | virtual void Calculate(DataSet &dataSet); 52 | }; 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void PriceMove::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | 60 | // Reading the parameters 61 | BasePrice price=(BasePrice) ListParam[1].Index; 62 | double margin=NumParam[0].Value*Data.Point; 63 | int previous=CheckParam[0].Checked ? 1 : 0; 64 | 65 | // TimeExecution 66 | if(price==BasePrice_Open && MathAbs(margin-0) 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class RossHook : public Indicator 35 | { 36 | public: 37 | RossHook(SlotTypes slotType) 38 | { 39 | SlotType=slotType; 40 | 41 | IndicatorName="Ross Hook"; 42 | 43 | WarningMessage = ""; 44 | IsAllowLTF = true; 45 | ExecTime = ExecutionTime_DuringTheBar; 46 | IsSeparateChart = false; 47 | IsDiscreteValues = false; 48 | IsDefaultGroupAll = false; 49 | } 50 | 51 | virtual void Calculate(DataSet &dataSet); 52 | }; 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void RossHook::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | 60 | double adRhUp[]; ArrayResize(adRhUp,Data.Bars); ArrayInitialize(adRhUp,0); 61 | double adRhDn[]; ArrayResize(adRhDn,Data.Bars); ArrayInitialize(adRhDn,0); 62 | 63 | for(int bar=5; barData.Low[bar-1]) 70 | if(Data.Low[bar-3]>Data.Low[bar-1] && Data.Low[bar-2]>Data.Low[bar-1]) 71 | adRhDn[bar+1]=Data.Low[bar-1]; 72 | } 73 | 74 | // Is visible 75 | for(int bar=5; bar0 && MathAbs(adRhUp[bar]-0)0 && MathAbs(adRhDn[bar]-0)adRhDn[bar-1]) 80 | adRhDn[bar]=adRhDn[bar-1]; 81 | } 82 | 83 | // Saving the components 84 | 85 | ArrayResize(Component[0].Value,Data.Bars); 86 | Component[0].FirstBar=5; 87 | ArrayCopy(Component[0].Value,adRhUp); 88 | 89 | ArrayResize(Component[1].Value,Data.Bars); 90 | Component[1].FirstBar=5; 91 | ArrayCopy(Component[1].Value,adRhDn); 92 | 93 | // Sets the Component's type 94 | if(SlotType==SlotTypes_Open) 95 | { 96 | if(ListParam[0].Text=="Enter long at Up Ross hook") 97 | { 98 | Component[0].DataType = IndComponentType_OpenLongPrice; 99 | Component[1].DataType = IndComponentType_OpenShortPrice; 100 | } 101 | else 102 | { 103 | Component[0].DataType = IndComponentType_OpenShortPrice; 104 | Component[1].DataType = IndComponentType_OpenLongPrice; 105 | } 106 | Component[0].CompName = "Up Ross hook"; 107 | Component[1].CompName = "Down Ross hook"; 108 | } 109 | else if(SlotType==SlotTypes_Close) 110 | { 111 | if(ListParam[0].Text=="Exit long at Up Ross hook") 112 | { 113 | Component[0].DataType = IndComponentType_CloseLongPrice; 114 | Component[1].DataType = IndComponentType_CloseShortPrice; 115 | } 116 | else 117 | { 118 | Component[0].DataType = IndComponentType_CloseShortPrice; 119 | Component[1].DataType = IndComponentType_CloseLongPrice; 120 | } 121 | Component[0].CompName = "Up Ross hook"; 122 | Component[1].CompName = "Down Ross hook"; 123 | } 124 | } 125 | //+------------------------------------------------------------------+ 126 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/RoundNumber.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class RoundNumber : public Indicator 35 | { 36 | public: 37 | RoundNumber(SlotTypes slotType) 38 | { 39 | SlotType=slotType; 40 | 41 | IndicatorName="Round Number"; 42 | 43 | WarningMessage = ""; 44 | IsAllowLTF = true; 45 | ExecTime = ExecutionTime_DuringTheBar; 46 | IsSeparateChart = false; 47 | IsDiscreteValues = false; 48 | IsDefaultGroupAll = false; 49 | } 50 | 51 | virtual void Calculate(DataSet &dataSet); 52 | }; 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void RoundNumber::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | 60 | // Reading the parameters 61 | double shift=NumParam[0].Value*Data.Point; 62 | int digids=(int) NumParam[1].Value; 63 | 64 | // Calculation 65 | double upperRn[]; ArrayResize(upperRn,Data.Bars); ArrayInitialize(upperRn,0); 66 | double lowerRn[]; ArrayResize(lowerRn,Data.Bars); ArrayInitialize(lowerRn,0); 67 | 68 | const int firstBar=2; 69 | 70 | for(int bar=1; bar= 0) 76 | dNearestRound=NormalizeDouble(Data.Open[bar],iCutDigids); 77 | else 78 | dNearestRound=MathRound(Data.Open[bar]*MathPow(10,iCutDigids))/MathPow(10,iCutDigids); 79 | 80 | if(dNearestRound 30 | #include 31 | 32 | class StopLimit : public Indicator 33 | { 34 | public: 35 | StopLimit(SlotTypes slotType) 36 | { 37 | SlotType = slotType; 38 | 39 | IndicatorName = "Stop Limit"; 40 | 41 | WarningMessage = ""; 42 | IsAllowLTF = true; 43 | ExecTime = ExecutionTime_DuringTheBar; 44 | IsSeparateChart = false; 45 | IsDiscreteValues = false; 46 | IsDefaultGroupAll = false; 47 | } 48 | 49 | virtual void Calculate(DataSet &dataSet); 50 | }; 51 | 52 | void StopLimit::Calculate(DataSet &dataSet) 53 | { 54 | Data = GetPointer(dataSet); 55 | } 56 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/StopLoss.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | 32 | class StopLoss : public Indicator 33 | { 34 | public: 35 | StopLoss(SlotTypes slotType) 36 | { 37 | SlotType = slotType; 38 | 39 | IndicatorName = "Stop Loss"; 40 | 41 | WarningMessage = ""; 42 | IsAllowLTF = true; 43 | ExecTime = ExecutionTime_DuringTheBar; 44 | IsSeparateChart = false; 45 | IsDiscreteValues = false; 46 | IsDefaultGroupAll = false; 47 | } 48 | 49 | virtual void Calculate(DataSet &dataSet); 50 | }; 51 | 52 | void StopLoss::Calculate(DataSet &dataSet) 53 | { 54 | Data = GetPointer(dataSet); 55 | } 56 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/TakeProfit.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | 32 | class TakeProfit : public Indicator 33 | { 34 | public: 35 | TakeProfit(SlotTypes slotType) 36 | { 37 | SlotType = slotType; 38 | 39 | IndicatorName = "Take Profit"; 40 | 41 | WarningMessage = ""; 42 | IsAllowLTF = true; 43 | ExecTime = ExecutionTime_DuringTheBar; 44 | IsSeparateChart = false; 45 | IsDiscreteValues = false; 46 | IsDefaultGroupAll = false; 47 | } 48 | 49 | virtual void Calculate(DataSet &dataSet); 50 | }; 51 | 52 | void TakeProfit::Calculate(DataSet &dataSet) 53 | { 54 | Data = GetPointer(dataSet); 55 | } 56 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/TrailingStop.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class TrailingStop : public Indicator 35 | { 36 | public: 37 | TrailingStop(SlotTypes slotType) 38 | { 39 | SlotType=slotType; 40 | 41 | IndicatorName="Trailing Stop"; 42 | 43 | IsAllowLTF = true; 44 | ExecTime = ExecutionTime_DuringTheBar; 45 | IsSeparateChart = false; 46 | IsDiscreteValues = false; 47 | IsDefaultGroupAll = false; 48 | } 49 | 50 | virtual void Calculate(DataSet &dataSet); 51 | }; 52 | //+------------------------------------------------------------------+ 53 | //| | 54 | //+------------------------------------------------------------------+ 55 | void TrailingStop::Calculate(DataSet &dataSet) 56 | { 57 | Data=GetPointer(dataSet); 58 | 59 | // Saving the components 60 | ArrayResize(Component[0].Value,Data.Bars); 61 | ArrayInitialize(Component[0].Value,0); 62 | Component[0].CompName = "Trailing Stop for the transferred position"; 63 | Component[0].DataType = IndComponentType_Other; 64 | Component[0].ShowInDynInfo=false; 65 | Component[0].FirstBar=2; 66 | } 67 | //+------------------------------------------------------------------+ 68 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/TrailingStopLimit.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.1" 27 | #property strict 28 | 29 | #include 30 | #include 31 | 32 | class TrailingStopLimit : public Indicator 33 | { 34 | public: 35 | TrailingStopLimit(SlotTypes slotType) 36 | { 37 | SlotType = slotType; 38 | IndicatorName = "Trailing Stop Limit"; 39 | IsAllowLTF = true; 40 | ExecTime = ExecutionTime_DuringTheBar; 41 | IsSeparateChart = false; 42 | IsDiscreteValues = false; 43 | IsDefaultGroupAll = false; 44 | } 45 | 46 | virtual void Calculate(DataSet &dataSet); 47 | }; 48 | 49 | void TrailingStopLimit::Calculate(DataSet &dataSet) 50 | { 51 | Data = GetPointer(dataSet); 52 | 53 | // Saving the components 54 | ArrayResize(Component[0].Value, Data.Bars); 55 | ArrayInitialize(Component[0].Value,0); 56 | Component[0].CompName = "Trailing Stop for a transferred position"; 57 | Component[0].DataType = IndComponentType_Other; 58 | Component[0].ShowInDynInfo = false; 59 | Component[0].FirstBar = 2; 60 | } 61 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/WeekClosing.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "3.0" 27 | #property strict 28 | 29 | #include 30 | #include 31 | #include 32 | //+------------------------------------------------------------------+ 33 | //| | 34 | //+------------------------------------------------------------------+ 35 | class WeekClosing : public Indicator 36 | { 37 | int m_fridayCloseHour; 38 | public: 39 | WeekClosing(SlotTypes slotType); 40 | virtual void Calculate(DataSet &dataSet); 41 | }; 42 | //+------------------------------------------------------------------+ 43 | //| | 44 | //+------------------------------------------------------------------+ 45 | void WeekClosing::WeekClosing(SlotTypes slotType) 46 | { 47 | SlotType = slotType; 48 | IndicatorName = "Week Closing"; 49 | WarningMessage = ""; 50 | IsAllowLTF = true; 51 | ExecTime = ExecutionTime_AtBarClosing; 52 | IsSeparateChart = false; 53 | IsDiscreteValues = false; 54 | IsDefaultGroupAll = false; 55 | m_fridayCloseHour = -1; 56 | } 57 | //+------------------------------------------------------------------+ 58 | //| | 59 | //+------------------------------------------------------------------+ 60 | void WeekClosing::Calculate(DataSet &dataSet) 61 | { 62 | Data=GetPointer(dataSet); 63 | 64 | if(m_fridayCloseHour==-1) 65 | m_fridayCloseHour=GetFridayCloseHour(); 66 | 67 | double closePrice[]; ArrayResize(closePrice,Data.Bars); ArrayInitialize(closePrice,0); 68 | 69 | for(int bar=0; bar3 && time1.day_of_week<3) 74 | closePrice[bar]=Data.Close[bar]; 75 | } 76 | 77 | datetime time=Data.Time[Data.Bars-1]; 78 | MqlDateTime mqlTime; TimeToStruct(time,mqlTime); 79 | 80 | if(mqlTime.day_of_week==5) 81 | { 82 | datetime dayOpenTime = (time/86400)*86400; 83 | datetime barCloseTime = time + Data.Period*60; 84 | datetime fridayCloseTime = (m_fridayCloseHour==-1) 85 | ?(dayOpenTime+86400) 86 | :(dayOpenTime+m_fridayCloseHour*3600); 87 | datetime closeTime=fridayCloseTime-60; 88 | 89 | if(barCloseTime==fridayCloseTime && Data.ServerTime>closeTime) 90 | closePrice[Data.Bars-1]=Data.Close[Data.Bars-1]; 91 | } 92 | 93 | Component[0].CompName = "Week Closing"; 94 | Component[0].DataType = IndComponentType_ClosePrice; 95 | Component[0].ShowInDynInfo = false; 96 | Component[0].FirstBar = 2; 97 | ArrayResize(Component[0].Value,Data.Bars); 98 | ArrayCopy(Component[0].Value,closePrice); 99 | } 100 | //+------------------------------------------------------------------+ 101 | -------------------------------------------------------------------------------- /Forexsb.com/Indicators/WeekClosing2.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.3" 27 | #property strict 28 | 29 | #include 30 | #include 31 | //+------------------------------------------------------------------+ 32 | //| | 33 | //+------------------------------------------------------------------+ 34 | class WeekClosing2 : public Indicator 35 | { 36 | public: 37 | WeekClosing2(SlotTypes slotType); 38 | virtual void Calculate(DataSet &dataSet); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | void WeekClosing2::WeekClosing2(SlotTypes slotType) 44 | { 45 | SlotType = slotType; 46 | IndicatorName = "Week Closing 2"; 47 | IsAllowLTF = true; 48 | ExecTime = ExecutionTime_DuringTheBar; 49 | IsSeparateChart = false; 50 | IsDiscreteValues = false; 51 | IsDefaultGroupAll = false; 52 | } 53 | //+------------------------------------------------------------------+ 54 | //| | 55 | //+------------------------------------------------------------------+ 56 | void WeekClosing2::Calculate(DataSet &dataSet) 57 | { 58 | Data=GetPointer(dataSet); 59 | 60 | int fridayClosingHour=(int) NumParam[0].Value; 61 | int fridayClosingMin =(int) NumParam[1].Value; 62 | 63 | // Calculation 64 | double closePrice[]; 65 | ArrayResize(closePrice,Data.Bars); 66 | ArrayInitialize(closePrice,0); 67 | 68 | for(int bar=0; bar3 && time1.day_of_week<3) 73 | closePrice[bar]=Data.Close[bar]; 74 | } 75 | 76 | double allowOpenLong[]; 77 | ArrayResize(allowOpenLong,Data.Bars); 78 | ArrayInitialize(allowOpenLong,1); 79 | double allowOpenShort[]; 80 | ArrayResize(allowOpenShort,Data.Bars); 81 | ArrayInitialize(allowOpenShort,1); 82 | 83 | datetime serverTime = Data.ServerTime; 84 | MqlDateTime mqlServerTime; TimeToStruct(serverTime,mqlServerTime); 85 | 86 | if(mqlServerTime.day_of_week==5) 87 | { 88 | datetime fridayTime=(serverTime/86400)*86400+fridayClosingHour*60*60+fridayClosingMin*60; 89 | if(serverTime>=fridayTime) 90 | { 91 | closePrice[Data.Bars-1]=Data.Close[Data.Bars-1]; 92 | allowOpenLong[Data.Bars-1]=0; 93 | allowOpenShort[Data.Bars-1]=0; 94 | } 95 | } 96 | 97 | Component[0].CompName = "Week Closing"; 98 | Component[0].DataType = IndComponentType_ClosePrice; 99 | Component[0].ShowInDynInfo = false; 100 | Component[0].FirstBar = 2; 101 | ArrayResize(Component[0].Value,Data.Bars); 102 | ArrayCopy(Component[0].Value,closePrice); 103 | 104 | Component[1].DataType = IndComponentType_AllowOpenLong; 105 | Component[1].CompName = "Is long entry allowed"; 106 | Component[1].ShowInDynInfo = false; 107 | Component[1].FirstBar = 2; 108 | ArrayResize(Component[1].Value,Data.Bars); 109 | ArrayCopy(Component[1].Value,allowOpenLong); 110 | 111 | Component[2].DataType = IndComponentType_AllowOpenShort; 112 | Component[2].CompName = "Is short entry allowed"; 113 | Component[2].ShowInDynInfo = false; 114 | Component[2].FirstBar = 2; 115 | ArrayResize(Component[2].Value,Data.Bars); 116 | ArrayCopy(Component[2].Value,allowOpenShort); 117 | } 118 | //+------------------------------------------------------------------+ 119 | -------------------------------------------------------------------------------- /Forexsb.com/Logger.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "2.00" 27 | #property strict 28 | //## Import Start 29 | 30 | class Logger 31 | { 32 | int logLines; 33 | int fileHandle; 34 | 35 | public: 36 | string GetLogFileName(string symbol,int dataPeriod,int expertMagic); 37 | int CreateLogFile(string fileName); 38 | void WriteLogLine(string text); 39 | void WriteNewLogLine(string text); 40 | void WriteLogRequest(string text,string request); 41 | bool IsLogLinesLimitReached(int maxLines); 42 | void FlushLogFile(void); 43 | void CloseLogFile(void); 44 | int CloseExpert(void); 45 | }; 46 | //+------------------------------------------------------------------+ 47 | //| | 48 | //+------------------------------------------------------------------+ 49 | string Logger::GetLogFileName(string symbol,int dataPeriod,int expertMagic) 50 | { 51 | string time=TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS); 52 | StringReplace(time,":",""); 53 | StringReplace(time," ","_"); 54 | string rnd=IntegerToString(MathRand()); 55 | string fileName=symbol+"_"+IntegerToString(dataPeriod)+"_"+ 56 | IntegerToString(expertMagic)+"_"+time+"_"+rnd+".log"; 57 | return (fileName); 58 | } 59 | //+------------------------------------------------------------------+ 60 | //| | 61 | //+------------------------------------------------------------------+ 62 | int Logger::CreateLogFile(string fileName) 63 | { 64 | logLines=0; 65 | int handle=FileOpen(fileName,FILE_CSV|FILE_WRITE,","); 66 | if(handle>0) 67 | fileHandle=handle; 68 | else 69 | Print("CreateFile: Error while creating log file!"); 70 | return (handle); 71 | } 72 | //+------------------------------------------------------------------+ 73 | //| | 74 | //+------------------------------------------------------------------+ 75 | void Logger::WriteLogLine(string text) 76 | { 77 | if(fileHandle <= 0) return; 78 | FileWrite(fileHandle,TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS),text); 79 | logLines++; 80 | } 81 | //+------------------------------------------------------------------+ 82 | //| | 83 | //+------------------------------------------------------------------+ 84 | void Logger::WriteNewLogLine(string text) 85 | { 86 | if(fileHandle <= 0) return; 87 | FileWrite(fileHandle,""); 88 | FileWrite(fileHandle,TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS),text); 89 | logLines+=2; 90 | } 91 | //+------------------------------------------------------------------+ 92 | //| | 93 | //+------------------------------------------------------------------+ 94 | void Logger::WriteLogRequest(string text,string request) 95 | { 96 | if(fileHandle <= 0) return; 97 | FileWrite(fileHandle,"\n"+text); 98 | FileWrite(fileHandle,TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS),request); 99 | logLines+=3; 100 | } 101 | //+------------------------------------------------------------------+ 102 | //| | 103 | //+------------------------------------------------------------------+ 104 | void Logger::FlushLogFile() 105 | { 106 | if(fileHandle <= 0) return; 107 | FileFlush(fileHandle); 108 | } 109 | //+------------------------------------------------------------------+ 110 | //| | 111 | //+------------------------------------------------------------------+ 112 | void Logger::CloseLogFile() 113 | { 114 | if(fileHandle <= 0) return; 115 | WriteNewLogLine(StringFormat("%s Closed.",MQLInfoString(MQL_PROGRAM_NAME))); 116 | FileClose(fileHandle); 117 | } 118 | //+------------------------------------------------------------------+ 119 | //| | 120 | //+------------------------------------------------------------------+ 121 | bool Logger::IsLogLinesLimitReached(int maxLines) 122 | { 123 | return (logLines > maxLines); 124 | } 125 | //+------------------------------------------------------------------+ 126 | -------------------------------------------------------------------------------- /Forexsb.com/Position.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "1.00" 27 | #property strict 28 | 29 | #include 30 | 31 | //## Import Start 32 | 33 | #define OP_FLAT -1 34 | //+------------------------------------------------------------------+ 35 | //| | 36 | //+------------------------------------------------------------------+ 37 | class Position 38 | { 39 | public: 40 | // Constructors 41 | Position(void); 42 | 43 | // Properties 44 | int PosType; 45 | PosDirection Direction; 46 | double Lots; 47 | datetime OpenTime; 48 | double OpenPrice; 49 | double StopLossPrice; 50 | double TakeProfitPrice; 51 | double Profit; 52 | double Commission; 53 | long Ticket; 54 | string PosComment; 55 | 56 | // Methods 57 | string ToString(); 58 | 59 | void SetPositionInfo(string &positionInfo[]); 60 | }; 61 | //+------------------------------------------------------------------+ 62 | //| | 63 | //+------------------------------------------------------------------+ 64 | void Position::Position(void) 65 | { 66 | } 67 | //+------------------------------------------------------------------+ 68 | //| | 69 | //+------------------------------------------------------------------+ 70 | string Position::ToString() 71 | { 72 | if(PosType==OP_FLAT) 73 | return ("Position: Flat"); 74 | 75 | string text = "Position: " + 76 | "Time=" + TimeToString(OpenTime,TIME_SECONDS) +", "+ 77 | "Type=" + (PosType==OP_BUY ? "Long" : "Short") +", "+ 78 | "Lots=" + DoubleToString(Lots,2) +", "+ 79 | "Price=" + DoubleToString(OpenPrice,_Digits) +", "+ 80 | "StopLoss=" + DoubleToString(StopLossPrice,_Digits) +", "+ 81 | "TakeProfit=" + DoubleToString(TakeProfitPrice,_Digits) +", "+ 82 | "Commission=" + DoubleToString(Commission,2) +", "+ 83 | "Profit=" + DoubleToString(Profit,2); 84 | 85 | if(PosComment!="") 86 | text+=", \""+PosComment+"\""; 87 | 88 | return (text); 89 | } 90 | //+------------------------------------------------------------------+ 91 | //| | 92 | //+------------------------------------------------------------------+ 93 | void Position::SetPositionInfo(string &positionInfo[]) 94 | { 95 | if(PosType==OP_FLAT) 96 | { 97 | positionInfo[0] = "Position: Flat"; 98 | positionInfo[1] = "."; 99 | } 100 | else 101 | { 102 | positionInfo[0]=StringFormat("Position: %s %.2f at %s, Profit %.2f", 103 | (PosType==OP_BUY) ? "Long" : "Short", 104 | Lots, 105 | DoubleToString(OpenPrice,_Digits), 106 | Profit); 107 | positionInfo[1]=StringFormat("Stop Loss: %s, Take Profit: %s", 108 | DoubleToString(StopLossPrice,_Digits), 109 | DoubleToString(TakeProfitPrice,_Digits)); 110 | } 111 | } 112 | //+------------------------------------------------------------------+ 113 | -------------------------------------------------------------------------------- /Forexsb.com/StrategyManager.mqh: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------+ 2 | //| Copyright: (C) 2016 Forex Software Ltd. | 3 | //| Website: http://forexsb.com/ | 4 | //| Support: http://forexsb.com/forum/ | 5 | //| License: Proprietary under the following circumstances: | 6 | //| | 7 | //| This code is a part of Forex Strategy Builder. It is free for | 8 | //| use as an integral part of Forex Strategy Builder. | 9 | //| One can modify it in order to improve the code or to fit it for | 10 | //| personal use. This code or any part of it cannot be used in | 11 | //| other applications without a permission. | 12 | //| The contact information cannot be changed. | 13 | //| | 14 | //| NO LIABILITY FOR CONSEQUENTIAL DAMAGES | 15 | //| | 16 | //| In no event shall the author be liable for any damages whatsoever | 17 | //| (including, without limitation, incidental, direct, indirect and | 18 | //| consequential damages, damages for loss of business profits, | 19 | //| business interruption, loss of business information, or other | 20 | //| pecuniary loss) arising out of the use or inability to use this | 21 | //| product, even if advised of the possibility of such damages. | 22 | //+--------------------------------------------------------------------+ 23 | 24 | #property copyright "Copyright (C) 2016 Forex Software Ltd." 25 | #property link "http://forexsb.com" 26 | #property version "3.00" 27 | #property strict 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | //## Import Start 34 | 35 | class StrategyManager 36 | { 37 | public: 38 | Strategy *GetStrategy(void); 39 | }; 40 | //+------------------------------------------------------------------+ 41 | //| | 42 | //+------------------------------------------------------------------+ 43 | Strategy *StrategyManager::GetStrategy(void) 44 | { 45 | IndicatorManager *indicatorManager=new IndicatorManager(); 46 | 47 | Strategy *strategy = new Strategy(0, 0); //##STRATEGY_CREATION_CODE## 48 | 49 | delete indicatorManager; 50 | 51 | return strategy; 52 | } 53 | //+------------------------------------------------------------------+ 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FSB Pro Expert Advisor MQL Code 2 | 3 | MQL Code used by Forex Strategy Builder Professional for exporting Expert Advisors. 4 | 5 | Website: http://forexsb.com 6 | Suport forum: http://forexsb.com/forum/ 7 | --------------------------------------------------------------------------------