Topics
Replies

firemyst
26 Jun 2023, 05:30

JSON works perfectly with cAlgo. I use it in all my bots for saving states.

I'm using the NewtonSoft json package in Visual Studio.

You haven't stated anything on how you have your VS configured (if you're using it), nor any sample code reproducing your issue.

 


@firemyst

firemyst
24 Jun 2023, 17:42

Vote:

 

 


@firemyst

firemyst
24 Jun 2023, 17:41

Use "args.Reason" to find the reason a position was closed.

 

 private void OnPositionsClosed(PositionClosedEventArgs args)
        {
         Print("Closed for reason {0}", args.Reason);
        }

 


@firemyst

firemyst
24 Jun 2023, 17:35

This is a super basic feature - why is it not incorporated into the mobile version yet? This is 2023!


@firemyst

firemyst
24 Jun 2023, 17:33

And a dark theme that's customizable and NOT based on whether the phone is set to a dark theme. Other apps like Google Maps, web browser, and such allow users to switch between dark/light theme manually independent of how the phone is set.


@firemyst

firemyst
24 Jun 2023, 17:30

Would love to see this in cTrader. Should be native like it is with Trading View.


@firemyst

firemyst
24 Jun 2023, 17:19

This is a multistep process:

 

1) create a global variable that counts the number of crossovers.

private int _maCrossOverCount;

2) In the OnStart method, set the count to zero:

_maCrossOverCount = 0;

3) Every time a cross over happens, increase the count by 1. However, you have to decide if you want the cross over to count if it happens when a "tick" comes in or a new bar. Reason being is obviously if the MA's are close, they could cross over hundreds of time within a bar on every tick depending on how much price fluctuates

if (_sma1.Result.LastValue > _sma2.Result.LastValue)
            {
              _maCrossOverCount += 1;



//and


if (_sma1.Result.LastValue < _sma2.Result.LastValue)
            {
              _maCrossOverCount += 1;

 

 

4) Check the crossover count before you open a position:

if (_maCrossOverCount > 1)

{

   /// code what you need to in order to open your position

}


@firemyst

firemyst
24 Jun 2023, 05:32

Someone can correct me if I'm wrong, but the PRC is retrofitted to price action. Only the current value of the PRC is not repainted. This is similar to a linear regression channel which is also retrofitted to price action. This means that the entire graph is repainted, with the exception of the current value of the channel, which can be used for an automated strategy.

This has already been discussed somewhat here:

https://ctrader.com/forum/ctrader-support/37573#:~:text=Hi%2C,it's%20retrofitted%20to%20price%20action.

 

 


@firemyst

firemyst
23 Jun 2023, 06:32

You should have enough to go on with the samples included in cTrader. I don't understand how none of those or any included in the cbot repository

can't help you but a sample macd zero crossing one will.

 


@firemyst

firemyst
23 Jun 2023, 06:26

How do you expect anyone to help you if you don't post any of your code so people can see what you're code is doing and why it might be failing?

Since you haven't done that, edit your code in VIsual Studio and run it with debugging enabled.


@firemyst

firemyst
21 Jun 2023, 15:41 ( Updated at: 21 Dec 2023, 09:23 )

I've experienced the same issue and I wasn't doing any backtesting -- only running a bot. 

Renko 6 EURJPY. Date/time is UTC + 8 running cTrader 4.7.12.

Chart on one computer under "automate" when running/stopping a cBot:

 

Chart on second computer in trading tab (automate has the same chart too on this computer that was not running any cBots) :

 

 

 


@firemyst

firemyst
20 Jun 2023, 11:19

RE:

PanagiotisChar said:

Hi firemyst,

I guess when the data is downloaded once, it is then cached and reused by other instances too

Aieden Technologies

Need help? Join us on Telegram

 

I would hope that's the way it is set to work. But if so, I think it would be better to only show one message saying data is being downloaded instead of 15 (like the screen capture) as that gives off the wrong impression.

Unless that's a "glitch" I came across :-)


@firemyst

firemyst
20 Jun 2023, 04:40

RE:

ncel01 said:

Hi firemyst,

I suppose that your account currency is AUD and that's for currency conversion purposes.

Thank you. that makes sense.

But be that as it may, I'm not sure why there has to be 15 separate threads downloading the SAME conversion rate data? Surely Spotware could implement it so that the data is downloaded ONCE and then shared between any number of child threads that may launch?


@firemyst

firemyst
19 Jun 2023, 13:05

Anyone?

@Spotware?

 

 


@firemyst

firemyst
19 Jun 2023, 13:04

Anyone? @Spotware?

 

 


@firemyst

firemyst
19 Jun 2023, 13:04

Anyone? @Spotware?


@firemyst

firemyst
19 Jun 2023, 13:03

What are you talking about?

Because from the way I read this, both those options are already there:

1) Pip counter - just right-click and add the column:

2) weekly profit/loss for week - click the drop down and select it:

 

??????

 


@firemyst

firemyst
17 Jun 2023, 06:04

Your bot is closing all positions because you tell it to:

private void CloseAllPositions()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);
            }
        }

 

If you only want to close positions that your bot has specifically opened, then it's a two step process:

1) when you open a position, you need to assign a label to it (eg, "acBotPosition"), which is a string.

2) when looping through all the open positions, only close those positions whose label matches "acBotPosition":

private void CloseAllPositions()
        {
            foreach (var position in Positions)
            {
                if (position.Label == "acBotPosition")
                    ClosePosition(position);
            }
        }

 

 

As for the cut scenario, I wouldn't use the "HasCrossedAbove" method.

Instead, I would use logic similar to the following:

if (_fastMA.Result.Last(1) > _slowMA.Result.Last(1))
{
	ExecuteStrategy(TradeType.Buy);
}
else if (_fastMA.Result.Last(1) < _slowMA.Result.Last(1))
{
	ExecuteStrategy(TradeType.Sell);
}

 


@firemyst

firemyst
17 Jun 2023, 05:54

This happens a lot with WIndows Programs (not just cTrader). I find it happens when you have two displays that are different resolutions (eg, laptop screen FHD, monitor 4k) and the higher resolution monitor gets disconnected _before_ running program is brought over to the primary display. Windows remembers program display locations, so as a result, it appears off screen when the second display isn't connected any more. It's a hassle.

Ways to try fixing it which have helped me in the past:

 

 


@firemyst

firemyst
17 Jun 2023, 05:49

See my reply in your other thread:

 


@firemyst