Category Other  Published on 12/12/2018

Forex GBPUSD

Description

The robot is based on different GannHighLow Indicators. If the GannHighLow Indicator crosses above or below MarketSeries and two SimpleMovingAverages are rising or falling a signal is given. Two other Indicators ChaikinMoneyFlow and MomentumOscillator or MoneyFlowIndex and MomentumOscillator support the signal.

The robot is fully automated and can run all over the week. There are no times to notice.

The robot is for one currency pair only. It is the same as the robot name.

The robot works only with a timeframe of 1h.

The robot doesn’t make many trades. There will be about 4 or 5 trades monthly.

All parameters are optimized. The parameters are marked with Buy or Sell to optimize the robots if you feel it’s necessary.

Now you can download all 9 currency pairs from this site. For other information or comments contact me mountain.friend@outlook.de.


// -------------------------------------------------------------------------------
//
//    
//
// -------------------------------------------------------------------------------

using System;
using cAlgo.API;
using cAlgo.API.Requests;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class GBPUSD : Robot
    {

        private GHLsmawws _GHLsmawwsIndicator;

        private GHLsmawws10 _GHLsmawws10Indicator;


        private GHLsmawws2 _GHLsmawws2Indicator;



        private GannHighLowwws _gannHighLowwwsIndicator;
        private GannHighLowwws1 _gannHighLowwws1Indicator;

        private GHLsmawws1 _GHLsmawws1Indicator;


        private GannHighLowtri _gannHighLowtriIndicator;
        private GannHighLowtri1 _gannHighLowtri1Indicator;
        private GannHighLowtri2 _gannHighLowtri2Indicator;
        private GannHighLowtri3 _gannHighLowtri3Indicator;

        private GannHighLowsmatri _gannHighLowsmatriIndicator;

        private GannHighLowWeight _gannHighLowWeightIndicator;
        private GannHighLowWeight1 _gannHighLowWeight1Indicator;

        private GHExp _GHExpIndicator;


        private GHLwwssma _GHLwwssmaIndicator;
        private GHLwwssma1 _GHLwwssma1Indicator;

        private GannHighLowTS _gannHighLowTSIndicator;
        private GannHighLowTS1 _gannHighLowTS1Indicator;

        private GannHighLowsma _gannHighLowsmaIndicator;







        private MovingAverage MA1;
        private MovingAverage MA2;
        private MovingAverage MA3;
        private MovingAverage MA4;
        private MovingAverage MA5;
        private MovingAverage MA6;
        private MovingAverage MA7;
        private MovingAverage MA8;
        private MovingAverage MA9;
        private MovingAverage MA10;
        private MovingAverage MA11;
        private MovingAverage MA12;

        private MovingAverage MA20;
        private MovingAverage MA21;

        private MovingAverage MA30;
        private MovingAverage MA31;

        private MovingAverage MA40;
        private MovingAverage MA41;



        private Position _position;
        private int h;




        [Parameter("Period-Buy", DefaultValue = 51)]
        public int Period { get; set; }

        [Parameter("Period1-Sell", DefaultValue = 64)]
        public int Period1 { get; set; }

        [Parameter("Period2-Sell", DefaultValue = 32)]
        public int Period2 { get; set; }

        [Parameter("Period3-Sell", DefaultValue = 37)]
        public int Period3 { get; set; }


        [Parameter("Period4-Buy", DefaultValue = 36)]
        public int Period4 { get; set; }

        [Parameter("Period5-Sell", DefaultValue = 30)]
        public int Period5 { get; set; }

        [Parameter("Period6-Buy", DefaultValue = 49)]
        public int Period6 { get; set; }

        [Parameter("Period7-Buy", DefaultValue = 71)]
        public int Period7 { get; set; }

        [Parameter("Period8-Sell", DefaultValue = 27)]
        public int Period8 { get; set; }


        [Parameter("Period10-Sell", DefaultValue = 60)]
        public int Period10 { get; set; }

        [Parameter("Period11-Buy", DefaultValue = 61)]
        public int Period11 { get; set; }

        [Parameter("Period12-Buy", DefaultValue = 24)]
        public int Period12 { get; set; }

        [Parameter("Period13-Sell", DefaultValue = 47)]
        public int Period13 { get; set; }

        [Parameter("Period14-Buy", DefaultValue = 30)]
        public int Period14 { get; set; }

        [Parameter("Period15-Buy", DefaultValue = 32)]
        public int Period15 { get; set; }

        [Parameter("Period16-Sell", DefaultValue = 67)]
        public int Period16 { get; set; }

        [Parameter("Period17-Sell", DefaultValue = 43)]
        public int Period17 { get; set; }

        [Parameter("Period18-Sell", DefaultValue = 70)]
        public int Period18 { get; set; }


        [Parameter("Period19-Sell", DefaultValue = 54)]
        public int Period19 { get; set; }

        [Parameter("Period20-Sell", DefaultValue = 26)]
        public int Period20 { get; set; }





        [Parameter("Volume-Buy", DefaultValue = 10000)]
        public int Volume { get; set; }

        [Parameter("Volume1-Sell", DefaultValue = 10000)]
        public int Volume1 { get; set; }




        [Parameter("StopLoss-Buy", DefaultValue = 57)]
        public int StopLoss { get; set; }

        [Parameter("StopLoss1-Sell", DefaultValue = 47)]
        public int StopLoss1 { get; set; }


        [Parameter("TakeProfit-Buy", DefaultValue = 128)]
        public int TakeProfit { get; set; }

        [Parameter("TakeProfit1-Sell", DefaultValue = 125)]
        public int TakeProfit1 { get; set; }



        [Parameter("MA_period1-Buy", DefaultValue = 63)]
        public int MA_period1 { get; set; }



        [Parameter("MA_period2-Buy", DefaultValue = 42)]
        public int MA_period2 { get; set; }





        [Parameter("MA_period3-Sell", DefaultValue = 88)]
        public int MA_period3 { get; set; }



        [Parameter("MA_period4-Sell", DefaultValue = 61)]
        public int MA_period4 { get; set; }



        [Parameter("MA_period5-Sell", DefaultValue = 56)]
        public int MA_period5 { get; set; }



        [Parameter("MA_period6-Sell", DefaultValue = 40)]
        public int MA_period6 { get; set; }



        [Parameter("MA_period7-Buy", DefaultValue = 53)]
        public int MA_period7 { get; set; }



        [Parameter("MA_period8-Buy", DefaultValue = 48)]
        public int MA_period8 { get; set; }



        [Parameter("MA_period9-Sell", DefaultValue = 21)]
        public int MA_period9 { get; set; }



        [Parameter("MA_period10-Buy", DefaultValue = 32)]
        public int MA_period10 { get; set; }



        [Parameter("MA_period11-Buy", DefaultValue = 64)]
        public int MA_period11 { get; set; }



        [Parameter("MA_period12-Buy", DefaultValue = 40)]
        public int MA_period12 { get; set; }



        [Parameter("MA_period20-Buy", DefaultValue = 65)]
        public int MA_period20 { get; set; }



        [Parameter("MA_period21-Buy", DefaultValue = 50)]
        public int MA_period21 { get; set; }



        [Parameter("MA_period30-Sell", DefaultValue = 71)]
        public int MA_period30 { get; set; }



        [Parameter("MA_period31-Sell", DefaultValue = 57)]
        public int MA_period31 { get; set; }



        [Parameter("MA_period40-Sell", DefaultValue = 60)]
        public int MA_period40 { get; set; }



        [Parameter("MA_period41-Sell", DefaultValue = 40)]
        public int MA_period41 { get; set; }




        [Parameter("Tral_Start-Buy", DefaultValue = 205)]
        public int Tral_Start { get; set; }

        [Parameter("Tral_Start1-Sell", DefaultValue = 218)]
        public int Tral_Start1 { get; set; }

        [Parameter("Tral_Stop-Buy", DefaultValue = 92)]
        public int Tral_Stop { get; set; }

        [Parameter("Tral_Stop1-Sell", DefaultValue = 129)]
        public int Tral_Stop1 { get; set; }

        [Parameter("MFI_period-Sell", DefaultValue = 12)]
        public int MFI_period { get; set; }

        [Parameter("MFI_period1-Buy", DefaultValue = 19)]
        public int MFI_period1 { get; set; }

        [Parameter("MFI_period2-Sell", DefaultValue = 12)]
        public int MFI_period2 { get; set; }

        [Parameter("MFI_period3-Buy", DefaultValue = 17)]
        public int MFI_period3 { get; set; }

        [Parameter("MFI_period4-Sell", DefaultValue = 22)]
        public int MFI_period4 { get; set; }



        [Parameter("MO_period-Sell", DefaultValue = 26)]
        public int MO_period { get; set; }



        [Parameter("MO_period1-Buy", DefaultValue = 32)]
        public int MO_period1 { get; set; }



        [Parameter("MO_period2-Sell", DefaultValue = 18)]
        public int MO_period2 { get; set; }



        [Parameter("MO_period3-Buy", DefaultValue = 12)]
        public int MO_period3 { get; set; }



        [Parameter("MO_period4-Sell", DefaultValue = 9)]
        public int MO_period4 { get; set; }




        [Parameter("MO_period7-Sell", DefaultValue = 25)]
        public int MO_period7 { get; set; }



        private ChaikinMoneyFlow MFI;
        private ChaikinMoneyFlow MFI2;

        private MoneyFlowIndex MFI3;
        private MoneyFlowIndex MFI4;

        private ChaikinMoneyFlow MFI5;


        private VerticalHorizontalFilter MO;
        private VerticalHorizontalFilter MO1;
        private VerticalHorizontalFilter MO3;


        private VerticalHorizontalFilter MO8;

        private MomentumOscillator MO4;
        private MomentumOscillator MO5;

















        protected override void OnStart()
        {

            _GHLsmawwsIndicator = Indicators.GetIndicator<GHLsmawws>(Period);

            _GHLsmawws2Indicator = Indicators.GetIndicator<GHLsmawws2>(Period1, Period2);

            _gannHighLowwwsIndicator = Indicators.GetIndicator<GannHighLowwws>(Period3);

            _gannHighLowtriIndicator = Indicators.GetIndicator<GannHighLowtri>(Period4);
            _gannHighLowtri1Indicator = Indicators.GetIndicator<GannHighLowtri1>(Period5);

            _gannHighLowWeightIndicator = Indicators.GetIndicator<GannHighLowWeight>(Period6);
            _gannHighLowWeight1Indicator = Indicators.GetIndicator<GannHighLowWeight1>(Period7);

            _GHExpIndicator = Indicators.GetIndicator<GHExp>(Period8);


            _GHLsmawws1Indicator = Indicators.GetIndicator<GHLsmawws1>(Period10);
            _gannHighLowtri2Indicator = Indicators.GetIndicator<GannHighLowtri2>(Period11);

            _GHLwwssmaIndicator = Indicators.GetIndicator<GHLwwssma>(Period12);
            _GHLwwssma1Indicator = Indicators.GetIndicator<GHLwwssma1>(Period13);

            _gannHighLowsmatriIndicator = Indicators.GetIndicator<GannHighLowsmatri>(Period14);

            _GHLsmawws10Indicator = Indicators.GetIndicator<GHLsmawws10>(Period15);

            _gannHighLowtri3Indicator = Indicators.GetIndicator<GannHighLowtri3>(Period16);

            _gannHighLowTSIndicator = Indicators.GetIndicator<GannHighLowTS>(Period17);
            _gannHighLowTS1Indicator = Indicators.GetIndicator<GannHighLowTS1>(Period18);

            _gannHighLowwws1Indicator = Indicators.GetIndicator<GannHighLowwws1>(Period19);

            _gannHighLowsmaIndicator = Indicators.GetIndicator<GannHighLowsma>(Period20);





            MFI = Indicators.ChaikinMoneyFlow(MFI_period);
            MFI2 = Indicators.ChaikinMoneyFlow(MFI_period1);

            MFI3 = Indicators.MoneyFlowIndex(MFI_period2);
            MFI4 = Indicators.MoneyFlowIndex(MFI_period3);

            MFI5 = Indicators.ChaikinMoneyFlow(MFI_period4);


            MO = Indicators.VerticalHorizontalFilter(MarketSeries.Close, MO_period);
            MO1 = Indicators.VerticalHorizontalFilter(MarketSeries.Close, MO_period1);
            MO3 = Indicators.VerticalHorizontalFilter(MarketSeries.Close, MO_period2);

            MO4 = Indicators.MomentumOscillator(MarketSeries.Close, MO_period3);
            MO5 = Indicators.MomentumOscillator(MarketSeries.Close, MO_period4);

            MO8 = Indicators.VerticalHorizontalFilter(MarketSeries.Close, MO_period7);



            MA1 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period1);
            MA2 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period2);
            MA3 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period3);
            MA4 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period4);
            MA5 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period5);
            MA6 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period6);
            MA7 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period7);
            MA8 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period8);
            MA9 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period9);
            MA10 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period10);

            MA11 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period11);
            MA12 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period12);

            MA20 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period20);
            MA21 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period21);

            MA30 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period30);
            MA31 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period31);

            MA40 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period40);
            MA41 = Indicators.SimpleMovingAverage(MarketSeries.Close, MA_period41);






            Print("Welcome to the world of infinite financial possibilities!");
        }



        protected override void OnPositionOpened(Position openedPosition)
        {
            _position = openedPosition;

            if (_position.TradeType == TradeType.Buy)
            {
                Trade.ModifyPosition(openedPosition, _position.EntryPrice - StopLoss * Symbol.PipSize, _position.EntryPrice + TakeProfit * Symbol.PipSize);
                h = 1;
            }

            if (_position.TradeType == TradeType.Sell)
            {
                Trade.ModifyPosition(openedPosition, _position.EntryPrice + StopLoss1 * Symbol.PipSize, _position.EntryPrice - TakeProfit1 * Symbol.PipSize);
                h = 1;
            }
        }




        protected override void OnBar()
        {

            double Bid = Symbol.Bid;
            double Ask = Symbol.Ask;
            double Point = Symbol.PointSize;


            double MO2 = MO.Result[MO.Result.Count - 2];



            double MFI1 = MFI.Result[MFI.Result.Count - 2];






            if (Trade.IsExecuting)
                return;


            if (_GHLsmawwsIndicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO1.Result.IsRising() && MO2 > 0.3 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_GHLsmawwsIndicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && MA20.Result.IsRising() && MA21.Result.IsFalling() && MO1.Result.IsRising() && MO2 > 0.3 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }




            if (_GHLsmawwsIndicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsRising() && MO1.Result.IsRising() && MO2 > 0.45 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }







            if (_gannHighLowtriIndicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO4.Result.IsRising() && MO2 > 0.3 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }



            if (_gannHighLowtriIndicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && MA11.Result.IsRising() && MA12.Result.IsRising() && MO4.Result.IsRising() && MO2 > 0.4 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_GHLsmawws10Indicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && _gannHighLowtriIndicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO1.Result.IsRising() && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }


            if (_gannHighLowtriIndicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO4.Result.IsRising() && MFI1 > 0.15 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }



            if (_gannHighLowWeightIndicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO4.Result.IsRising() && MFI2.Result.IsRising() && MO2 > 0.3 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_gannHighLowWeightIndicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA20.Result.IsRising() && MA21.Result.IsFalling() && MO4.Result.IsRising() && MFI2.Result.IsRising() && MO2 > 0.3 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }



            if (_gannHighLowWeightIndicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MA7.Result.IsRising() && MFI2.Result.IsRising() && MO2 > 0.3 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_gannHighLowWeightIndicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsRising() && MA7.Result.IsRising() && MFI2.Result.IsRising() && MO2 > 0.45 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }



            if (_gannHighLowWeightIndicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA11.Result.IsRising() && MA12.Result.IsRising() && MA7.Result.IsRising() && MFI2.Result.IsRising() && MO2 > 0.45 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }




            if (_gannHighLowWeightIndicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MA7.Result.IsRising() && MFI2.Result.IsRising() && MFI1 > 0.15 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_gannHighLowWeight1Indicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MA8.Result.IsRising() && MFI4.Result.IsRising() && MO2 > 0.35 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_gannHighLowWeight1Indicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA20.Result.IsRising() && MA21.Result.IsFalling() && MA8.Result.IsRising() && MFI4.Result.IsRising() && MO2 > 0.35 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_gannHighLowWeight1Indicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MA8.Result.IsRising() && MFI4.Result.IsRising() && MFI1 > 0.15 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_gannHighLowWeight1Indicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA20.Result.IsRising() && MA21.Result.IsFalling() && MA8.Result.IsRising() && MFI4.Result.IsRising() && MFI1 > 0.15 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_gannHighLowtri2Indicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO4.Result.IsRising() && MFI2.Result.IsRising() && MO2 > 0.35 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }



            if (_gannHighLowtri2Indicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO4.Result.IsRising() && MFI2.Result.IsRising() && MFI1 > 0.05 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_gannHighLowtriIndicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MA10.Result.IsRising() && MO2 > 0.3 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }



            if (_gannHighLowtriIndicator.Result.HasCrossedBelow(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MA10.Result.IsRising() && MFI1 > 0.15 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }

            if (_GHLwwssmaIndicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO4.Result.IsRising() && MFI2.Result.IsRising() && MO2 > 0.35 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }





            if (_gannHighLowsmatriIndicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO4.Result.IsRising() && MFI2.Result.IsRising() && MO2 > 0.35 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }



            if (_gannHighLowsmatriIndicator.Result.HasCrossedAbove(MarketSeries.Open, 1) && MA1.Result.IsRising() && MA2.Result.IsFalling() && MO4.Result.IsRising() && MFI2.Result.IsRising() && MFI1 > 0.15 && h == 0)
            {
                Trade.CreateBuyMarketOrder(Symbol, Volume);
                Print("Trade Buy was successfully open");
                h = 1;


            }
























            if (_GHLsmawws2Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA3.Result.IsFalling() && MA4.Result.IsRising() && MO.Result.IsRising() && MFI.Result.IsFalling() && MO2 < 0.3 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_GHLsmawws2Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA30.Result.IsFalling() && MA31.Result.IsRising() && MO.Result.IsRising() && MFI.Result.IsFalling() && MO2 < 0.2 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_GHLsmawws2Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA5.Result.IsFalling() && MA6.Result.IsFalling() && MO5.Result.IsFalling() && MFI.Result.IsFalling() && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }





            if (_GHLsmawws2Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA3.Result.IsFalling() && MA4.Result.IsRising() && MO.Result.IsRising() && MFI.Result.IsFalling() && MFI1 < -0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }




            if (_gannHighLowwwsIndicator.Result.HasCrossedBelow(MarketSeries.Close, 1) && MA5.Result.IsFalling() && MA6.Result.IsFalling() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MFI1 < 0.0 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }





            if (_gannHighLowwwsIndicator.Result.HasCrossedBelow(MarketSeries.Close, 1) && MA5.Result.IsFalling() && MA6.Result.IsFalling() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MFI1 < 0.15 && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_gannHighLowwwsIndicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA5.Result.IsFalling() && MA6.Result.IsFalling() && MO5.Result.IsFalling() && MFI.Result.IsFalling() && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }





            if (_GHLsmawws1Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA5.Result.IsFalling() && MA6.Result.IsFalling() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MFI1 < 0.0 && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }



            if (_gannHighLowtri1Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA3.Result.IsFalling() && MA4.Result.IsRising() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MFI1 < 0.0 && MO2 < 0.3 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }




            if (_gannHighLowtri1Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA3.Result.IsFalling() && MA4.Result.IsRising() && MA9.Result.IsFalling() && MFI3.Result.IsFalling() && MFI1 < 0.0 && MO2 < 0.3 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_gannHighLowtri1Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA30.Result.IsFalling() && MA31.Result.IsRising() && MA9.Result.IsFalling() && MFI3.Result.IsFalling() && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }




            if (_gannHighLowtri3Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA3.Result.IsFalling() && MA4.Result.IsRising() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MFI1 < 0.0 && MO2 < 0.3 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_gannHighLowtri3Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA30.Result.IsFalling() && MA31.Result.IsRising() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }





            if (_gannHighLowtri3Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA3.Result.IsFalling() && MA4.Result.IsRising() && MA9.Result.IsFalling() && MFI3.Result.IsFalling() && MFI1 < 0.0 && MO2 < 0.3 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_gannHighLowtri3Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA30.Result.IsFalling() && MA31.Result.IsRising() && MA9.Result.IsFalling() && MFI3.Result.IsFalling() && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }




            if (_GHExpIndicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA5.Result.IsFalling() && MA6.Result.IsFalling() && MO5.Result.IsFalling() && MFI3.Result.IsFalling() && MFI1 < 0.0 && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }




            if (_GHExpIndicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA5.Result.IsFalling() && MA6.Result.IsFalling() && MA9.Result.IsFalling() && MFI3.Result.IsFalling() && MFI1 < -0.25 && MO2 < 0.3 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }




            if (_GHLwwssma1Indicator.Result.HasCrossedBelow(MarketSeries.Close, 1) && MA5.Result.IsFalling() && MA6.Result.IsFalling() && MO8.Result.IsRising() && MFI5.Result.IsFalling() && MFI1 < 0.0 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_gannHighLowTSIndicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA3.Result.IsFalling() && MA4.Result.IsRising() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MO2 < 0.3 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_gannHighLowTS1Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA30.Result.IsFalling() && MA31.Result.IsRising() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }



            if (_gannHighLowwws1Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA3.Result.IsFalling() && MA4.Result.IsRising() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MO2 < 0.3 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_gannHighLowwws1Indicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA30.Result.IsFalling() && MA31.Result.IsRising() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_gannHighLowsmaIndicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA40.Result.IsFalling() && MA41.Result.IsRising() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MO2 < 0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }

            if (_gannHighLowsmaIndicator.Result.HasCrossedAbove(MarketSeries.Close, 1) && MA40.Result.IsFalling() && MA41.Result.IsRising() && MO3.Result.IsRising() && MFI.Result.IsFalling() && MFI1 < -0.25 && h == 0)
            {

                Trade.CreateSellMarketOrder(Symbol, Volume1);
                Print("Trade SELL was successfully open");
                h = 1;


            }










































            foreach (var position in Account.Positions)
            {




                if (position.SymbolCode == Symbol.Code)
                {

                    if (position.TradeType == TradeType.Buy)
                    {
                        if (Bid - position.EntryPrice >= Tral_Start * Point)
                            if (Bid - Tral_Stop * Point >= position.StopLoss)
                                Trade.ModifyPosition(position, Bid - Tral_Stop * Point, position.TakeProfit);
                    }

                    if (position.TradeType == TradeType.Sell)
                    {
                        if (position.EntryPrice - Ask >= Tral_Start1 * Point)
                            if (Ask + Tral_Stop1 * Point <= position.StopLoss)
                                Trade.ModifyPosition(position, Ask + Tral_Stop1 * Point, position.TakeProfit);
                    }
                }

            }
        }





        protected override void OnPositionClosed(Position pos)
        {
            h = 0;



        }

        protected override void OnStop()
        {
            Print("Successful day!");
        }




    }
}


MO
Mountain

Joined on 28.07.2018

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: GBPUSD1.algo
  • Rating: 0
  • Installs: 2484
  • Modified: 13/10/2021 09:55
Comments
Log in to add a comment.
No comments found.