Can you please share your plugins code and provide exact steps on how we can reproduce this behavior?
Best regards,
Panagiotis
I used the sample codes from cTrader they are build in samples..
- Previous Bar Info - TradeWatch Tab Sample
Best regards
Do I need to post while they are available in cTrader?
Hi there,
I tried to reproduce this but with no luck. Any change you can record a video that would allow us to see the steps you are taking to reproduce this behavior?
Hi Panagiotis, the issue persists, do you know if it has been resolved? Perhaps I need to update the platform manually instead of waiting for the automatic update? Thanks!
OnTick() is a method of a robot, not of a plugin. Same for Bars property. Here is a starting point for handling tick events and accessing bars in a plug in
using System;using cAlgo.API;using cAlgo.API.Collections;using cAlgo.API.Indicators;using cAlgo.API.Internals;namespace cAlgo.Plugins{ [Plugin(AccessRights = AccessRights.None)] public class Test : Plugin { Bars _bars; Symbol _symbol; protected override void OnStart() { // To learn more about cTrader Automate visit our Help Center: // https://help.ctrader.com/ctrader-automate _bars = MarketData.GetBars(TimeFrame.Minute); _symbol = Symbols.GetSymbol("EURUSD"); _symbol.Tick += _symbol_Tick; } private void _symbol_Tick(SymbolTickEventArgs obj) { Print(_bars.ClosePrices.Last(1)); } protected override void OnStop() { // Handle Plugin stop here } } }
Best regards,
Panagiotis
There is an error on this line : Print(_bars.ClosePrices.Last(1));
_bars doesn't know the methods or ClosePrices.Last and therefore fails to call them.
In order to get a closed position's p&l, you need to get the deals using ProtoOADealListReq. The ProtoOADeal.ProtoOAClosePositionDetail will provide you with the information of the closed position and from there you can calculate the P&L of each position.
Each broker has a different price feed therefore it is expected that the results will be different. You should backtest/optimize using the price feed of the broker you are planning to trade with.
To reproduce the problem go to Algo → Backtesting → Run backtest → Generate report and then in the report you can find Parameters with wrong/empty values
Best regards
Thank you, it's a known issue and it will be fixed in the upcoming release.
We didn't have any similar reports. Did you try debugging your cBot i.e. adding logs and understand what happens after this first week? Did you try comparing by executing using your own VPS? Is there a difference in execution?
Best regards,
Panagiotis
Hi Panagiotis,
Thanks for the advise. I will add in logs and run the bots simultaneously on my own VPS and the cloud server to understand the issues. Once I spot a discrepancy I will let you know.
I did a check with backtesting, and the bot definitely misses trades. One position from last week was not taken and closed, and another one at the end of the week was not opened. See the screenshot of the trades that were taken in the backtest, but not with my bot running.
Unfortunately I cannot help you with such information. You need to follow my advise in my previous post. Add logs to your cBot to understand what happens in real time execution. Also compare it with execution on a VPS
Hello. I came across the same problem this morning. I think it is due to incorrect value of the MACD. See attached images.
MACD is the leading indicator to close positions. At 06:00 the MACD flipped negative, meaning that the position should be closed. But the value is not printed as negative, but as a formula: -8.282095762690567E-05. At 10:00 am the MACD is printed as -0,0001373403922979577 and the position is closed.
Can you look into this?
Thanks,
Vince
Any ideas? Is it possible to stop the formula results but calculate the MACD as a absolute value?
Hi there,
The way the results are printed is just the scientific notation and this is used for convenience when there are too many decimals in the actual value. It does not affect how the values are used in your cBot.
Thank you for reporting this issue. Unfortunately we were not able to reproduce this behavior. Could you pleasesend us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.
PanagiotisCharalampous
09 Dec 2024, 10:26
Hi there,
There is no such option at the moment but we will add it in a future update.
Best regards,
Panagiotis
@PanagiotisCharalampous