Replies

PanagiotisCharalampous
03 Sep 2024, 05:23

RE: RE: RE: RE: RE: RE: RE: RE: Backtesting - Incorrect TP / SL calculation

zytotoxiziteat said: 

PanagiotisCharalampous said: 

zytotoxiziteat said: 

PanagiotisCharalampous said: 

zytotoxiziteat said: 

zytotoxiziteat said: 

zytotoxiziteat said: 

PanagiotisCharalampous said: 

Hi there,

Please share your cBot code and make sure you are using tick data for your backtests.

Best regards,

Panagiotis

using System;using System.Collections.Generic;using cAlgo.API;using cAlgo.API.Indicators;using cAlgo.API.Internals;namespace cAlgo.Robots{    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]    public class TradingBot : Robot    {        [Parameter("Risk Percentage", DefaultValue = 1, MinValue = 0.1, MaxValue = 10)]        public double RiskPercentage { get; set; }        [Parameter("Stop Loss (Pips)", DefaultValue = 40, MinValue = 0, MaxValue = 100)]        public double StopLossPips { get; set; }        [Parameter("Take Profit (Pips)", DefaultValue = 20, MinValue = 0, MaxValue = 200)]        public double TakeProfitPips { get; set; }        private AI_101.ML101.ModelInput _modelInput;        private double _lastPrediction;        protected override void OnStart()        {            _modelInput = new AI_101.ML101.ModelInput();        }        protected override void OnTick()        {            // Ensure only one open position per currency pair            if (Positions.FindAll("ML Prediction", Symbol.Name).Length > 0)                return;            // Update model input with the latest close price            _modelInput.ClosePrice = (float)Symbol.Bid;  // Use Symbol.Bid instead of Symbol.LastTick.Bid            // Get prediction            var prediction = AI_101.ML101.Predict(_modelInput);            // Calculate the predicted price change            double predictedChange = prediction.ClosePrice[0] - _modelInput.ClosePrice;            // Determine if we should open a position            if (Math.Abs(predictedChange) > Symbol.PipSize)            {                if (predictedChange > 0 && _lastPrediction <= 0)                {                    OpenPosition(TradeType.Buy);                }                else if (predictedChange < 0 && _lastPrediction >= 0)                {                    OpenPosition(TradeType.Sell);                }            }            _lastPrediction = predictedChange;        }        private void OpenPosition(TradeType tradeType)        {            // Calculate position size based on risk            double riskAmount = Account.Balance * (RiskPercentage / 100);            double volumeInUnits = riskAmount / (StopLossPips * Symbol.PipValue);            // Ensure volume is within acceptable range and increments            volumeInUnits = Symbol.NormalizeVolumeInUnits(volumeInUnits, RoundingMode.ToNearest);            // Check if the volume is valid            if (volumeInUnits < Symbol.VolumeInUnitsMin || volumeInUnits > Symbol.VolumeInUnitsMax)            {                Print("Volume is out of range: " + volumeInUnits);                return;            }            // Open the position            ExecuteMarketOrder(tradeType, Symbol.Name, volumeInUnits, "ML Prediction", StopLossPips, TakeProfitPips);        }    }}

My thought was:

Since I collected only m5 candle data for my Machine learning module I changed the “Data” in settings to “m5 bars from server” for backtesting 

and I was considering to change “protected override void OnTick()” to "protected override void OnBar()".
 

Is that wrong?

What is the best solution?

Thank you

Hi there, 

If you are using fixed SL and TP, you need to use tick data to ensure accurate results in backtesting.

Best regards,

Panagiotis

Okay, my cbot code uses

protected override void OnTick()

I still get wrong TP.

You need to use tick data on your backtesting settings. OnTick() is irrelevant.

 

Where does the option “m5 bars from server” come from?

 

 I thought the system provided the best possible set-up because of my csv file, which contains only m5 bars data. 

 

I don't understand what you mean. It's just an option in a dropdown list


@PanagiotisCharalampous

PanagiotisCharalampous
03 Sep 2024, 05:20

Dear trader,

Thank you for reporting this issue. Unfortunately we were not able to reproduce this behavior. Could you please send us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.

Best regards,

Panagiotis
 


@PanagiotisCharalampous

PanagiotisCharalampous
03 Sep 2024, 05:16

Hi there,

This is not available at the moment in cTrader for Mac.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
03 Sep 2024, 05:15

Hi there,

There is no such feature available at the moment.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
03 Sep 2024, 05:14

RE: RE: Self-hosting CALGO VPS?

karatedog said: 

PanagiotisCharalampous said: 

Hi there,

We do not have any ETA for this.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook 

Hi,

any update on this?

Thanks!

Hi there,

This has been released. Read more below

https://help.ctrader.com/ctrader-algo/ctrader-cli/?h=cli


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 08:51

Hi there,

It is not possible at the moment, neither there are any plans at the moment unfortunately.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 08:32

RE: RE: Bot crash trubleshot

kyosuke said: 

PanagiotisCharalampous said: 

Hi there,

Share your cBot code and send us some troubleshooting information the next time this happens. Please paste a link to this discussion inside the text box before you submit it.

Best regards,

Panagiotis
 

Ok sent…I sent it from another user's cTrader but please refer to me for follow up. Thanks you.

Hi there,

We need the troubleshooting for the session that experiences the problem. Can you please send it again?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 08:13

RE: RE: RE: RE: RE: RE: Backtesting - Incorrect TP / SL calculation

zytotoxiziteat said: 

PanagiotisCharalampous said: 

zytotoxiziteat said: 

zytotoxiziteat said: 

zytotoxiziteat said: 

PanagiotisCharalampous said: 

Hi there,

Please share your cBot code and make sure you are using tick data for your backtests.

Best regards,

Panagiotis

using System;using System.Collections.Generic;using cAlgo.API;using cAlgo.API.Indicators;using cAlgo.API.Internals;namespace cAlgo.Robots{    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]    public class TradingBot : Robot    {        [Parameter("Risk Percentage", DefaultValue = 1, MinValue = 0.1, MaxValue = 10)]        public double RiskPercentage { get; set; }        [Parameter("Stop Loss (Pips)", DefaultValue = 40, MinValue = 0, MaxValue = 100)]        public double StopLossPips { get; set; }        [Parameter("Take Profit (Pips)", DefaultValue = 20, MinValue = 0, MaxValue = 200)]        public double TakeProfitPips { get; set; }        private AI_101.ML101.ModelInput _modelInput;        private double _lastPrediction;        protected override void OnStart()        {            _modelInput = new AI_101.ML101.ModelInput();        }        protected override void OnTick()        {            // Ensure only one open position per currency pair            if (Positions.FindAll("ML Prediction", Symbol.Name).Length > 0)                return;            // Update model input with the latest close price            _modelInput.ClosePrice = (float)Symbol.Bid;  // Use Symbol.Bid instead of Symbol.LastTick.Bid            // Get prediction            var prediction = AI_101.ML101.Predict(_modelInput);            // Calculate the predicted price change            double predictedChange = prediction.ClosePrice[0] - _modelInput.ClosePrice;            // Determine if we should open a position            if (Math.Abs(predictedChange) > Symbol.PipSize)            {                if (predictedChange > 0 && _lastPrediction <= 0)                {                    OpenPosition(TradeType.Buy);                }                else if (predictedChange < 0 && _lastPrediction >= 0)                {                    OpenPosition(TradeType.Sell);                }            }            _lastPrediction = predictedChange;        }        private void OpenPosition(TradeType tradeType)        {            // Calculate position size based on risk            double riskAmount = Account.Balance * (RiskPercentage / 100);            double volumeInUnits = riskAmount / (StopLossPips * Symbol.PipValue);            // Ensure volume is within acceptable range and increments            volumeInUnits = Symbol.NormalizeVolumeInUnits(volumeInUnits, RoundingMode.ToNearest);            // Check if the volume is valid            if (volumeInUnits < Symbol.VolumeInUnitsMin || volumeInUnits > Symbol.VolumeInUnitsMax)            {                Print("Volume is out of range: " + volumeInUnits);                return;            }            // Open the position            ExecuteMarketOrder(tradeType, Symbol.Name, volumeInUnits, "ML Prediction", StopLossPips, TakeProfitPips);        }    }}

My thought was:

Since I collected only m5 candle data for my Machine learning module I changed the “Data” in settings to “m5 bars from server” for backtesting 

and I was considering to change “protected override void OnTick()” to "protected override void OnBar()".
 

Is that wrong?

What is the best solution?

Thank you

Hi there, 

If you are using fixed SL and TP, you need to use tick data to ensure accurate results in backtesting.

Best regards,

Panagiotis

Okay, my cbot code uses

protected override void OnTick()

I still get wrong TP.

You need to use tick data on your backtesting settings. OnTick() is irrelevant.


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 08:12

RE: RE: RE: RE: RE: Cbot access the trendlines drawn on the chart

keerthankumarkateel said: 

keerthankumarkateel said: 

PanagiotisCharalampous said: 

keerthankumarkateel said: 

PanagiotisCharalampous said: 

Hi there,

Unfortunately there is no way to set names for lines manually drawn on the chart.

Best regards,

Panagiotis

Hello,

Thank you for responding. If i want to create an algo with two mannually drawn trendlines (line-A and line-B). Logic is if the price crossed below Line-A buy the ticker and if the price touches the Line-B close the position.

 

Is this possible to implement? this needs algo to read the mannuaaly drawn trendline, identify it and calculate the price based on the line. Point me if there are any examples/documentation on this on how to implement this.

Hi there,

Yes it is possible to do this but there is no specific documentation for this since this is rudimentary algebra and not a cTrader specific issue. A trendline's equation is ax+b, you need to use it to find the value of the trendline on each bar and determine if the price has crossed it or not.

Best regards,

Panagiotis

 

 

if im drawing the line on the chart mannually (NOT via algo), 

  1. how i can get values of a,x,b in the algo for that line?
  2. If i draw multiple lines on the chart (mannually), how can distinguish between the lines? As i can see when i draw a line on the chart, i cant name the line

 

 

Hi there,

  1. ChartTrendLine has Time1, Time1, Y1(start price) and Y2(end price) properties. You can use them to calculate a,x and b.
  2. There is no easy way to do this. Names for the lines are assigned automatically by cTrader.

@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 06:24

Hi there,

Obsolete documentation has been removed and obsolete classes are not documented, they are kept for backward compatibility only.

Indeed links to types would be helpful but you can still easily search them on the search bar.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 06:14

RE: RE: How can I delete historical data?

910247359 said: 

PanagiotisCharalampous said: 

Hi there,

Can you provide a better explanation of the problem? What do you mean when you say “is too large”? How can we see this?

Best regards,

Panagiotis

The longer the horizontal bar in the red box, the fewer the number of candlesticks in the chart, and the shorter, the more. The short one represents the M1 chart, which has too many candle sticks. I hope it could be like a range chart, where more K-line data is downloaded only when you drag it to the left. Without dragging, only a part of the  candle sticks are displayed. The number of  candle sticks in the M1 chart is very large when the software is opened. I hope it could be as few as the range chart. When I want to see more data, I can just drag it to left.

Hi there,

There is no way to reduce the number of loaded bars at the moment. However I cannot reproduce any delays. Can you provide more information? Can you record a video where we can see what you are experiencing?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 06:07

Hi there,

Can you please provide more specific information about your issue? Which menu? What exactly happens? Can you record a video?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 06:06

Hi there,

There is no simple way at the moment. You would need to build your own store and licensing system. There is a plan for a cTrader Store but it will not come any time soon.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 05:58

Hi there,

The logic seems to do what you are asking for. Can you provide visual examples of the signals it gives now and what signals it should give instead?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 05:54

RE: I still can't find my cbot

chenshy27 said: 

As shown in the image, my cbot is called “stop10”, but I can't find it in the dropdown list as you mentioned! So where can I find the log of my cbot???

Hi there,

The first screenshot comes from the Trade section, the second comes from the Algo section. If you will run the cBot in the algo section, you will not see the logs in the Trade section but in the Algo section. 


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 05:41

RE: RE: Cbot access the trendlines drawn on the chart

keerthankumarkateel said: 

PanagiotisCharalampous said: 

Hi there,

Unfortunately there is no way to set names for lines manually drawn on the chart.

Best regards,

Panagiotis

Hello,

Thank you for responding. If i want to create an algo with two mannually drawn trendlines (line-A and line-B). Logic is if the price crossed below Line-A buy the ticker and if the price touches the Line-B close the position.

 

Is this possible to implement? this needs algo to read the mannuaaly drawn trendline, identify it and calculate the price based on the line. Point me if there are any examples/documentation on this on how to implement this.

Hi there,

Yes it is possible to do this but there is no specific documentation for this since this is rudimentary algebra and not a cTrader specific issue. A trendline's equation is ax+b, you need to use it to find the value of the trendline on each bar and determine if the price has crossed it or not.

Best regards,

Panagiotis

 

 

 


@PanagiotisCharalampous

PanagiotisCharalampous
02 Sep 2024, 05:30

RE: RE: RE: RE: Backtesting - Incorrect TP / SL calculation

zytotoxiziteat said: 

zytotoxiziteat said: 

zytotoxiziteat said: 

PanagiotisCharalampous said: 

Hi there,

Please share your cBot code and make sure you are using tick data for your backtests.

Best regards,

Panagiotis

using System;using System.Collections.Generic;using cAlgo.API;using cAlgo.API.Indicators;using cAlgo.API.Internals;namespace cAlgo.Robots{    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]    public class TradingBot : Robot    {        [Parameter("Risk Percentage", DefaultValue = 1, MinValue = 0.1, MaxValue = 10)]        public double RiskPercentage { get; set; }        [Parameter("Stop Loss (Pips)", DefaultValue = 40, MinValue = 0, MaxValue = 100)]        public double StopLossPips { get; set; }        [Parameter("Take Profit (Pips)", DefaultValue = 20, MinValue = 0, MaxValue = 200)]        public double TakeProfitPips { get; set; }        private AI_101.ML101.ModelInput _modelInput;        private double _lastPrediction;        protected override void OnStart()        {            _modelInput = new AI_101.ML101.ModelInput();        }        protected override void OnTick()        {            // Ensure only one open position per currency pair            if (Positions.FindAll("ML Prediction", Symbol.Name).Length > 0)                return;            // Update model input with the latest close price            _modelInput.ClosePrice = (float)Symbol.Bid;  // Use Symbol.Bid instead of Symbol.LastTick.Bid            // Get prediction            var prediction = AI_101.ML101.Predict(_modelInput);            // Calculate the predicted price change            double predictedChange = prediction.ClosePrice[0] - _modelInput.ClosePrice;            // Determine if we should open a position            if (Math.Abs(predictedChange) > Symbol.PipSize)            {                if (predictedChange > 0 && _lastPrediction <= 0)                {                    OpenPosition(TradeType.Buy);                }                else if (predictedChange < 0 && _lastPrediction >= 0)                {                    OpenPosition(TradeType.Sell);                }            }            _lastPrediction = predictedChange;        }        private void OpenPosition(TradeType tradeType)        {            // Calculate position size based on risk            double riskAmount = Account.Balance * (RiskPercentage / 100);            double volumeInUnits = riskAmount / (StopLossPips * Symbol.PipValue);            // Ensure volume is within acceptable range and increments            volumeInUnits = Symbol.NormalizeVolumeInUnits(volumeInUnits, RoundingMode.ToNearest);            // Check if the volume is valid            if (volumeInUnits < Symbol.VolumeInUnitsMin || volumeInUnits > Symbol.VolumeInUnitsMax)            {                Print("Volume is out of range: " + volumeInUnits);                return;            }            // Open the position            ExecuteMarketOrder(tradeType, Symbol.Name, volumeInUnits, "ML Prediction", StopLossPips, TakeProfitPips);        }    }}

My thought was:

Since I collected only m5 candle data for my Machine learning module I changed the “Data” in settings to “m5 bars from server” for backtesting 

and I was considering to change “protected override void OnTick()” to "protected override void OnBar()".
 

Is that wrong?

What is the best solution?

Thank you

Hi there, 

If you are using fixed SL and TP, you need to use tick data to ensure accurate results in backtesting.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
01 Sep 2024, 05:48

Hi there,

If you are looking to hire somebody, feel free to contact me at development@clickalgo.com

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
01 Sep 2024, 05:44

Hi Jurgen,

Yes it is 


@PanagiotisCharalampous

PanagiotisCharalampous
01 Sep 2024, 05:37

RE: Meet cTrader for Mac

Shanikhattak992 said: 

hallo can some one tell me how can i find market reply icon 

This feature is only available on cTrader Desktop


@PanagiotisCharalampous