Topics
03 Jan 2024, 18:24
 223
 4
11 Mar 2021, 11:23
 804
 2
12 Jul 2020, 17:21
 952
 4
04 Jun 2020, 17:42
 876
 2
11 May 2020, 00:58
 919
 6
23 Jul 2019, 16:05
 861
 7
17 Jul 2019, 21:32
 1187
 2
Replies

eliezer_barros
29 May 2024, 13:39

RE: MACD showing incorrect information

PanagiotisCharalampous said: 

Hi there,

Please share your cBot code and cBot parameters to reproduce this behavior.

Best regards,

Panagiotis

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

namespace cAlgo.Robots
{
   // [Robot(AccessRights = AccessRights.FullAccess)]
     [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class Macdnasdaq : Robot
    {
           
        [Parameter("Volume", DefaultValue = 1.00)]
        public double VolumeToOpenOrders { get; set; }

        [Parameter("Profit", DefaultValue = 30)]
        public int TakeProfitInPips { get; set; }

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

        [Parameter("Data Source")]
        public DataSeries Price { get; set; }

        [Parameter("MACD Period", DefaultValue = 9)]
        public int MACDPeriod { get; set; }

        [Parameter("Long Cycle", DefaultValue = 26)]
        public int LongCycle { get; set; }

        [Parameter("Short Cycle", DefaultValue = 12)]
        public int ShortCycle { get; set; }
        
        private MacdCrossOver _MACD;
        public DirectionalMovementSystem _DMS;


        [Parameter("DMS Period", DefaultValue = 9)]
        public int DMSPeriod { get; set; }

        private const string label = "MACD";

        protected override void OnStart()
        {
           _MACD = Indicators.MacdCrossOver(LongCycle, ShortCycle, MACDPeriod);
           _DMS = Indicators.DirectionalMovementSystem(DMSPeriod);
        }

        protected override void OnBar()
        {
            var upposition = Positions.Find(label, SymbolName, TradeType.Buy);
            var downposition = Positions.Find(label, SymbolName, TradeType.Sell);
            
                       
        
          Print (" Mac last value " , _MACD.MACD.LastValue, " MAC sinal   " , _MACD.Signal.LastValue, "  Histogram  " , _MACD.Histogram.LastValue);  
      
 
            if (_MACD.MACD.HasCrossedAbove(_MACD.Signal.LastValue,1))
    
            {
                if (downposition != null)
                {
                    ClosePosition(downposition);
                }

                if (upposition == null)
                {
                    ExecuteMarketOrder(TradeType.Buy, Symbol.Name, VolumeToOpenOrders, label, StopLoss, TakeProfitInPips);

                }
            }
            
            if (_MACD.MACD.HasCrossedBelow(_MACD.Signal.LastValue,1))
            {
                if (upposition != null)
                {
                    ClosePosition(upposition);
                }

                if (downposition == null)
                {
                    ExecuteMarketOrder(TradeType.Sell, Symbol.Name, VolumeToOpenOrders, label, StopLoss, TakeProfitInPips);
                   }
            }
           }
        }
    }

 


@eliezer_barros

eliezer_barros
08 Jan 2024, 17:35

RE: error to run cbots

PanagiotisCharalampous said: 

Hi Eliezer,

It's a known issue and will be solved in an upcoming update. In the meanwhile, try providing full access to your cBot and let us know if it works.

Best regards,

Panagiotis

Panagiotes

Look at the print screen I sent, I used a standart script for test and error to continue.

In your message you recommend giving cbots full access, so what do you really want me to do?

Tks

Eliézer

 


@eliezer_barros

eliezer_barros
18 Dec 2023, 19:56 ( Updated at: 21 Dec 2023, 09:23 )

RE: Ctrader automate not working cached data not available or corrupted.

Spotware said: 

Dear trader,

Thank you for reporting this issue. In order to assist you we will need some more information. Therefore please follow the steps below

  1. Try to reproduce the issue once more and send us send us some troubleshooting information. Paste a link to this discussion inside the text box/
  2. Please reset your local data and try again. Let us know if this resolves the issue 
  3. Please let us know if you are using two different versions side by side.

Best regards,

cTrader Team


 

I did this procedure and the problem is not solved.

Please, send me other alternative.

below a screen shoot of the problem.

 

image.png

@eliezer_barros

eliezer_barros
06 May 2023, 15:23

RE: RE: dark modr

firemyst said:I feel that option to change to dark mode is not good. I hope that Ctrade change for easy alternative.

PanagiotisChar said:

Hi firemyst,

I have no insight into the decision making process. I just explain how it works :) 

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

I know. All's good. I'm not pointing fingers or anything at you :-)

I just can't believe some of the decisions Spotware makes at times. Almost every other app has developers that give users the choice of using a light, dark, or default system theme for using their software on mobile devices. Why Spotware decided to not do this as well (since they already had it as an option for charts) is just mind boggling.

 


@eliezer_barros

eliezer_barros
02 May 2023, 14:52 ( Updated at: 21 Dec 2023, 09:23 )

RE: bug example

PanagiotisChar said:

Hi there,

In order to get assistance, you need to share your source code and let us know what the exact problems are.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

This is the error, just it

 

You ask me for the source....so please see below

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

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class ThreeWhiteSoldiersandThreeBlackCrows : Robot
    {
        [Parameter(DefaultValue = 1000)]
        public double Volume { get; set; }
        
        [Parameter(DefaultValue = 10)]
        public double TakeProfit { get; set; }
        
         [Parameter(DefaultValue = 10)]
        public double StopLoss { get; set; }

           
        protected override void OnBar()
        {
        //Three White Soldiers
        if(Bars.ClosePrices.Last(1) > Bars.OpenPrices.Last(1) 
        && Bars.ClosePrices.Last(2) > Bars.OpenPrices.Last(2) 
        && Bars.ClosePrices.Last(3) > Bars.OpenPrices.Last(3))
        
        {
        ExecuteMarketOrder(TradeType.Buy, SymbolName, Volume, "", StopLoss, TakeProfit);
        }

        //Three Black Crows
        if(Bars.ClosePrices.Last(1) < Bars.OpenPrices.Last(1) 
        && Bars.ClosePrices.Last(2) < Bars.OpenPrices.Last(2) 
        && Bars.ClosePrices.Last(3) < Bars.OpenPrices.Last(3))
        
        {
        ExecuteMarketOrder(TradeType.Sell, SymbolName, Volume, "", StopLoss, TakeProfit);
        }
}
        
    }
}

 


@eliezer_barros

eliezer_barros
06 Aug 2020, 20:39 ( Updated at: 21 Dec 2023, 09:22 )

RE:

PanagiotisCharalampous said:

Hi eliezer,

I tried reproducing this trade with the cBot you sent but I do not get such a position opened. See below

Best Regards,

Panagiotis 

Join us on Telegram

 

The test that you made is correct, the position was opened. Now I want to you put the two curves of the exponential average over the candle graphics and you can see that is different of the bot done.

This is my problem, the software is different of the curves and I can understand why.

tks


@eliezer_barros

eliezer_barros
05 Aug 2020, 22:54 ( Updated at: 21 Dec 2023, 09:22 )

RE: RE:

eliezer_barros said:

PanagiotisCharalampous said:

Hi Eliezer,

You did not provide steps to reproduce the problem

Best Regards,

Panagiotis 

Join us on Telegram

 

If you check the instant when the line crossed in software and see the same point directly over the line (manually) the values are different.

Other possibility to see, if your include a Print("_emaFast.Result"); and check what the software made, the values are different and i can't understand why.

tks

Hi, Please see the picture below

This test was made with XAUUSD and if you check for July/31, the lines was not crossed, but the system open a position.

I can't find the problem and I am comparing the same values to curve and to software.

Please, can you check what is going on?

Tks

 


@eliezer_barros

eliezer_barros
31 Jul 2020, 18:02

RE:

PanagiotisCharalampous said:

Hi Eliezer,

You did not provide steps to reproduce the problem

Best Regards,

Panagiotis 

Join us on Telegram

 

If you check the instant when the line crossed in software and see the same point directly over the line (manually) the values are different.

Other possibility to see, if your include a Print("_emaFast.Result"); and check what the software made, the values are different and i can't understand why.

tks


@eliezer_barros

eliezer_barros
31 Jul 2020, 16:26

RE:

PanagiotisCharalampous said:

Hi Eliezer,

To help you with this, you need to provide the complete cBot code as well as steps to reproduce the problem.

Best Regards,

Panagiotis 

Join us on Telegram

 

ok, please see below.

tks

 

//duas curvas
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

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

        [Parameter("Volume", DefaultValue = 1)]
        public double VolumeToOpenOrders { get; set; }

        [Parameter("Profit", DefaultValue = 400)]
        public int TakeProfitInPips { get; set; }

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

        [Parameter("Data Source")]
        public DataSeries Price { get; set; }

        //   [Parameter("Slow Periods", DefaultValue = 14)]
        public int SlowPeriods { get; set; }

        // [Parameter("Fast Periods", DefaultValue = 5)]
        public int FastPeriods { get; set; }

        // public int Parameter { get; set; }

        private ExponentialMovingAverage _emaFast;
        private ExponentialMovingAverage _emaSlow;

        private const string label = "Duas Curvas diferentes";

        private double calc = 0.0;

        protected override void OnStart()
        {
            _emaFast = Indicators.ExponentialMovingAverage(Price, 8);
            _emaSlow = Indicators.ExponentialMovingAverage(Price, 20);
        }

        //protected override void OnTick()
        protected override void OnBar()
        {

            var numfast = _emaFast.Result.Last(0);
            var numslow = _emaSlow.Result.Last(0);
            calc = numfast - numslow;

            var upposition = Positions.Find(label, SymbolName, TradeType.Buy);
            var downposition = Positions.Find(label, SymbolName, TradeType.Sell);


            if (_emaFast.Result.HasCrossedAbove(_emaSlow.Result, 0))
            {

                if (downposition != null)
                {
                    ClosePosition(downposition);
                }
                if (upposition == null)
                {
                    ExecuteMarketOrder(TradeType.Buy, Symbol.Name, VolumeToOpenOrders, label, StopLoss, TakeProfitInPips);
                }
            }


            if (_emaFast.Result.HasCrossedBelow(_emaSlow.Result, 0))
            {
                // Print("Venda calc    ", calc);
                if (upposition != null)
                {
                    ClosePosition(upposition);
                }
                if (downposition == null)
                {
                    ExecuteMarketOrder(TradeType.Sell, Symbol.Name, VolumeToOpenOrders, label, StopLoss, TakeProfitInPips);
                }
            }

        }
    }
}


@eliezer_barros

eliezer_barros
13 Jul 2020, 16:23

RE:

PanagiotisCharalampous said:

Hi Eliezer,

What do you mean when you say "real price of an open position"? What is a real price of an open position?

Best Regards,

Panagiotis 

Join us on Telegram

 

Hi Panagiotis

I am trying to get the price during the open market and I think the example is better to show what I need.

ie...If I wish to open the position when the price to reach more than 15 pips after Open Price of the current candle, I need to know the current price to compare, but in all library I don't found a function to do this.

Please, can you send me a information?

tks
Eliézer


@eliezer_barros

eliezer_barros
11 May 2020, 16:10

RE:

PanagiotisCharalampous said:

Hi Eliezer,

As the message suggests, there is no variable named index declared. It seems you are just copying and pasting code. You need to understand what you are doing. What is the index supposed to do?

Best Regards,

Panagiotis 

Join us on Telegram

As you can see in the routine, I left the declaration of the variable in stand by (//) because when I put it to use, other messages appear and as I don't master this language, msn doesn't make sense to me.

tks


@eliezer_barros

eliezer_barros
11 May 2020, 15:56

RE:

PanagiotisCharalampous said:

Hi Eliezer,

It is not clear what your problem is. You need to provide a better explanation.

Best Regards,

Panagiotis 

Join us on Telegram

 

Hi,

The information is "the name index does not exist in the current context".

  var res = Bars.ClosePrices[index] + lrs.Result[index];

 

I am trying to use this routine that was to create graphics to calculate and reproduce the same information that graphics.

thank for your help


@eliezer_barros

eliezer_barros
29 Apr 2020, 18:29

RE: WilliamsAccumulationDistribution tendency curve - Linear Regression

PanagiotisCharalampous said:

Hi Eliezer,

Only you know what the tendency curve is and how it is calculated. Therefore you will need to calculate it yourself.

Best Regards,

Panagiotis 

Join us on Telegram

Hi,

You is correct, I should have sent additional information, I am trying to use Linear Regression over the Williams Accumulator Distribution.

The routine should be indicate which hours I should be open the position and the direction (buy or sell) is dependent of Linear Regression results.

I appreciate is you could be help.

Tks


@eliezer_barros

eliezer_barros
28 Apr 2020, 21:00 ( Updated at: 21 Dec 2023, 09:22 )

RE: RE: WilliamsAccumulationDistribution tendency curve

eliezer_barros said:

PanagiotisCharalampous said:

Hi Eliezer,

I did not understand what do you need. Can you please provide a more detailed explanation? Maybe a drawing depicting what you expect to see?

Best Regards,

Panagiotis 

Join us on Telegram

Hi

Please see the example below, I took a part of the curve and you can see that is impossible to determine the correct direction of this curve to open the new position.

I want that this routine pick last 5 hours, determine the direction of the tendency line if up or down and create a new position according.

May you help me?

tks

 

 


@eliezer_barros

eliezer_barros
27 Apr 2020, 17:00

RE: WilliamsAccumulationDistribution tendency curve

PanagiotisCharalampous said:

Hi Eliezer,

I did not understand what do you need. Can you please provide a more detailed explanation? Maybe a drawing depicting what you expect to see?

Best Regards,

Panagiotis 

Join us on Telegram

Hi

Please see the example below, I took a part of the curve and you can see that is impossible to determine the correct direction of this curve to open the new position.

I want that this routine pick last 5 hours, determine the direction (tendency line if up or down) and create a new position according.

tks

 

 


@eliezer_barros

eliezer_barros
23 Jul 2019, 17:43


I found the problem.

For the system identify the last day, is necessary close the platform and reopen.

I my case, I was with system opened since Sunday, because I have a robot working.

Problem solved.

tks


@eliezer_barros

eliezer_barros
23 Jul 2019, 16:47

Hi,

Please, see the print shoot where the date 22 is red and impossible run the system.

 

I did this print shoot right now.


@eliezer_barros

eliezer_barros
23 Jul 2019, 16:30 ( Updated at: 21 Dec 2023, 09:21 )

My version is 3.5 and I checked with xau/usd and several Indices...continues with problem and I can't use backtesting for last day....Brocker - FXpro


@eliezer_barros

eliezer_barros
24 May 2019, 13:41

Hi Panagiotis

 

I think this is easier to change in program, because is only to considerate the how long days the position is open and to include the swap and other costs.

This will be much more real information that we have today and very import.

I now that spread is a average, not problem, anyway is more acurate that today

 

Tks

Eliézer


@eliezer_barros

eliezer_barros
25 Feb 2019, 14:47 ( Updated at: 21 Dec 2023, 09:21 )

RE:

lec0456 said:

I am not sure I understnd you but, it sounds like you just want to create a slope indicator, that will subtract the current 14 prd moving average from the previous one.  Then you feed that indicator into a cBot and make a trade when the last 3 prds are positive or negative. Here is an example of a slope indicator.

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false)]
    public class myMASlope : Indicator
    {
        [Parameter(DefaultValue = 60)]
        public int paramPeriods { get; set; }
        [Parameter(DefaultValue = 1.9)]
        public double paramLimit { get; set; }

        [Output("MA Slope", PlotType = PlotType.Histogram, Thickness = 2, Color = Colors.Purple)]
        public IndicatorDataSeries Result { get; set; }
        [Output("SlopeMA", LineStyle = LineStyle.Lines, Color = Colors.Red)]
        public IndicatorDataSeries SlopeMA { get; set; }

        [Output("UpperLimit", PlotType = PlotType.Line, LineStyle = LineStyle.DotsRare, Thickness = 1, Color = Colors.Red)]
        public IndicatorDataSeries UpperLimit { get; set; }
        [Output("LowerLimit", PlotType = PlotType.Line, LineStyle = LineStyle.DotsRare, Thickness = 1, Color = Colors.Red)]
        public IndicatorDataSeries LowerLimit { get; set; }
        [Output("Center", LineStyle = LineStyle.DotsRare, Color = Colors.White)]
        public IndicatorDataSeries CenterLine { get; set; }

        private SimpleMovingAverage sma;
        private MovingAverage slopema;
        private SimpleMovingAverage slopema2;

        protected override void Initialize()
        {
            sma = Indicators.SimpleMovingAverage(MarketSeries.Close, paramPeriods);
            slopema = Indicators.MovingAverage(Result, 2, MovingAverageType.Exponential);
            slopema2 = Indicators.SimpleMovingAverage(slopema.Result, 2);
        }

        public override void Calculate(int index)
        {
            int t0 = index;
            int t1 = t0 - 1;
            int t2 = t1 - 1;

            if (t1 < 0)  return;

            if (double.IsNaN(sma.Result[t1])) return;
          
            Result[index] = Math.Round((sma.Result[t0] - sma.Result[t1]) / (Symbol.PointSize), 2);
            SlopeMA[index] = slopema2.Result[index];
            //Result[index]= Math.Round((sma.Result[t0]-sma.Result[t2])/(Symbol.PointSize*2),2);
            UpperLimit[index] = paramLimit;
            LowerLimit[index] = -paramLimit;
            CenterLine[index] = 0;
        }
    }
}

 

Hi, thank for your suggestions, yes I want to use the curve with 14 prd and use only the last 3 or 4 hours to open the position according with direction. If I use the curve with 3 or 4 periods, in really the curve is other and the directions can be wrong.

I am do not a specialist in this kind of program and I went to do a test in system and found some errors that I will print here, if you can modify I will thanks to you again.


@eliezer_barros