4.5 No Idea What Yet But Something Is NOT right!

Xammo since: 23 Jun 2021;

  25 Nov 2022, 02:47
4.5 No Idea What Yet But Something Is NOT right!

Just got the update to 4.5 - I don't know what yet but something is not right!

I use Chart.DrawStaticText to display position info

private void DrawStaticText_HUD()
      Chart.DrawStaticText("HUD_LEFT", "H:" + Math.Round(double_Spread_Highest / Symbol.PipSize, 1) + "  L:" + Math.Round(double_Spread_Lowest / Symbol.PipSize, 1) + "  A:" + Math.Round(double_Spread_Average / Symbol.PipSize, 1) + "  S:" + Math.Round(Symbol.Spread / Symbol.PipSize, 1), VerticalAlignment.Bottom, HorizontalAlignment.Left, Color.AntiqueWhite);

      Chart.DrawStaticText("HUD_CENTRE", "[A:" + Pos("All").Count() + "] " + Math.Round(Pos("All").Sum(x => x.NetProfit), 2) + "  [S:" + Pos("Sell").Count() + "] " + Math.Round(Pos("Sell").Sum(x => x.NetProfit), 2) + "  [B:" + Pos("Buy").Count() + "] " + Math.Round(Pos("Buy").Sum(x => x.NetProfit), 2) + "  TP:" + double_TP_Amount, VerticalAlignment.Bottom, HorizontalAlignment.Center, Color.AntiqueWhite);

private IEnumerable<Position> Pos(string type)
     if (type == "All")
          return Positions.Where(x => x.SymbolName == SymbolName && x.Label == Param_String_Label);
          return Positions.Where(x => x.SymbolName == SymbolName && x.Label == Param_String_Label && x.TradeType == (type == "Sell" ? TradeType.Sell : TradeType.Buy));

The code has been working just fine for months

It is doing something very odd now as I noticed bots I have been keeping an eye on for ages were not showing the correct info so I stopped and restarted them

This is the before and after - look at the [A:33] - this shows 'All' Positions count and over all netprofit next to it - [S] is all the sells and [B] all the buys

That ain't right! so I stopped and restarted the bot and get the following correct information but it only shows for a few seconds then reverts to the above!

this is very concerning as these are my live bots which I am frantically trying to work out what is going on/just getting them all back to working on 4.1 I can't take this kinda stress riding the waves of version after version being released with issues (or perhaps my eyes are deceiving me/I'm jumping the gun but if my bot acts on the info being displayed onscreen I am royally screwed! NOT happy at the mo :( :( :(

Xammo since: 23 Jun 2021;

  25 Nov 2022, 02:42

My (LIVE) strategy is based on trading daily at 8PM UTC

I JUST managed to get the code back to working on 4.1 minutes before 8PM

(what if I had not even noticed this problem? obviously I did know it had gone up to 4.5 and was keeping a keen eye on things but yeh... not cool)

Some of the bots have behaved as expected... and others have not... 

This is not good

Really... I cannot stress this enough... this is NOT good

Thankfully not all out disaster but only time will tell how badly this will affect me as the strategy plays out over weeks/months

I would not want to swear as obviously that does nothing to solve anything but if I could swear believe me you would not want to read any further

Spotware... please... what is going on?

Have I got it wrong? Was I seeing things? Is 4.5 tested top to bottom all issues ironed out? Or are we on an Elon Musk style development cycle here ->

05 REM How To Build A Rocket
70 PRINT "Thank *** it worked!"
80 END

I don't think even Musk would put his clients in his test rockets and I don't want to be a test pilot in Spotware rockets anymore thanks but I am seriously struggling to find a version of a Spotware rocket that enables me to trade properly and I am not trying to make it to Mars here just earth orbit is fine thanks

I now have 23 hours and 20 minutes to work out why my code (other than all the stuff I already ripped out/frantically edited code back to .Net 4.0 etc.) is not working as expected in 4.1

I also remember why I did not stick with 4.1 for my live trading/went to 4.4 once I was happy the OnBar and ServerTime (serious) issues were working properly in 4.4 is because I run multiple profiles of cTrader and when you create and start a new profile in 4.1 it starts to install cTrader (4.1 is just an unpacked exe by the looks of it) which I cancelled as didn't want all the files/folders (not to mention sample bots/indicators! again!) installing and causing other issues/trying to keep this VPS strictly 4.1/VS2019 so I have no idea what version it was going to install but when I did that before months back it installed the latest 4.3 version I think it was... so I cannot run multiple profiles in 4.1 - thankfully 4.1 doesn't suffer from the automate display dissapearing issue but still every time I restart cTrader this way I have to select the trading account to trade then setup the bots again for each account etc...

Did I already mention this is not good...?

Anyway... what a stressful mess

Xammo since: 23 Jun 2021;

  25 Nov 2022, 03:05

Thankfully I've managed to mop up the mess and the strategy is semi tolerant of these kinds of issues and realised it was the parameter (only one of any significance) I messed up on some of the bots in the rush to get things over to 4.1 and hit the deadline and not the code (as far as I know so far anyway)

But that was stressful what was going on with 4.5? Is it not reading the Positions array/list/whatever properly?

Spotware's avatar

Spotware since: 23 Sep 2013;

  25 Nov 2022, 08:36

Dear Xammo,

Please provide us exact steps on how to reproduce the problem and we will have a look.

Best Regards,

cTrader Team

TRADERS FIRSTâ„¢ Vote for your favorite features: https://ctrader.com/forum/suggestions

Xammo since: 23 Jun 2021;

  25 Nov 2022, 13:04

I already gave you the code (in C# and BASIC)

Just call that DrawStaticText_HUD()  method in OnTick and you should be good to reproduce the error

Other than that for exact steps I can't really say any more than ->

  1. I pressed start on the bot
  2. I pressed stop on the bot
  3. I pressed start on the bot
  4. I watched in dismay at what I was seeing

You might want to have a look at the BASIC code though not sure that is really the best way to run things been a long time since I did any BASIC

Spotware's avatar

Spotware since: 23 Sep 2013;

  25 Nov 2022, 16:22

Dear Xammo,

We are not able to reproduce the reported behavior. Are you able to record a video demonstrating this behavior?

Best Regards,

cTrader Team

TRADERS FIRSTâ„¢ Vote for your favorite features: https://ctrader.com/forum/suggestions

Xammo since: 23 Jun 2021;

  25 Nov 2022, 21:55

When it happened it was on 2 of the 6 bots in that ctrader instance - displayed the correct position/netprofit info then flipped to incorrect readings

I stopped the 2 out of 3 ctrader instances that were live trading but left the 3rd instance that is running in demo and have just tried to see if any of them were doing it but they all look to be ok

I don't know how you can replicate it as they were trades going back over a month so don't think you are going to be able to reproduce in a backtest etc

Seems to me like there was a problem reading the Positions array but other than that all I know is that is enough for me and I'm sticking to 4.1

Best of luck and sorry that is basically nothing for you to go on and leaves you guessing but I assure you the readings were as per the screenshots above after stopping and starting the bots with that code running (within the rest of the code which of course you could think and quite possibly could for some reason beyond my understanding be a contributing factor but it has been running fine for months)