claye.weight's avatar
Claye Weight
Claye Weight's avatar

Info

Username:claye.weight
Name:Claye Weight
Member since: 02 Aug 2019
Country:Australia

Favorite symbols:

AUDUSD

About

6+ Years Experience in Programming 3+ Years Experience in Trading

Signature

None

Last Algorithm Comments

@1H Trend Scalper | 12%+ May LIVE Tested:  02 Jun 2021, 11:24


Yes Here, https://www.myfxbook.com/members/ClayeW/robots/8327659 The thing is I use all my other robots on this account also. May was the only month where I turned everything else off. So the results won't be accurate outside May. I guess if enough people are interested, I can set this robot up on it's own account, but so far you're the only one haha. But for complete transparency, this robot has started June off with 2 losses totaling -$57, or -5% - quite a hit. But we will see how it goes. 

@Trend Master V1:  02 Aug 2019, 14:39


Obviously the above script isn't the actual script. Again, leave a comment or send me a message for the script.

Last Forum Posts

@Multi-Time Frame Data Series:  15 Jun 2021, 02:49


Thank you! This helps heaps!!

it works great!

amusleh said:

Hi,

I created a MTF exponential moving average for you:

using cAlgo.API;
using cAlgo.API.Internals;
using System;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class MTFEMA : Indicator
    {
        private Bars _baseTimeFrameBars;

        private DataSeries _baseSeries;

        private double _multiplier;

        private bool _isInitialized;

        private int _baseTimeFramePreviousIndex;

        private double _baseTimeFramePreviousEma;

        [Parameter(DefaultValue = 14)]
        public double Periods { get; set; }

        [Parameter("Source", DefaultValue = DataSource.Close)]
        public DataSource Source { get; set; }

        [Parameter("Base Time Frame")]
        public TimeFrame BaseTimeFrame { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        protected override void Initialize()
        {
            _baseTimeFrameBars = MarketData.GetBars(BaseTimeFrame);

            _baseSeries = GetSeries(Source);

            _multiplier = 2 / (Periods + 1);
        }

        public override void Calculate(int index)
        {
            var baseTimeFrameIndex = _baseTimeFrameBars.OpenTimes.GetIndexByTime(Bars[index].OpenTime);

            if (baseTimeFrameIndex < Periods) return;

            if (!_isInitialized)
            {
                Result[index] = GetAverage(baseTimeFrameIndex);

                _isInitialized = true;
            }
            else
            {
                Result[index] = (_baseTimeFrameBars[baseTimeFrameIndex].Close - _baseTimeFramePreviousEma) * _multiplier + _baseTimeFramePreviousEma;
            }

            if (baseTimeFrameIndex != _baseTimeFramePreviousIndex)
            {
                _baseTimeFramePreviousIndex = baseTimeFrameIndex;
                _baseTimeFramePreviousEma = Result[index];
            }
        }

        private double GetAverage(int index)
        {
            var lastIndex = index - Periods;

            double sum = 0;

            for (var i = index; i > lastIndex; i--)
            {
                sum += _baseSeries[i];
            }

            return sum / Periods;
        }

        private DataSeries GetSeries(DataSource dataSource)
        {
            switch (dataSource)
            {
                case DataSource.Open:
                    return _baseTimeFrameBars.OpenPrices;

                case DataSource.High:
                    return _baseTimeFrameBars.HighPrices;

                case DataSource.Low:
                    return _baseTimeFrameBars.LowPrices;

                case DataSource.Close:
                    return _baseTimeFrameBars.ClosePrices;

                case DataSource.Volume:
                    return _baseTimeFrameBars.TickVolumes;

                case DataSource.Typical:
                    return _baseTimeFrameBars.TypicalPrices;

                case DataSource.Weighted:
                    return _baseTimeFrameBars.WeightedPrices;

                case DataSource.Median:
                    return _baseTimeFrameBars.MedianPrices;

                default:
                    throw new ArgumentOutOfRangeException("dataSource");
            }
        }
    }

    public enum DataSource
    {
        Open,
        High,
        Low,
        Close,
        Volume,
        Typical,
        Median,
        Weighted
    }
}

I checked it gives same result like built-in EMA, only the last bar value might be different because it waits for bar to finish then it updates the value as it should consider other time frames data, hopefully this will help you.

@Multi-Time Frame Data Series:  14 Jun 2021, 13:23


My goal is to do an calculation for another time frames', close, open high, low. Then I want to turn that result into an EMA

Yeah, I want to calculate the EMA for another time frame. But it won't just be the close, so I can't use:

Ema4 = Indicators.ExponentialMovingAverage(barsTF1.ClosePrices, Periods4);

Which is why trying to create a data series. (if that's the right thing to do?)

for what you posted; I set EMA3 to the same time frame and period as EMA4 (the one with the data series) and made them both just the close (no high - low) and the results are different?

Am I missing something?

I appreciate all the help

amusleh said:

Hi,

I don't know what you are trying to do, but the correct way to work with another time frame data is what I just posted.

Do you want to calculate the exponential moving average value of another time frame? 

@Multi-Time Frame Data Series:  14 Jun 2021, 12:58


Hey, Thanks for the reply and your help!

unfortunately i'm still having issues. On certain time frames the EMA returns NaN - and when it does return a value. It doesn't return the correct values.

I've taken out -         (High(index) + Low(index)) / 2;

and i'm just trying to print the correct values of a regular moving average. It seems to be something with the dataseries, but i dont know what. As soon as I take it out and write

Ema4 = Indicators.ExponentialMovingAverage(barsTF1.ClosePrices, Periods4);

It works. But i need to use a data series so I can perform calculations on the price....

not sure what to do.

amusleh said:

Hi,

You can't use index for another time frame bars data, in your code you used the current chart bars index to get another time frame bars data: barsTF1.ClosePrices[index]

Try this:

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TripleEMA : Indicator
    {
        [Parameter("EMA Fast", DefaultValue = 50)]
        public int Periods { get; set; }

        [Parameter("EMA Slow", DefaultValue = 100)]
        public int Periods1 { get; set; }

        [Parameter("EMA Trend", DefaultValue = 200)]
        public int Periods2 { get; set; }

        [Parameter("EMA Trend", DefaultValue = 100)]
        public int Periods3 { get; set; }

        [Parameter("TimeFrame", DefaultValue = "Daily")]
        public TimeFrame EMATimeframe1 { get; set; }

        [Output("EMA1", LineColor = "Blue")]
        public IndicatorDataSeries EMA1 { get; set; }

        [Output("EMA2", LineColor = "Red")]
        public IndicatorDataSeries EMA2 { get; set; }

        [Output("EMA3", LineColor = "Yellow")]
        public IndicatorDataSeries EMA3 { get; set; }

        private Bars series1;
        private Bars barsTF1;

        private ExponentialMovingAverage Ema1;
        private ExponentialMovingAverage Ema2;
        private ExponentialMovingAverage Ema3;
        private ExponentialMovingAverage Ema4;

        private IndicatorDataSeries _iDataSeries1;

        protected override void Initialize()
        {
            //series1 = MarketData.GetSeries(EMATimeframe1);
            series1 = MarketData.GetBars(EMATimeframe1);

            Ema1 = Indicators.ExponentialMovingAverage(series1.ClosePrices, Periods);
            Ema2 = Indicators.ExponentialMovingAverage(series1.ClosePrices, Periods1);
            Ema3 = Indicators.ExponentialMovingAverage(series1.ClosePrices, Periods2);

            barsTF1 = MarketData.GetBars(TimeFrame.Hour4);
            _iDataSeries1 = CreateDataSeries();

            Ema4 = Indicators.ExponentialMovingAverage(_iDataSeries1, Periods3);
        }

        public override void Calculate(int index)
        {
            var index1 = GetIndexByDate(series1, Bars.OpenTimes[index]);
            if (index1 != -1)
            {
                EMA1[index] = Ema1.Result[index1];
            }

            var index2 = GetIndexByDate(series1, Bars.OpenTimes[index]);
            if (index2 != -1)
            {
                EMA2[index] = Ema2.Result[index2];
            }

            var index3 = GetIndexByDate(series1, Bars.OpenTimes[index]);
            if (index3 != -1)
            {
                EMA3[index] = Ema3.Result[index3];
            }

            var barsTF1Index = barsTF1.OpenTimes.GetIndexByTime(Bars[index].OpenTime);

            _iDataSeries1[index] = barsTF1.ClosePrices[barsTF1Index] - (High(index) + Low(index)) / 2;

            Print("EMA : " + Ema4.Result[index]);
        }

        private int GetIndexByDate(Bars series, DateTime time)
        {
            for (int i = series.Count - 1; i > 0; i--)
            {
                if (time == series.OpenTimes[i])
                    return i;
            }
            return -1;
        }

        private double High(int index)
        {
            double high = Bars.HighPrices[index - 10];

            for (int i = index - 10 + 1; i <= index; i++)
            {
                if (Bars.HighPrices[i] > high)
                    high = Bars.HighPrices[i];
            }

            return high;
        }

        private double Low(int index)
        {
            double low = Bars.LowPrices[index - 10];

            for (int i = index - 10 + 1; i <= index; i++)
            {
                if (Bars.LowPrices[i] < low)
                    low = Bars.LowPrices[i];
            }

            return low;
        }
    }
}

@Multi-Time Frame Data Series:  13 Jun 2021, 17:21


Hi,

I'm trying to build a multi time frame Moving Average indicator. I have the first 3 EMAs set and working correctly - But I want to add the 4th EMA differently. 

I want to do a custom calculation for the 4th EMA data series. But I'm not getting the correct value for the MA for that timeframe. 

Am I going about this the right way? Any help would be appreciated.

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TripleEMA : Indicator
    {
        [Parameter("EMA Fast", DefaultValue = 50)]
        public int Periods { get; set; }

        [Parameter("EMA Slow", DefaultValue = 100)]
        public int Periods1 { get; set; }

        [Parameter("EMA Trend", DefaultValue = 200)]
        public int Periods2 { get; set; }

        [Parameter("EMA Trend", DefaultValue = 100)]
        public int Periods3 { get; set; }

        [Parameter("TimeFrame", DefaultValue = "Daily")]
        public TimeFrame EMATimeframe1 { get; set; }

        [Output("EMA1", LineColor = "Blue")]
        public IndicatorDataSeries EMA1 { get; set; }

        [Output("EMA2", LineColor = "Red")]
        public IndicatorDataSeries EMA2 { get; set; }

        [Output("EMA3", LineColor = "Yellow")]
        public IndicatorDataSeries EMA3 { get; set; }

        private Bars series1;
        private Bars barsTF1;

        private ExponentialMovingAverage Ema1;
        private ExponentialMovingAverage Ema2;
        private ExponentialMovingAverage Ema3;
        private ExponentialMovingAverage Ema4;

        private IndicatorDataSeries _iDataSeries1;

        protected override void Initialize()
        {
            //series1 = MarketData.GetSeries(EMATimeframe1);
            series1 = MarketData.GetBars(EMATimeframe1);


            Ema1 = Indicators.ExponentialMovingAverage(series1.ClosePrices, Periods);
            Ema2 = Indicators.ExponentialMovingAverage(series1.ClosePrices, Periods1);
            Ema3 = Indicators.ExponentialMovingAverage(series1.ClosePrices, Periods2);

            barsTF1 = MarketData.GetBars(TimeFrame.Hour4);
            _iDataSeries1 = CreateDataSeries();

            Ema4 = Indicators.ExponentialMovingAverage(_iDataSeries1, Periods3);

        }

        public override void Calculate(int index)
        {

            var index1 = GetIndexByDate(series1, Bars.OpenTimes[index]);
            if (index1 != -1)
            {
                EMA1[index] = Ema1.Result[index1];
            }

            var index2 = GetIndexByDate(series1, Bars.OpenTimes[index]);
            if (index2 != -1)
            {
                EMA2[index] = Ema2.Result[index2];
            }

            var index3 = GetIndexByDate(series1, Bars.OpenTimes[index]);
            if (index3 != -1)
            {
                EMA3[index] = Ema3.Result[index3];
            }

            var index4 = GetIndexByDate(barsTF1, Bars.OpenTimes[index]);
            if (index4 != -1)
            {
                _iDataSeries1[index] = barsTF1.ClosePrices[index] - (High(index1) + Low(index1)) / 2;
                //EMA4[index] = Ema4.Result[index];
                Print("EMA : " + Ema4.Result[index4]);
            }

        }


        private int GetIndexByDate(Bars series, DateTime time)
        {
            for (int i = series.Count - 1; i > 0; i--)
            {
                if (time == series.OpenTimes[i])
                    return i;
            }
            return -1;
        }

        private double High(int index)
        {
            double high = Bars.HighPrices[index - 10];

            for (int i = index - 10 + 1; i <= index; i++)
            {
                if (Bars.HighPrices[i] > high)
                    high = Bars.HighPrices[i];
            }

            return high;
        }

        private double Low(int index)
        {
            double low = Bars.LowPrices[index - 10];

            for (int i = index - 10 + 1; i <= index; i++)
            {
                if (Bars.LowPrices[i] < low)
                    low = Bars.LowPrices[i];
            }

            return low;
        }
    }
}

@Web Trader Cancels Stop Orders at Execution:  18 Feb 2021, 10:55


Each time my Stop Limit Order gets triggered, instead of actually entering the market, it just gives me a notification saying "Order successfully been deleted". WTF!

This has costed me so much money in the last two weeks, but has been happening for much longer and I didn't realise. If you don't catch the notification that disappears in like 3 seconds, there is no way of telling what happened to the order. It just completely disappears. I could never figure out what was happening, but now I know it happens on Stop Limit Orders through the web, and it seems to be every time.

What is happening. Furious that this bug has costed me so much money. There is no way to tell if the order is going to fail, because it fails AT execution, and by the time I notice price is gone without me because of the way i trade.

Help would be appreciated.

@What's New in cTrader Automate API 4.0:  04 Feb 2021, 09:09


Hi,

When will this update be push out and available for everyone, not just public beta users?

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.

No uploaded.

Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.
paid  29 May 2021
cTrader Trading Hotkeys. Create 10 programmable hotkeys in cTrader using this robot. Execute market orders, buy or sell, with variance in volume, or percentage risk of your account total. Close and modify any/all positions with different degrees of percentage. - Complete customisation of 10 hotkeys - Built with complete Risk/Reward Management. - Automatically calculate lot size from percentage of your total account with the click of one button Purchase includes all future updates   Download cTrader Hotkeys Now! Trading HotKeys | Trade Management Keys   cTrader Hotkey Guide Find the complete guide on how to use Orbital Trading’s Hotkeys for cTrader here.   The uploaded file here doesn't contain anything, its a commercial product and you must use our company website to download it.
free  29 May 2021
GBPUSD H1 +141% From Oct 2018 - Oct 2020 Jan 1st - Now forward tested +36% with 35 trades   Since launch, AUDUSD and EURUSD have both been added to increase profitability That's just the beginning… This trading system uses the RSI extremes in conjunction with multiple moving averages for accurate entry signals. Paired with risk management, this robot is simple but effective.      RSI w/ Moving Average Crossover   Features Enhanced implementation of the RSI and Moving Averages Advanced entry and exit confirmations Exiting trend trades when they are about to reverse Dynamic trading volume based on % of equity/balance High-performance/accuracy backtesting and optimization Telegram Message implementation - Get notified when the robot enters/exits a position Turn off 'Execute Trades' and use the robot with Telegram as a signal provider.      
Trend Master V1
  6
  0
  1378
paid  29 May 2021
Trend Master is a new bot that I've developed and even with it being in the early development, It's quite profitable. It uses multiple different moving averages to determine the trend by calculating the current distance between the moving averages now verses the past. The bot uses this information to determine the perfect time to initiate a short (Currently the bot only shorts, I'm working on adding in long too). Once in a position it places a fixed stop as well as a moving average cross over stop, with two profit targets.  Trend Master V1 - Uses 5 Moving Averages to calculate trend - Identifies optimal entry point - Fixed and Moving Average cross over stop loss - 2 Profit targets   Currently profitable with AUDUSD on 15min Timeframe. Purchase this robot now! Trend Master V1 Future Updates: - Adding Longs (aiming to improve total trades by 50%) - More places to initiate a short with the given MAs