Topics
Replies

firemyst
07 Mar 2025, 00:12

The issue is, as stated in a multitude of other posts, that the cloud is broken, and you should use a VPS or run locally. 

Spotware obviously doesn't care, because they've made no mention of it, or that they're investigating, or something else, with all the user reports of issues with the cloud.

It's been ongoing for weeks.

 


@firemyst

firemyst
07 Mar 2025, 00:08

RE: RE: RE: RE: Stop Loss/ Take Profit being set at wrong distance by algo

michaelkearney213 said: 

Hi,

 

I did add it to the code, sorry i'm not a coder and not looked at the logs before, so i thought that was it….

 

                    // Place the first Buy trade with TakeProfit and StopLoss
                    var takeProfitPrice = Symbol.Bid + TakeProfitInPips * Symbol.PipSize;
                    var stopLossPrice = Symbol.Bid - StopLossInPips * Symbol.PipSize;
                    Print("TP {0} + ( {1} * {2} ) = {3} ", Symbol.Bid, TakeProfitInPips, Symbol.PipSize, Symbol.Bid + (TakeProfitInPips * Symbol.PipSize) );
                    Print("SL {0} - ( {1} * {2} ) = {3} ", Symbol.Bid, StopLossInPips, Symbol.PipSize, Symbol.Bid + (StopLossInPips * Symbol.PipSize) );
                    ExecuteMarketOrder(TradeType.Buy, Symbol.Name, VolumeInLots, Label, stopLossPrice, takeProfitPrice);
                    _firstTrade = Positions.LastOrDefault();  // Store the first trade

 

I added those two lines before each of the execute lines like so…where do i see the output? on the logs tab?

 

That's all that comes out there.

 

Yes, that's where it should come out.

So could be one of many things:

  1. you're not running the bot you put the code in
  2. you put the code in, it didn't compile (had errors) so is still running old code
  3. you have multiple branches of logic in your code and the bot isn't executing the branch of code you put those print statements in
  4. or a multitude of other things.

Please share your entire code with the updated print statements in them.


@firemyst

firemyst
06 Mar 2025, 11:07

RE: RE: Stop Loss/ Take Profit being set at wrong distance by algo

michaelkearney213 said: 

firemyst said: 

What does it print when you add the following lines before the ExecuteMarketOrder statement?

Print("TP {0} + ( {1} * {2} ) = {3} ", Symbol.Bid, TakeProfitInPips, Symbol.PipSize, Symbol.Bid + (TakeProfitInPips * Symbol.PipSize) )

Print("SL {0} - ( {1} * {2} ) = {3} ", Symbol.Bid, StopLossInPips, Symbol.PipSize, Symbol.Bid + (StopLossInPips * Symbol.PipSize) )

 

Then after the ExecuteMarketOrder statement, find the position and print the SL and TP values to confirm they've been set as expected.

 

Show us a screen capture showing the before and after values from the logging. Let's see what they say.

Thanks for helping. first thing i notice is the logs not showing pips, only whole points. Does that mean it does n0t know pips? Considering that the log seems to be giving correct answer if it is rounding the price, although i want it to pip accuracy

LOGS

05/02/2025 00:00:00.000 | Info | CBot instance [forum help, XAUUSD, m5] started.
05/02/2025 00:40:00.443 | Trade | Executing Market Order to Buy 1 XAUUSD (SL: 2845, TP: 2847)
05/02/2025 00:40:00.443 | Trade | → Executing Market Order to Buy 1 XAUUSD (SL: 2845, TP: 2847) SUCCEEDED, Position PID1
05/02/2025 00:45:00.438 | Trade | Executing Market Order to Buy 1 XAUUSD (SL: 2847, TP: 2848)
05/02/2025 00:45:00.438 | Trade | → Executing Market Order to Buy 1 XAUUSD (SL: 2847, TP: 2848) SUCCEEDED, Position PID2

TRADES EXECUTED

Serial # Order ID             Position ID         Event    Time (UTC+7)    Volume              Quantity             Type      Entry price         TP          SL           Closing price     Gross profit        Pips       Balance Equity

0            -             1            Create Position 05/02/2025 07:40           1              0.01 Lots             Buy        2845.97              2874.44              2817.52                             0            0            -             10 000.00

1            -             2            Create Position 05/02/2025 07:45           1              0.01 Lots             Buy        2847.27              2875.75              2818.8                0            0            -             10 001.03

SL/TP DEFAULTS 

        [Parameter("Stop Loss (Pips)", DefaultValue = 50, MaxValue = 10000, MinValue = 1, Step = 1)]
        public double StopLossInPips { get; set; }

        [Parameter("Take Profit (Pips)", DefaultValue = 100, MaxValue = 10000, MinValue = 1, Step = 1)]
        public double TakeProfitInPips { get; set; }

 

………………………….SECOND TEST ……………………………….

 

defaults  SL = 200, TP = 500

Again with rounding it seems to be logging the correct SL/TP , but on both tests the SL/TP it actually implements is almost the same for both tests on same data…SL and TP are both aprroximately 28pts away. On previous times ive run this ive seen them around 25-26pts away.

05/02/2025 00:00:00.000 | Info | CBot instance [forum help, XAUUSD, m5] started.
05/02/2025 00:40:00.443 | Trade | Executing Market Order to Buy 1 XAUUSD (SL: 2844, TP: 2851)
05/02/2025 00:40:00.443 | Trade | → Executing Market Order to Buy 1 XAUUSD (SL: 2844, TP: 2851) SUCCEEDED, Position PID1
05/02/2025 00:45:00.438 | Trade | Executing Market Order to Buy 1 XAUUSD (SL: 2845, TP: 2852)
05/02/2025 00:45:00.438 | Trade | → Executing Market Order to Buy 1 XAUUSD (SL: 2845, TP: 2852) SUCCEEDED, Position PID2

 

Serial # Order ID             Position ID         Event    Time (UTC+7)    Volume              Quantity             Type      Entry price         TP          SL           Closing price     Gross profit        Pips       Balance Equity

0            -             1            Create Position 05/02/2025 07:40           1              0.01 Lots             Buy        2845.97              2874.48              2817.53                             0            0            -             10 000.00

1            -             2            Create Position 05/02/2025 07:45           1              0.01 Lots             Buy        2847.27              2875.79              2818.82                             0            0            -             10 001.03

 

> first thing i notice is the logs not showing pips, only whole points. Does that mean it does n0t know pips?

You have to ask Spotware. That's what they have as output. If you want pips, then you need to calculate them as the difference between the SL/TP and the entry price.

As for the rest of what you provided, it doesn't do anything to help me. If it all seems okay to you, that's fine with me.

Otherwise, you apparently didn't put any of those Print statements I suggested in your code or if you did, you didn't output them.


@firemyst

firemyst
06 Mar 2025, 05:13

Just write your own code to do it.

Sample code:

if (whatever condition is met) {
foreach (Position p in Positions)
{
    ClosePositionAsync(p, (TradeResult r) =>
    {
        if (r.IsSuccessful)
        {
            Print("Closed position \"{0} {1}\".", p.Id, p.Label);
        }
        else if (!r.IsSuccessful)
        {
            Print("WARNING! Could not close position \"{0} {1}\"!", p.Id, p.Label);
            Print("Error message: {0}", r.Error.Value.ToString());
        }
    });
}
}

@firemyst

firemyst
06 Mar 2025, 00:20

RE: RE: RE: RE: RE: RE: RE: RE: bot crashes in backtest

kyosuke said: 

Hi, no the bot opens only positions for the pair it is attached on…so in backtesting there's no way it can have different pairs open at the same time

So to clarify, you don't have any statements in your bot's code where you explicitly get the market data from the chart or another symbol?

Something like:

var marketData = MarketData.GetBars(timeframe, symbolName)

?

 

Because you can run a bot that gets data from other symbols, and not necessarily against the chart you're running your bot against. 


@firemyst

firemyst
04 Mar 2025, 01:22

 help .ctrader .com /ctrader-algo/references/General/Indicator/#placestoporderasync-8


@firemyst

firemyst
03 Mar 2025, 23:33

RE: RE: RE: RE: Problem with Pending Orders and ProtectionType

Falcorest said: 

firemyst said: 

 

Right now, I don't even think they're working on or investigating the issue because they've said absolutely nothing and people have been reporting Cloud issues since Nov/Dec.

 

O_O

So, at this point, I think a good solution might be to get a VPS.

Do you know if cTrader can run on a server with Windows Server 2022?

I've been using VPS for ages. Currently have one with 4GB memory running server 2019. It's doing fine. Here's who I have mine with:

newyorkcityservers . com/billing/aff.php?aff=74

They have awesome customer service and I've never experienced any down time with them except when I had my VPS reimaged from 2012 → 2019, which took me less than an hour to have done and reconfigure one Saturday afternoon.

 


@firemyst

firemyst
03 Mar 2025, 10:47

RE: RE: Problem with Pending Orders and ProtectionType

Falcorest said: 

 

hi, firemyst,
Thank you for your help!
This morning I tested the cBot on the latest version of cTrader, and the error message is still the same. However, if I run the cBot locally, everything works fine.

I can't understand the reason.

It's a shame not to be able to use the "On Cloud" setting, which allows the cBot to stay active all day and be managed from any device.

You're welcome.

And I get your frustration.

It's even more frustrating that Spotware doesn't even seem to acknowledge these issues any more, and don't give us any updates on fixes. 

Right now, I don't even think they're working on or investigating the issue because they've said absolutely nothing and people have been reporting Cloud issues since Nov/Dec.

 


@firemyst

firemyst
03 Mar 2025, 03:25

If you keep track of all your stop orders in your code, then you know when one is triggered. That is, on every tick see if you have any stop orders in your data structure and if so, check each one to see if the condition is met. If so, place the order as a market order instead so you know when it's placed. Then you can stop checking the other stop orders you have in your queue.


@firemyst

firemyst
03 Mar 2025, 03:16

YES to your second question 


@firemyst

firemyst
03 Mar 2025, 03:13

help .ctrader. com /ctrader-algo/creating-and-running-a-cbot/


@firemyst

firemyst
03 Mar 2025, 03:08

If you haven't found one, it's easy enough to program into a bot.


@firemyst

firemyst
03 Mar 2025, 02:41

Contact Panagiotis at:

 

Developer @ clickalgo.com

 

You can tell him I referred you from ctrader forums


@firemyst

firemyst
03 Mar 2025, 02:40

You have to keep track of your swing values and when your indicator value obviously crosses above or below those values, you know they've been taken out.


@firemyst

firemyst
03 Mar 2025, 02:35

What's the error you receive!


@firemyst

firemyst
03 Mar 2025, 02:29

Yes 

 

Set up copy trading


@firemyst

firemyst
03 Mar 2025, 02:26

Have you asked your broker?


@firemyst

firemyst
03 Mar 2025, 02:23

No, unless you do special coding yourself. That is, save info about your analysis to a file that your devices can read from, and then have an indicator that reads that file and redraws them


@firemyst

firemyst
03 Mar 2025, 02:20

What do you mean it's not possible?

I think you might not understand the process, especially since you haven't outlined the steps you follow that aren't working so someone can correct you if need be.

Here's a reference point for you:

 help. ctrader. com /ctrader-algo/custom-indicators/

 

 


@firemyst

firemyst
03 Mar 2025, 02:13 ( Updated at: 03 Mar 2025, 02:14 )

Yes, depending on what you mean by ‘transaction’


@firemyst