Gwave's avatar
E7 Academy
Effective Trading.
E7 Academy 's avatar

Info

Username:Gwave
Name:E7 Academy
Member since: 26 Oct 2014
Country:United Kingdom

Favorite symbols:

GBPUSD

About

E7 Qnet is a general artificial deep neural network which we use to create specific systems for the cTrader platform.

Signature

Effective Trading.

Last Algorithm Comments

@Telegram Bot Example:  04 May 2020, 04:33


Hi guys, how did you solve the bot instantly stopping, after starting it? Any help will be much appreciated. Thanks.

@Counter Trade:  21 Mar 2018, 17:14


Hi guys. How can i modify CounterTrade to automatically Close " it's trade " when the " Original position " closes. Please, any help would be much appreciated.  Many Thanks

Last Forum Posts

@Telegram Alert bot stops with "WebException":  20 May 2020, 12:47


Hi Guys

Does anyone have any insight or solution to this?

Many thanks for all your help.

Regards

Gwave

@Telegram Alert bot stops with "WebException":  14 May 2020, 15:17


ergun said:

Did you try to send a message to bot over telegram? Like sending a message to a person?

Hi ergun

Yes I did but it's not working at all.

Do you have any suggestions?

Any help would be much appreciated thanks.

Regards

@.Net.Framework // Manage References:  07 May 2020, 14:08


PanagiotisCharalampous said:

Hi Gwave,

If you already have the project then you can add it as an existing project to your cBot solution and then add it as a reference in your cBot project. Read this post, it could be helpful.

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis

Thank you very much for that post. It was very helpful. I also ended up " brute forcing" my way to a solution.

Regards

Gwave

@.Net.Framework // Manage References:  05 May 2020, 16:35


PanagiotisCharalampous said:

Hi Gwave,

Can you provide more information? What is NeuralNet? Did you download/install it somewhere? Why do you expect to see it in the Reference library?

Best Regards,

Panagiotis 

Join us on Telegram

I downloaded original project from GitHub into Visual Studio. Then made some changes to it and now I am trying to implement this on cTrader as the information I have gathered has said it should be possible. Going by your response, I assume I am incorrect? I am not a coder and am just trying to find a solution to a problem. If it's not possible, I understand and appreciate all your help mate.

@.Net.Framework // Manage References:  05 May 2020, 14:35


Hi guys

I am trying to get a NeuralNet to run on cTrader but is this possible at all? I get errors saying I might be missing References, but I can't find them in the Reference library. All the lines of code calling the on the  " using.NeuralNetwork…. " are coming up with the missing reference error.  I can't find a solution anywhere here. Apologies if there is a simple answer to this, i am not a coder. Please help, many thanks.

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using NeuralNetwork.Connections;
using NeuralNetwork.Enums;
using NeuralNetwork.HelperClasses;
using NeuralNetwork.Interfaces;
using NeuralNetwork.Neurons;
using NeuralNetwork.Settings;
using NeuralNetwork.Utils;
using System.Collections.Generic;

@Telegram Alert bot stops with "WebException":  05 May 2020, 14:17


Hi guys

I have this Telegram alert bot but everytime I start it, it crashes Onstart with "WebException" please help.

I have both the Channel ID and Key but nothing seems to work.

PS I am not a coder, so please if you could make the solutions relatively simple, I would greatly appreciate it. Many thanks

I have also changed the OnStart solution provide to the one below but still Crashes.

///////////

protected override void OnStart()
        {
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            // If you didn't set a channel, then find channels by looking at the updates
            if (string.IsNullOrEmpty(ChannelId))
            {
                _telegramChannels = ParseChannels(GetBotUpdates());
            }
            else
            {
                _telegramChannels.Add(ChannelId);
            }
            SendMessageToAllChannels("Hellow world.. ");

        }

///////////

using System;
using System.Linq;
using System.Net;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class TelegramBotExample : Robot
    {
        [Parameter("Telegram Bot Key", DefaultValue = "__bot_key__")]
        public string BOT_API_KEY { get; set; }

        // if you know which channel you want to broadcast to, add it here
        // otherwise the bot looks at the people and channels its' interacted with and
        // sends messages to everyone
        [Parameter("ChannelId", DefaultValue = "")]
        public string ChannelId { get; set; }


        List<string> _telegramChannels = new List<string>();

        protected override void OnStart()
        {
            // If you didn't set a channel, then find channels by looking at the updates
            if (string.IsNullOrEmpty(ChannelId))
            {
                _telegramChannels = ParseChannels(GetBotUpdates());
            }
            else
            {
                _telegramChannels.Add(ChannelId);
            }
            SendMessageToAllChannels("Hellow world.. ");

        }


        protected override void OnTick()
        {
            // Put your core logic here

        }

        protected override void OnBar()
        {
            // Put your core logic here
            int idx = this.MarketSeries.Close.Count - 2;
            if (this.MarketSeries.Close[idx] > this.MarketSeries.Open[idx])
            {
                SendMessageToAllChannels("Up Candle " + this.MarketSeries.Close[idx] + " " + this.MarketSeries.Open[idx]);
            }
            else
            {
                SendMessageToAllChannels("Down Candle " + this.MarketSeries.Close[idx] + " " + this.MarketSeries.Open[idx]);
            }
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }


        //  Parses messages for bot and determines which channesl are listening
        private List<string> ParseChannels(string jsonData)
        {
            var matches = new Regex("\"id\"\\:(\\d+)").Matches(jsonData);
            List<string> channels = new List<string>();
            if (matches.Count > 0)
            {
                foreach (Match m in matches)
                {
                    if (!channels.Contains(m.Groups[1].Value))
                    {
                        channels.Add(m.Groups[1].Value);
                    }
                }
            }
            foreach (var v in channels)
            {
                Print("DEBUG: Found Channel {0} ", v);
            }
            return channels;
        }

        protected int updateOffset = -1;
        private string GetBotUpdates()
        {
            Dictionary<string, string> values = new Dictionary<string, string>();
            if (updateOffset > -1)
            {
                values.Add("offset", (updateOffset++).ToString());
            }

            var jsonData = MakeTelegramRequest(BOT_API_KEY, "getUpdates", values);

            var matches = new Regex("\"message_id\"\\:(\\d+)").Matches(jsonData);
            if (matches.Count > 0)
            {
                foreach (Match m in matches)
                {
                    int msg_id = -1;
                    int.TryParse(m.Groups[1].Value, out msg_id);
                    if (msg_id > updateOffset)
                    {
                        updateOffset = msg_id;
                    }
                }
            }
            return jsonData;
        }

        private void SendMessageToAllChannels(string message)
        {
            foreach (var c in _telegramChannels)
            {
                SendMessageToChannel(c, message);
            }
        }

        private string SendMessageToChannel(string chat_id, string message)
        {
            var values = new Dictionary<string, string> 
            {
                {
                    "chat_id",
                    chat_id
                },
                {
                    "text",
                    message
                }
            };

            return MakeTelegramRequest(BOT_API_KEY, "sendMessage", values);
        }

        private string MakeTelegramRequest(string api_key, string method, Dictionary<string, string> values)
        {
            string TELEGRAM_CALL_URI = string.Format("https://api.telegram.org/bot{0}/{1}", api_key, method);

            var request = WebRequest.Create(TELEGRAM_CALL_URI);
            request.ContentType = "application/x-www-form-urlencoded";
            request.Method = "POST";

            StringBuilder data = new StringBuilder();
            foreach (var d in values)
            {
                data.Append(string.Format("{0}={1}&", d.Key, d.Value));
            }
            byte[] byteArray = Encoding.UTF8.GetBytes(data.ToString());
            request.ContentLength = byteArray.Length;

            Stream dataStream = request.GetRequestStream();

            dataStream.Write(byteArray, 0, byteArray.Length);

            dataStream.Close();

            WebResponse response = request.GetResponse();

            Print("DEBUG {0}", ((HttpWebResponse)response).StatusDescription);

            dataStream = response.GetResponseStream();

            StreamReader reader = new StreamReader(dataStream);

            string outStr = reader.ReadToEnd();

            Print("DEBUG {0}", outStr);

            reader.Close();

            return outStr;


        }
    }
}

@Optimization Problem:  05 May 2020, 14:04


Hi Panagiotis

I am trying to optimise my Algo but every time I start the process, the application freezes. This started after the last update. Before this everything was fine (However this could just be a coincidence, I don't know). Any help would be much appreciated, thanks.

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class GwaveAI : Robot
    {

        [Parameter("PeriodMALong", DefaultValue = 23)]
        // The period of the average required to determine the trend
        public int Period_MA_Long { get; set; }

        [Parameter("PeriodBB", DefaultValue = 22)]
        // Period of average bollinger
        public int Period_BB { get; set; }

        [Parameter("Deviation", DefaultValue = 1.5)]
        // Deviation Bollinger Bands
        public double Deviation { get; set; }

        [Parameter("Reserve", DefaultValue = 28)]
        // indent (in points) from the boundaries of the bollinger bands to set the stop loss
        public int Reserve { get; set; }

        [Parameter("Volume", DefaultValue = 20000)]
        // opening position volume
        public int vol { get; set; }

        [Parameter("Take Profit", DefaultValue = 163)]
        public int TakeProfit { get; set; }

        [Parameter("Stop Loss", DefaultValue = 139)]
        public int StopLoss { get; set; }

        [Parameter("MovingAverage Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType _paramMAType { get; set; }

        [Parameter("KeltnerChannels MA Period", DefaultValue = 24)]
        public int _paramKeltnerChannlesMAPeriod { get; set; }

        [Parameter("KeltnerChannels ATR Period", DefaultValue = 9)]
        public int _paramKeltnerChannlesAtrPeriod { get; set; }

        [Parameter("KeltnerChannels BandDistance", DefaultValue = 2.1)]
        public double _paramKeltnerChannlesBandDistance { get; set; }

        [Parameter("STO %K Periods", DefaultValue = 8, MinValue = -21)]
        public int KPeriods { get; set; }

        [Parameter("STO %K Slowing", DefaultValue = 1, MinValue = -21)]
        public int KSlowing { get; set; }

        [Parameter("STO %D Periods", DefaultValue = 2, MinValue = -21)]
        public int DPeriods { get; set; }


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

        [Parameter("x2", DefaultValue = -155)]
        public int x2 { get; set; }

        [Parameter("x3", DefaultValue = -215)]
        public int x3 { get; set; }

        [Parameter("x4", DefaultValue = 138)]
        public int x4 { get; set; }

        [Parameter("FastMA", DefaultValue = 5)]
        public int FastMA { get; set; }

        [Parameter("SlowMA", DefaultValue = 20)]
        public int SlowMA { get; set; }

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

        private StochasticOscillator _SOC;
        private KeltnerChannels _indicatorKeltnerChannels;
        private BollingerBands bb;
        private MovingAverage sma;
        private Position pos;
        private bool IsOpenPos = false;
        private double sl;


        private MacdHistogram macd;


        protected override void OnStart()
        {

            string text = "EAI by Gwave";

            base.ChartObjects.DrawText("EAI by Gwave", text, StaticPosition.TopLeft, new Colors?(Colors.Lime));

            sma = Indicators.MovingAverage(MarketSeries.Close, Period_MA_Long, MovingAverageType.Simple);
            bb = Indicators.BollingerBands(MarketSeries.Close, Period_BB, Deviation, MovingAverageType.Simple);
            macd = Indicators.MacdHistogram(SlowMA, FastMA, 3);
            _indicatorKeltnerChannels = Indicators.KeltnerChannels(_paramKeltnerChannlesMAPeriod, _paramMAType, _paramKeltnerChannlesAtrPeriod, _paramMAType, _paramKeltnerChannlesBandDistance);
            _SOC = Indicators.StochasticOscillator(KPeriods, KSlowing, DPeriods, MovingAverageType.Simple);

        }

        protected override void OnTick()
        {

            var top = bb.Top.Last(1);
            var bottom = bb.Bottom.Last(1);
            var main = bb.Main.Last(1);

            var ktop = _indicatorKeltnerChannels.Top.Last(1);
            var kbottom = _indicatorKeltnerChannels.Bottom.Last(1);
            var kmain = _indicatorKeltnerChannels.Main.Last(1);

            var currentD = _SOC.PercentD.Last(0);
            var currentK = _SOC.PercentK.Last(0);
            var previousD = _SOC.PercentD.Last(1);
            var previousK = _SOC.PercentK.Last(1);


            double per = percertron();
            int last = MarketSeries.Close.Count - 1;

            int tradeCount = 0;
            tradeCount++;

            string Label = tradeCount.ToString();

            if (!(MarketSeries.Open[last] == MarketSeries.High[last] && MarketSeries.Open[last] == MarketSeries.Low[last]))
                return;


            if (IsOpenPos)
            {
                if ((pos.TradeType == TradeType.Buy && Symbol.Ask > bb.Top[last]) || (pos.TradeType == TradeType.Sell && Symbol.Bid < bb.Bottom[last]))
                    Trade.Close(pos);

                // opening a long position
                if (per > 0 && currentK >= currentD && previousK < previousD && currentK < 20)
                {
                    Trade.CreateBuyMarketOrder(Symbol, vol);
                    IsOpenPos = true;
                }

                // opening a short position
                if (per < 0 && currentK <= currentD && previousK > previousD && currentK > 80)
                {
                    Trade.CreateSellMarketOrder(Symbol, vol);
                    IsOpenPos = true;
                }

            }

            if (!IsOpenPos)
            {
                // opening a long position
                if (per > 0 && currentK >= currentD && previousK < previousD && currentK < 20)
                {
                    Trade.CreateBuyMarketOrder(Symbol, vol);
                    IsOpenPos = true;
                }

                // opening a short position
                if (per < 0 && currentK <= currentD && previousK > previousD && currentK > 80)
                {
                    Trade.CreateSellMarketOrder(Symbol, vol);
                    IsOpenPos = true;
                }


            }

            if (pos != null)
            {

                foreach (var position in Positions.FindAll("Label"))
                {

                    if (pos.TradeType == TradeType.Buy && Symbol.Ask > top)
                    {
                        Trade.Close(pos);
                    }
                    else
                    {
                        if ((Symbol.Ask > main) && Symbol.Ask > sl + StopLoss * 2 * Symbol.PointSize)
                            Trade.ModifyPosition(pos, Symbol.Ask - StopLoss * Symbol.PointSize, 50.5);
                    }
                    if (pos.TradeType == TradeType.Sell && Symbol.Bid < bottom)
                    {
                        Trade.Close(pos);
                    }
                    else
                    {
                        if ( (Symbol.Bid < main) && Symbol.Bid < sl - StopLoss * 2 * Symbol.PointSize)

                            Trade.ModifyPosition(pos, Symbol.Bid + StopLoss * Symbol.PointSize, -50.5);
                    }

                }

            }

        }


        protected override void OnStop()
        {
            // Put your deinitialization logic here

        }

        private double percertron()
        {
            int last = MarketSeries.Close.Count - 1;
            double w1 = x1 - 100;
            double w2 = x2 - 100;
            double w3 = x3 - 100;
            double w4 = x4 - 100;
            double a1 = macd.Histogram[last - 1];
            double a2 = macd.Histogram[last - 1 - Step];
            double a3 = macd.Histogram[last - 1 - Step * 2];
            double a4 = macd.Histogram[last - 1 - Step * 3];
            return w1 * a1 + w2 * a2 + w3 * a3 + w4 * a4;
        }


        protected override void OnPositionOpened(Position openedPosition)
        {

            pos = openedPosition;
            Trade.ModifyPosition(openedPosition, GetAbsoluteStopLoss(openedPosition, StopLoss), GetAbsoluteTakeProfit(openedPosition, TakeProfit));

            if (pos.TradeType == TradeType.Buy)
                Trade.ModifyPosition(pos, bb.Bottom[bb.Bottom.Count - 1] - Reserve * Symbol.PointSize, 0);
            if (pos.TradeType == TradeType.Sell)
                Trade.ModifyPosition(pos, bb.Top[bb.Top.Count - 1] + Reserve * Symbol.PointSize, 0);
        }

        private double GetAbsoluteStopLoss(Position openedPosition, int stopLossInPips)
        {
            return pos.TradeType == TradeType.Buy ? pos.EntryPrice - Symbol.PipSize * stopLossInPips : pos.EntryPrice + Symbol.PipSize * stopLossInPips;
        }

        private double GetAbsoluteTakeProfit(Position openedPosition, int takeProfitInPips)
        {
            return pos.TradeType == TradeType.Buy ? pos.EntryPrice + Symbol.PipSize * takeProfitInPips : pos.EntryPrice - Symbol.PipSize * takeProfitInPips;
        }


    }
}

@Windows 2016 Datacentre cAlgo download ERROR -2146697202:  19 Jun 2019, 16:01


Hi Panagiotis

Thanks for the reply but no joy. I am not sure what else to try, as i have tried all browsers and still the same ERROR message comes up.

Regards

Gwave

@Windows 2016 Datacentre cAlgo download ERROR -2146697202:  19 Jun 2019, 14:02


Panagiotis Charalampous said:

Hi Gwave,

The reason of the problem is described here. Replacing http to https seems to bypass the problem. In case you face this in the future again, have it in mind.

Best Regards,

Panagiotis

Hi Panagiotis

My VM windows machine has been updated with the "lastest Windows update" and this problem has recurred again. I can't seem to download cTrader again.

Your help will be most appreciated as i can't seem to resolve this issue. Please see below for the reason(s) coming up when i try to download cTrader.

APPLICATION SUMMARY

                * Installable application.

                * Trust url parameter is set.

ERROR SUMMARY

                Below is a summary of the errors, details of these errors are listed later in the log.

                * Activation of http://fxpro.ctrader.com/xTrader-FxPro.application resulted in exception. Following failure messages were detected:

                                + Deployment and application do not have matching security zones.

COMPONENT STORE TRANSACTION FAILURE SUMMARY

                No transaction error was detected.

WARNINGS

                There were no warnings during this operation.

OPERATION PROGRESS STATUS

                * [19-Jun-19 11:50:01 AM] : Activation of http://fxpro.ctrader.com/xTrader-FxPro.application has started.

                * [19-Jun-19 11:50:03 AM] : Processing of deployment manifest has successfully completed.

                * [19-Jun-19 11:50:03 AM] : Installation of the application has started.

ERROR DETAILS

                Following errors were detected during this operation.

                * [19-Jun-19 11:50:03 AM] System.Deployment.Application.InvalidDeploymentException (Zone)

                                - Deployment and application do not have matching security zones.

                                - Source: System.Deployment

                                - Stack trace:

                                                at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)

                                                at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)

                                                at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)

                                                at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl, Uri& deploymentUri)

                                                at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)

--- End of stack trace from previous location where exception was thrown ---

                                                at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

                                                at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)

                                                at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

@ErrorCode--Crashed in OnTick with NullReferenceException: Object reference not set to an instance of an object.:  27 Mar 2019, 15:21


Waxy said:

Sorry the right answer is the last one, forum doesn't allow to edit post.

Thank you very much mate. Cheers!

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
cTrader User ID
  0
  5
  92
by Gwave
free  23 Nov 2021
This is a simple indicator from E7 Academy, use it if you need to get your cTrader ID. Your cTrader ID will be located at the top of the chart in lime green. Simply add this indicator to a chart or add an instance to this indicator. Happy hunting.
E7 BBKG Indicator
  0
  5
  162
by Gwave
paid  23 Nov 2021
With a 80% plus accuracy rate, this is a custom indicator from E7 Academy used to show both, possible reversal and trending areas in price movements. Ideally used with the E7 system. This is a custom, proprietary indicator developed using the E7Qnet deep neural network, learning system. Download the Indicator Watch a live stream here The pictures below are examples of EURGBP 30min, 1hr and 4hr charts respectively. These also include the smoothed custom E7 Polynomial Regression Channel indicator as used in the E7 strategy. EURGBP 30mins EURGBP 1hr EURGBP 4hr 
E7 KDJ
  0
  5
  591
by Gwave
free  23 Nov 2021
This is a customised version from E7 Academy, it is derived from the Stochastic Oscillator with the only difference being an extra line called the J line. Values of %K and %D lines show if the security is overbought or oversold. The J line represents the divergence of the %D value from the %K. Download the Indicator Watch a live stream here The pictures below are examples of a 30min, 1hr and 4hr chart respectively.
by Gwave
paid  24 Nov 2021
This is a customised and smoothed version of the standard Polynomial Regression Channel, from E7 Academy. This allows for better analysis as taught in the E7 strategies. Download the Indicator Watch a live stream here The pictures below are examples of GBPUSD 30min, 1hr and 4hr charts respectively. GBPUSD 30mins GBPUSD 1hr GBPUSD 4hr    
by Gwave
paid  23 Nov 2021
From E7 Trading, Bollinger Bands as a cloud as requested by some on here. As usual, please find the 30min, 1hr and 4hr examples to give you an idea of what it will look like on your charts. Hope you find this helpful, regards. Download the Indicator Watch a live stream here The pictures below are examples of a 30min, 1hr and 4hr chart respectively.    
E7 ADXR
  0
  5
  556
by Gwave
free  07 Mar 2021
Average Directional Movement Index Rating - ADXR, is a smoothed version of the Average Directional Index ( ADX ) which attempts to measure the strength of a price movement in positive and negative directions, as well as the strength of the trend. Download the Indicator Watch a live stream here The pictures below are examples of a 30min, 1hr and 4hr chart respectively.    
Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.