4.5 No Idea What Yet But Something Is NOT right!
4.5 No Idea What Yet But Something Is NOT right!
24 Nov 2022, 21:10
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);
}
else
{
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 :( :( :(
Replies
Xammo
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?
@Xammo
Xammo
25 Nov 2022, 13:02
( Updated at: 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 ->
- I pressed start on the bot
- I pressed stop on the bot
- I pressed start on the bot
- 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
@Xammo
Xammo
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)
@Xammo
Xammo
10 Jan 2023, 13:05
This was working late last night (my USD IC Markets Raw Trading account showing correct netprofit calculation) that I thought it had been picked up and sorted
Checked this thread and no reply and also no email reply from Spotware to my CTRL+ALT+SHIFT+T report (I don't think I have ever recevied a reply to anything I have reported like that come to think of it!)
But this morning it still has the same problem!
I am having to manually trade my algo's positions - this is totally messing everything up as my strategy relies on position labels (as well as the calculated NetProfit) so the manual trades do not have any labels meaning I will need to continue to manually monitor the manually traded positions until the algo completes (which could be months!)
Please Spotware can you acknowledge/reply/give me some hope here!
@Xammo
Xammo
10 Jan 2023, 16:40
It is now happening on my GBP account so have stopped all bots on that account too!
Thankfully I have a simple strategy having had platform issues as one of the many issues that can affect trading worked into the mix that I can manually trade the positions but the manual trades will need to be continually manually monitored alongisde what the algo is doing - it is beyond frustrating!
It looks like something is happening with the 4.1 connection issue - if that gets back online my issues are over and I go back in my hole and stick with 4.1 - please take your pick on what to devote your resources to! my money would be on getting 4.1 back online please!
@Xammo
Xammo
12 Jan 2023, 13:53
Looks like you've seen the video now nice one - quite disconcerting eh!
Now that 4.1 is back online I have the exact same bots running (as they have been for many months) with absolutely no issues like this/am not seeing this anomaly
No idea if the code would actually execute on those figures (assume it would otherwise why would it be drawing that info onto the chart if it didn't think that was what the NetProfit was) but anyway over to you and best of luck sorting it out
Cheers
Max
@Xammo
Xammo
16 Jan 2023, 18:54
( Updated at: 21 Dec 2023, 09:23 )
Hi Spotware please can you acknowledge you have seen the video?
I'm just testing out 4.5.6 with the following code that simply prints out the gross and unrealised profit
using cAlgo.API;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class NewcBot : Robot
{
protected override void OnTick()
{
Print("Gross: {0} UnRealised {1}", Account.UnrealizedGrossProfit, Account.UnrealizedNetProfit);
}
}
}
You say you are unable to replicate this issue but how can that be?!
Now it is simply a print statement and clearly not showing the correct info is being registered in the code surely you must be seeing the same problem or how can this be unique to me I don't understand... if anyone else reads this/has time on their hands please could you try the code and let me know if you are seeing correct info would be very grateful and thank you in advance if you do help out!
@Xammo
Xammo
17 Jan 2023, 00:33
ok... doesn't look like anyone has any time on their hands nevermind...
Spotware - obviously you're reading these forums as you've answered a post after mine from someone saying they're having indicator issues and taken a screenshot with zero explanation yet you've taken the time to reply to them and ask what exactly you are supposed to be looking at so isn't this problem I am clearly spelling out and demonstrating at least worthy of a reply too please?
I have also confirmed in demo that the bot executes on this incorrect information (for example 'close all positions on X.XX NetProfit') so it is surely extremely dangerous if used for live trading (is this not a problem for anyone else?!) and not just aesthetic aspects of the UI
Thanks
Max
@Xammo
... Deleted by UFO ...
Xammo
17 Jan 2023, 11:49
Thank you for acknowledging and confirming this is an issue really it goes a long way just to receive that kind of a reply from you thank you
Very best of luck getting it sorted and I hope you are able to nail it quickly (I have 2 VPS's one running a live USD account the other a live GBP account both on 4.1 but I would like to run additional instances in muliple profile mode on demo for backtesting/testing however unfortunately 4.1 insists on installing 4.5.xx which is obviously unusable with this issue if using NetProfit calculation)
Thanks
Max
@Xammo
Xammo
18 Jan 2023, 16:19
I just upgraded to 4.5.7 (noticed another post someone said it was available/had no idea otherwise) and it looks like the NetProfit is calculating properly now!
Spotware are you able to please confirm this is sorted now and also the OnBar/Time Issue seems to be working properly so would be grateful if you could please also confirm these are rock solid and sorted now?
Many thanks
Max
@Xammo
Xammo
24 Nov 2022, 22:47 ( Updated at: 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 ->
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