Topics
12 Jul 2023, 21:59
 0
 327
 1
18 Feb 2023, 11:27
 940
 9
20 Dec 2022, 15:53
 978
 2
01 Dec 2022, 18:55
 628
 4
09 Sep 2022, 16:05
 896
 7
Replies

jaydcrowe1989
13 Jul 2023, 21:58

RE:

pedrosimao said:

Hello,

I am currently running several tests on XMT Scalper, by Capella. And besides awesome results on backtest, I am getting great results on demo. Like 100% profit per week, with low risk settings.

Unfortunately the EA scalper doesn't work so well on live accounts because Metatrader is too slow to handle the positions fast enough to become profitable. 

So, I was wondering if somebody would be interested in partner, to try to translate XMT Scalper from mq4 language into cAlgo language.

I am sure this EA has a great potential, specially on a faster platform like cTrader.

If anyone is interested I can send you the code from the original EA.

 

Cheers,

Did you ever find someone do this?


@jaydcrowe1989

jaydcrowe1989
06 Apr 2023, 09:42

RE:

PanagiotisChar said:

Hi Jay,

You need to wrap your volume with the Symbol.NormalizeVolumeInUnits() method. See below

     double newVolume = Symbol.NormalizeVolumeInUnits(currentVolume * 0.66);

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Perfect, thank you!


@jaydcrowe1989

jaydcrowe1989
17 Mar 2023, 20:37

It's ok sorted now. I've now built a console app that will decompile the .algo file


@jaydcrowe1989

jaydcrowe1989
17 Mar 2023, 14:40

RE: RE: RE:

Can you email me please. mentalman220589@hotmail.com

 

 

pick said:

jaydcrowe1989 said:

pick said:

If you can provide the file and proof that it is your intellectual property, I'd be happy to have a look. 

Of course. How would you like me to provide proof? I was under the impression that I couldn't get it back so I've deleted the source code out of my git repo, as it was way out of date and didn't work.

Are you able to provide how you might reverse engineer it?

Are there any libraries referenced that would relate to you? Any namespaces / class names?

 


@jaydcrowe1989

jaydcrowe1989
23 Feb 2023, 17:33

RE:

pick said:

If you can provide the file and proof that it is your intellectual property, I'd be happy to have a look. 

Of course. How would you like me to provide proof? I was under the impression that I couldn't get it back so I've deleted the source code out of my git repo, as it was way out of date and didn't work.

Are you able to provide how you might reverse engineer it?


@jaydcrowe1989

jaydcrowe1989
27 Jan 2023, 09:18

RE:

Yes this is what I have done but it just feels a bit of a dirty solution. It works so I guess I will stick with it. 

 

Are there going to be better parameter options and types in the future?

 

 

PanagiotisChar said:

Hi Jay,

You can use an enum.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@jaydcrowe1989

jaydcrowe1989
04 Dec 2022, 09:57

RE:

jaydcrowe1989 said:

Hi,

I am using the optimisation tool to get the optimum parameters for my bot but now and again some of the passes are getting stuck in a continuous loop in the ontick method whereas generally it runs as expected. Has anyone experienced this before? Is there something I can do within the ontick method to prevent this?

Regards,

Jay

Sorted it. One of my parameters was set to 0 which was causing the code to try and continually move the stop loss


@jaydcrowe1989

jaydcrowe1989
17 Nov 2022, 17:46

RE: RE: RE:

acrigney said:

This is definitely a problem for me now, I setup one of my traders today on a new machine and the backtest data was not cached.

jaydcrowe1989 said:

Spotware said:

Dear Jay,

Thank you for reporting this issue. Can you please record a video demonstrating this behavior?

Best Regards,

cTrader Team

Is there any update on this please?

 

The only way I could get it to work again was to uninstall all versions, run ccleaner to tidy up the registry, delete the algo and ctrader folder from my documents, the go to the AppData folder for the logged in user, delete the Spotware Folders from Local and Roaming and then reinstall Ctrader. Mine is now working.

There is definitely an issue when CTrader upgrades.


@jaydcrowe1989

jaydcrowe1989
16 Nov 2022, 12:56

RE:

Spotware said:

Dear Jay,

We were not able to reproduce the problem. Are you able to reproduce this with any of the sample bots? If not, please share your cBot code so that we can reproduce this behavior.

Best Regards,

cTrader Team

It is definitely an issue with the latest version of CTrader. I have another PC with an older version on, running the same bot and it caches the data as expected and does not have to reload it every time I close the application and re-open it.


@jaydcrowe1989

jaydcrowe1989
15 Nov 2022, 16:05

RE:

Spotware said:

Hi Jay,

Can you share some screenshots demonstrating what are you looking at?

Best regards,

cTrader Team

Is there any update on this please?


@jaydcrowe1989

jaydcrowe1989
15 Nov 2022, 16:04

RE:

Spotware said:

Dear Jay,

Thank you for reporting this issue. Can you please record a video demonstrating this behavior?

Best Regards,

cTrader Team

Is there any update on this please?


@jaydcrowe1989

jaydcrowe1989
14 Nov 2022, 12:12

RE:

Spotware said:

Dear Jay,

Thank you for reporting this issue. Can you please record a video demonstrating this behavior?

Best Regards,

cTrader Team

Please click the link below to view the short video. I run my bot over 6 months, close CTrader, re-open it and then go to re run my back test without changing anything and it has to load the data again. I am on the latest version of windows 11.

https://we.tl/t-94qNHe4bY7

 

 


@jaydcrowe1989

jaydcrowe1989
09 Nov 2022, 14:14 ( Updated at: 21 Dec 2023, 09:23 )

RE:

Spotware said:

Hi Jay,

Can you share some screenshots demonstrating what are you looking at?

Best regards,

cTrader Team

It is now actually showing some bars but they do not change and seem to be stuck when scrolling the chart. As you can see from the image, the trade is highlighted on the chart but their are no bars and they are stuck like that no matter what day I select etc.


@jaydcrowe1989

jaydcrowe1989
03 Nov 2022, 00:11

RE: RE:

capanna.paolo said:

Hi jaydcrowe1989,

I had exactly the same issue, i let it run the whole night and in the morning i had my trade statistics...so it takes ages but in the end you get what you need.

(I was backtesting on 3 years)

I logged a ticket on the cTrader help portal but no answer so far after 3 days...

Cheers

 

jaydcrowe1989 said:

Hi,

Has anyone come across the issue where CTrader hangs and freezes for quite a while once a back test has completed? I am back testing a bot over the previous year?

Cheers,

Jay

 

I have just worked out what was causing my issue! I was using the Print method quite a lot to print information to the log. I have taken these out and it no longer hangs at the end of a back test.


@jaydcrowe1989

jaydcrowe1989
25 Oct 2022, 15:46

RE: RE:

capanna.paolo said:

Hi jaydcrowe1989,

I had exactly the same issue, i let it run the whole night and in the morning i had my trade statistics...so it takes ages but in the end you get what you need.

(I was backtesting on 3 years)

I logged a ticket on the cTrader help portal but no answer so far after 3 days...

Cheers

 

jaydcrowe1989 said:

Hi,

Has anyone come across the issue where CTrader hangs and freezes for quite a while once a back test has completed? I am back testing a bot over the previous year?

Cheers,

Jay

 

Yeah no matter how long I run the back test for CTrader just freezes at the end of the back test and hangs for around 5 minutes. I can literally run the back test for one day and still the whole desktop app just freezes. Its as if it is not letting go of something? It never use to do this and I have created many different bots in CTrader


@jaydcrowe1989

jaydcrowe1989
10 Sep 2022, 13:24

RE:

PanagiotisCharalampous said:

Hi cTraderX,

Please note that Fractals indicator is a redrawing indicator. Fractals do not appear immediately but only some candles after. So you cannot expect trades to be placed on the bar immediately after the fractals.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

How do you determine which arrow was drawn last? I am trying to use the fractals indicator within a bot and I need the latest arrow that was drawn? I seem to be able to get the last up arrow and the last arrow but I have no way of determining which arrow was drawn last or a way of matching an arrow to a bar


@jaydcrowe1989

jaydcrowe1989
09 Sep 2022, 16:34

RE: RE:

prosteel1 said:

jaydcrowe1989 said:

Hi,

Has anyone used the Fractals indicator and managed to get the latest arrow successfully? So essentially the last one?

Cheers,

Jay

Fractals are a bit strange, technically you need 5 bars to confirm a fractal, with 3 bars since the high or low minimum. I have seen the indicator but have implemented it myself instead in the way I prefer.

I don't like how the indicator works myself

The youtube channel for the inventor of the fractal is youtube.com/c/Profitunity

I know how to use it and I can see it on the chart fine. My problem is when I am trying to use it within a bot I need to get the last value and determine if it was up or down. At the moment it seems like I can get the last up and the last down but not determine what the latest value was.


@jaydcrowe1989

jaydcrowe1989
09 Sep 2022, 16:34

RE: RE:

prosteel1 said:

jaydcrowe1989 said:

Hi,

Has anyone used the Fractals indicator and managed to get the latest arrow successfully? So essentially the last one?

Cheers,

Jay

Fractals are a bit strange, technically you need 5 bars to confirm a fractal, with 3 bars since the high or low minimum. I have seen the indicator but have implemented it myself instead in the way I prefer.

I don't like how the indicator works myself

The youtube channel for the inventor of the fractal is youtube.com/c/Profitunity

I know how to use it and I can see it on the chart fine. My problem is when I am trying to use it within a bot I need to get the last value and determine if it was up or down. At the moment it seems like I can get the last up and the last down but not determine what the latest value was.


@jaydcrowe1989

jaydcrowe1989
06 Sep 2022, 16:30

RE:

PanagiotisCharalampous said:

Hi Jay,

This happens when the stop loss falls within the spread. The only solution is to check your positions after opening and handle the situation accordingly.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Thank you, that makes complete sense. I have noticed there is an overridable method that I can close the trade straight away if it gets triggered and the stop loss is null, so I will use this for now. It does say that this method is obsolete though?


@jaydcrowe1989

jaydcrowe1989
26 Aug 2022, 16:35

RE:

PanagiotisCharalampous said:

Hi Jay,

It is possible to provide something that runs, so that I can run it and see the error immediatelly? 

The code you provided has errors and I cannot be guessing.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Correct the code will not run as is above because I have removed some code I want to protect and do not want to put it into the public domain. 

If you replace all of the code above marked up with asterix for example if (** Sell Criteria Met ** && trade) and just replace them with true this should then work

 

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.GMTStandardTime, AccessRights = AccessRights.FullAccess)]
    public class ParabolicSARcBot : Robot
    {
        private ParabolicSAR _parabolicSAR;
        private RelativeStrengthIndex _rsi;
        private static bool _running;

        protected override void OnStart()
        {
#if DEBUG
            System.Diagnostics.Debugger.Launch();
#endif

            _running = false;
            _parabolicSAR = Indicators.ParabolicSAR(0.02, 0.2);
            _rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, 6);
        }

        protected override void OnTick()
        {
            if (!_running)
            {
                _running = true;

                double previousRsi = _rsi.Result.Last(1);
                double latestPSar = _parabolicSAR.Result.LastValue;

                Position position = Positions.Find(nameof(ParabolicSARcBot), SymbolName);

                if (position == null)
                {
                    Bar previousBar = Bars.Last(1);
                    double previousPSar = _parabolicSAR.Result.Last(1);

                    Print($"Time: {Server.Time.TimeOfDay}, Previous Bar Open: {previousBar.OpenTime}, Previous Dot: {previousPSar}, Current Price: {Symbol.Bid}, Current Dot: {latestPSar}");

                    bool trade = true;
                    TimeSpan timeNow = Server.Time.TimeOfDay;

                    if (Time.DayOfWeek == DayOfWeek.Friday && timeNow >= new TimeSpan(21, 0, 0))
                    {
                        Print("Skipping trade as it is Friday past 9pm...");
                        trade = false;
                    }
                    else if (timeNow >= new TimeSpan(20, 0, 0) && timeNow <= new TimeSpan(23, 59, 59))
                    {
                        Print("Oh hell no...we are not trading right now...shit gonna get cray...");
                        trade = false;
                    }
                    else if (timeNow >= new TimeSpan(0, 0, 0) && timeNow <= new TimeSpan(2, 00, 00))
                    {
                        Print("Oh hell no...we are not trading right now...shit gonna get cray...");
                        trade = false;
                    }


                    if (true)
                    {
                        if (TryGetVolume(TradeType.Sell, _parabolicSAR.Result.LastValue, out double stopLossPips, out double volume))
                        {
                            TradeResult result = ExecuteMarketOrder(TradeType.Sell, SymbolName, volume, nameof(ParabolicSARcBot), stopLossPips, null);
                            result.Position.ModifyStopLossPrice(_parabolicSAR.Result.LastValue);
                        }
                    }

                    if (false)
                    {
                        if (TryGetVolume(TradeType.Sell, _parabolicSAR.Result.LastValue, out double stopLossPips, out double volume))
                        {
                            TradeResult result = ExecuteMarketOrder(TradeType.Buy, SymbolName, volume, nameof(ParabolicSARcBot), stopLossPips, null);
                            result.Position.ModifyStopLossPrice(_parabolicSAR.Result.LastValue);
                        }
                    }
                }
                else
                {
                    if (position.TradeType == TradeType.Buy)
                    {
                        if (true)
                        {
                            Print($"Close buy position...time: {Server.Time.TimeOfDay}");
                            position.Close();
                        }
                    }
                    else
                    {
                        if (false)
                        {
                            Print($"Close sell position...time: {Server.Time.TimeOfDay}");
                            position.Close();
                        }
                    }
                }

                _running = false;
            }
        }

        private void CloseBuyPositions(List<Position> currentPositions)
        {
            List<Position> buyPositions = currentPositions.Where(x => x.SymbolName == SymbolName && x.TradeType == TradeType.Buy).ToList();

            if (buyPositions.Any())
            {
                foreach (Position position in buyPositions)
                {
                    position.Close();
                }
            }
        }

        private void CloseSellPositions(List<Position> currentPositions)
        {
            List<Position> sellPositions = currentPositions.Where(x => x.SymbolName == SymbolName && x.TradeType == TradeType.Sell).ToList();

            if (sellPositions.Any())
            {
                foreach (Position position in sellPositions)
                {
                    position.Close();
                }
            }
        }

        private bool TryGetVolume(TradeType tradeType, double stopLoss, out double stopLossPips, out double volume)
        {
            bool success = false;

            double maxAmountRisked = Account.Balance * 0.01;

            double price = tradeType == TradeType.Buy ? Symbol.Bid : Symbol.Ask;
            stopLossPips = Math.Round((double)Math.Abs(price - stopLoss) / Symbol.PipSize, 1);
            volume = 0;

            if (stopLossPips > 0)
            {
                double noOfPips = (stopLossPips * Symbol.PipValue);
                double lotSize = maxAmountRisked / noOfPips;
                volume = Symbol.NormalizeVolumeInUnits(lotSize, RoundingMode.Down);
                Print($"Volume: {volume}...");
                success = true;
            }
            else
            {
                Print($"Failed to get Volume: {volume}...Stop loss pips: {stopLossPips}");
            }

            return success;
        }
    }
}


@jaydcrowe1989