Topics
Replies
firemyst
01 Mar 2025, 02:51
Two suggestions from me:
- Don't run the bot in the cloud. There's too many people having too many issues. Run it locally, especially if you're just testing and playing around.
- The obsolete issue. Ignore it. Compile it anyway without the protection type parameter. It'll still run. That's what I've done when editing code in Visual Studio. Spotware has yet to post documentation or respond to threads asking what the protection type parameter is, or does.
@firemyst
firemyst
01 Mar 2025, 02:13
RE: RE: RE: RE: RE: Help with error code
rohanlal019@gmail.com said:
firemyst said:
rohanlal019@gmail.com said:
I have found the problem. When entering a trade, cTrader is using a completely different asset's price to calculate unrealized PnL, triggering an immediate exit of the trade. i.e. I enter a long at a price point of 1.5 on NZDUSD and then it immediately exits at a 3000 pip loss because the asset ctrader is tracking for that trade is now EURNZD and EURNZD's price is currently .7.
There must be a bug in the new version of cTrader causing this to happen.
Wow. How did you figure this out?
Looking at the close and open prices in the trade history tab and the fact that the close price wasn't even a price that currency had been to before. But it was a price that one of my other Symbols in my cbot was at on that day the trade closed.
Good work on trying to track it down.
It wouldn't surprise me if there was yet another major bug in the cTrader - their quality control and testing has gone to crap. It's almost like they don't care or take pride in their product any more.
@firemyst
firemyst
28 Feb 2025, 21:21
RE: RE: RE: Help with error code
rohanlal019@gmail.com said:
I have found the problem. When entering a trade, cTrader is using a completely different asset's price to calculate unrealized PnL, triggering an immediate exit of the trade. i.e. I enter a long at a price point of 1.5 on NZDUSD and then it immediately exits at a 3000 pip loss because the asset ctrader is tracking for that trade is now EURNZD and EURNZD's price is currently .7.
There must be a bug in the new version of cTrader causing this to happen.
Wow. How did you figure this out?
@firemyst
firemyst
26 Feb 2025, 01:58
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.
@firemyst
firemyst
26 Feb 2025, 01:47
Why don't you post some code demonstrating the problem and perhaps someone can see what you're doing and what needs to be corrected?
In a nutshell, when the history loads, check if the earlier bar loaded is before a certain date/time. IF not, you need to call load more history again.
If you Google, you'll see there's been a few threads in the forums talking about this:
/forum/cbot-support/38020/
/forum/indicator-support/24356/
And this page will have info assisting on how to load more history:
https:// help . ctrader . com /ctrader-algo/references/EventArgs/BarsHistoryLoadedEventArgs/
@firemyst
firemyst
26 Feb 2025, 01:25
RE: RE: Why is my cbot lagging a few candles than tradingview?
duynguyenhl.bio said:
firemyst said:
People can't make comparisons not knowing what the Trading View code is. For all we know, the C# code you have, while doing something, might not be 100% accurate with the Pine Code for the Trading View indicator.
I fixed it already. Btw, you can find the indicator add to chart on Trading View and click to Source code (nearby name of indicator) to knowing the code is.
- what was the issue?
- Nobody's going to want to hunt down a Trading View indicator, look at the code, and figure things out, especially if they only use cTrader. This is evidenced by the lack of response to this thread. General rule of thumb is when you need assistance, all the information should be supplied here – don't ask for help, and then expect people to go out searching for everything they need to help you.
@firemyst
firemyst
01 Mar 2025, 05:59 ( Updated at: 02 Mar 2025, 22:25 )
Ctrader tends to keep the chart where you last scrolled to. So don't scroll it. :-)
However in your code, you can try the ScrollToX method:
https:// help . ctrader. com /ctrader-algo/references/Chart/Chart/#scrollxby
@firemyst