Replies

BernhardCS
11 Nov 2024, 06:57

RE: "Position.Margin" provides wrong values

Hello,

of course, leverage of both seems to be the same, account 30, symbol 20. 

What I also found strange is that commission mentioned in the symbol = 0, but in backtesting the position had a value for commission:

position.Commissions: -5,63

A trading test in trading section of Pepperstone Demo account did not charge a commission:

Thank you.

Best regards,

Bernhard


@BernhardCS

BernhardCS
24 Oct 2024, 01:53

RE: RE: RE: RE: RE: RE: RE: RE: RE: RE: RE:

I made an external lib, which needs access to cAlgo, while compiling I got the error: “CT0002 Assembly must contain algo type.” and according to the forum that should be added to the lib project file:

    <PropertyGroup>
    <AlgoBuild>False</AlgoBuild>
   </PropertyGroup>

Problem was that the error: “CT0002 Assembly must contain algo type.” is referenced (double click on error) to a completely different file: C:\Users\[USER_NAME]\.nuget\packages\ctrader.automate\1.0.9\build\cTrader.Automate.targets where I added the PropertyGroup above by mistake, with the result that algo files will not be made anymore (for all bots and indicators) and also the compiler error disappeared. At first it looked ok for me … but then I got crazy to find the file where I made the mistake ;-)

However, the file C:\Users\[USER_NAME]\.nuget\packages\ctrader.automate\1.0.9\build\cTrader.Automate.targets will be replaced by each update and maybe that would be also the solution for the problems mentioned by the others in that thread?!


@BernhardCS

BernhardCS
14 Oct 2024, 07:10

RE: RE: RE: Backtesting bar data missing for 1 day in timeframe.minute

Hi Panagiotis,

I found the cache in c:\Users\[USER]\AppData\Roaming\Spotware\Cache\icmarketseu\BacktestingCache

After deleting … the entire cache folder c:\Users\[USER]\AppData\Roaming\Spotware\Cache … the missing day is now available also on M1-Backtesting data :-) and within the cache folder there is now (but due to deleting before not sure whether it was not there before) a file named with that date

So it was a cache issue, not a broker data issue, thank you for your help to solve it!

Best regards,

Bernhard

 


@BernhardCS

BernhardCS
13 Oct 2024, 07:56

RE: Backtesting bar data missing for 1 day in timeframe.minute

Hi Panagiotis,

thanks for your reply and I'm quite sure you will be right ;-)

But I still wonder why the chart history is different to backtesting history data. 

So for clarifying 3 questions and I hope I don't bother you, if that is explained in doumentation you could provide me the link to it:

  1. Chart-data/TimeFrame.M1 => what is the source format the broker provides? Tick-data or directly TimeFrame.M1-data?
  2. Backtesting-data/Source: M1 from Server => what is the source format the broker provides? Tick-data or directly TimeFrame.M1-data?
  3. Backtesting-data/Source: Ticks from Server => The source could be only the Tick-data, right?

If your answer to point 1. and point 2. is the same, the problem ist probably not at the broker side, but between 1 and 2 is a difference. 

So considerd that your answer above “talk to IC Markets” is right, I guess cTrader gets all broker data (for Charts and Live-Bots) only by ticks and makes/generate all longer timeframes as M1, H1 etc. by it's own - only that would explain that “Backtesting-data/Source: Ticks from Server” and “Chart-data/TimeFrame.M1” gets the same result. Based on that and if that would be true, “Backtesting-data/Source: M1 from Server” have to be a different source by the broker, am I correct with that?

Thank you and best regards,

Bernhard

 


@BernhardCS

BernhardCS
18 Jul 2024, 07:40

sorry ...

reply button gave me no response that message was sent, please ignore double posts :-(


@BernhardCS

BernhardCS
18 Jul 2024, 07:38

RE: "maintenance mode / server down" several hours during trading session

Hi Panagotis,

thanks for your reply! Information about further processing after re-connection seems to be clear.

How about?

  • Will the StopLoss (or Trailing StopLoss) be triggered when price will go below(long)/above(short), if the cTrader server is down? So will the StopLoss also handed over to the broker so that the broker will close the position?
  • Is there any way to check in cBot automatically the connection of the server whether live, down, maintenance? To get notified after re-connection would be also great.

With these information I would be fully satisfied :-)

Thank you so much!

Best regards,

Bernhard


@BernhardCS

BernhardCS
18 Jul 2024, 07:38

RE: "maintenance mode / server down" several hours during trading session

Hi Panagotis,

thanks for your reply! Information about further processing after re-connection seems to be clear.

How about?

  • Will the StopLoss (or Trailing StopLoss) be triggered when price will go below(long)/above(short), if the cTrader server is down? So will the StopLoss also handed over to the broker so that the broker will close the position?
  • Is there any way to check in cBot automatically the connection of the server whether live, down, maintenance? To get notified after re-connection would be also great.

With these information I would be fully satisfied :-)

Thank you so much!

Best regards,

Bernhard


@BernhardCS

BernhardCS
18 Jul 2024, 07:38

RE: "maintenance mode / server down" several hours during trading session

Hi Panagotis,

thanks for your reply! Information about further processing after re-connection seems to be clear.

How about?

  • Will the StopLoss (or Trailing StopLoss) be triggered when price will go below(long)/above(short), if the cTrader server is down? So will the StopLoss also handed over to the broker so that the broker will close the position?
  • Is there any way to check in cBot automatically the connection of the server whether live, down, maintenance? To get notified after re-connection would be also great.

With these information I would be fully satisfied :-)

Thank you so much!

Best regards,

Bernhard


@BernhardCS

BernhardCS
18 Jul 2024, 07:38

RE: "maintenance mode / server down" several hours during trading session

Hi Panagotis,

thanks for your reply! Information about further processing after re-connection seems to be clear.

How about?

  • Will the StopLoss (or Trailing StopLoss) be triggered when price will go below(long)/above(short), if the cTrader server is down? So will the StopLoss also handed over to the broker so that the broker will close the position?
  • Is there any way to check in cBot automatically the connection of the server whether live, down, maintenance? To get notified after re-connection would be also great.

With these information I would be fully satisfied :-)

Thank you so much!

Best regards,

Bernhard


@BernhardCS

BernhardCS
18 Jul 2024, 07:38

RE: "maintenance mode / server down" several hours during trading session

Hi Panagotis,

thanks for your reply! Information about further processing after re-connection seems to be clear.

How about?

  • Will the StopLoss (or Trailing StopLoss) be triggered when price will go below(long)/above(short), if the cTrader server is down? So will the StopLoss also handed over to the broker so that the broker will close the position?
  • Is there any way to check in cBot automatically the connection of the server whether live, down, maintenance? To get notified after re-connection would be also great.

With these information I would be fully satisfied :-)

Thank you so much!

Best regards,

Bernhard


@BernhardCS

BernhardCS
18 Jul 2024, 07:38

RE: "maintenance mode / server down" several hours during trading session

Hi Panagotis,

thanks for your reply! Information about further processing after re-connection seems to be clear.

How about?

  • Will the StopLoss (or Trailing StopLoss) be triggered when price will go below(long)/above(short), if the cTrader server is down? So will the StopLoss also handed over to the broker so that the broker will close the position?
  • Is there any way to check in cBot automatically the connection of the server whether live, down, maintenance? To get notified after re-connection would be also great.

With these information I would be fully satisfied :-)

Thank you so much!

Best regards,

Bernhard


@BernhardCS

BernhardCS
18 Jul 2024, 07:38

RE: "maintenance mode / server down" several hours during trading session

PanagiotisCharalampous said: 

Hi Bernhard

  • cBots: once the connection was re-established, will the OnStart()-Method called again?

No

  • cBots: once the connection was re-established, will the OnTick()-Method called for each single tick of the disconnection gap which is probably now delivered?

No, the cBot resumes from the new streamed tick

  • cBots: once the connection was re-established, will the OnBar()-Method called for each single bar of the disconnection gap which is probably now delivered?

No, the cBot resumes from the new streamed bar

  • Indicators: Is there something special indicator methods (initialize?!, calculate?!) considered once the connection was re-established?

On reconnection the indicator is reinitialized.

Best regards,

Panagiotis

Hi Panagotis,

thanks for your reply! Information about further processing after re-connection seems to be clear.

How about?

  • Will the StopLoss (or Trailing StopLoss) be triggered when price will go below(long)/above(short), if the cTrader server is down? So will the StopLoss also handed over to the broker so that the broker will close the position?
  • Is there any way to check in cBot automatically the connection of the server whether live, down, maintenance? To get notified after re-connection would be also great.

With these information I would be fully satisfied :-)

Thank you so much!

Best regards,

Bernhard


@BernhardCS

BernhardCS
21 Jun 2024, 10:50

RE: RE: Custom indicator in cBot different results visual mode compared to silent mode

No that is not what I said. Indicators referenced in a strategy will use the source set in the backtesting settings. Indicators applied on the chart will be rendered at the moment they are applied, so all past bars will be considered historical

first of all, Panagiotis thanks for your great replies to actually all threads I found in this forum already, as well to this one.

Just to make it sure in my own (not native English speaking … poorer) words ;-)

  1. with “strategy” I guess you mean a cBot.
  2. backtesting settings & optimization settings (e.g. ticks instead of chart timeframe data) will be correct processed, in the backend of backtesting & optimization
  3. point 2. is also applicable for indicators on the chart shown on backtesting in visual mode
  4. all other indicators (chart in trade section or chart in backtesting in NON visual mode) will show historically only chart timeframe data, for “IsLastBar” it will be also consider ticks

That's what I extracted as summary and it's no open question, except I wrote something wrong.

Thanks for all and have a nice weekend!


@BernhardCS

BernhardCS
21 Jun 2024, 06:48 ( Updated at: 21 Jun 2024, 06:49 )

thanks for your prompt reply.

hmmm, so for backtesting in non visual mode, the setting “tick-data” (instead of m1 data) will not be used, that was not clear to me and looks frankly spoken … wrong ;-) 

but now I know how it works. Thank you for clarification!

By the way, how about Optimization, there we can also select "tick-data accurate”. Are the indicators there also only calculated once per bar? Because there is no visual mode available.

Thank you.

 


@BernhardCS

BernhardCS
14 May 2024, 09:02

RE: RE: RE: referencing an custom Indicator

great, thanks for your prompt answer!


@BernhardCS

BernhardCS
13 May 2024, 22:23 ( Updated at: 14 May 2024, 05:22 )

RE: referencing an custom Indicator

PanagiotisCharalampous said: 

Hi xabbu,

You are passing wrong parameters in the indicator. Here is the correct way to initialize it

 _sma = Indicators.GetIndicator<SampleSMA>(MarketData.GetBars(TimeFrame.Daily).ClosePrices, 14);

Best Regards,

Panagiotis 

Join us on Telegram

 

Hi Panagiotis,

is there a particular indicator calculation order or could we influence it, e.g. by priorities?

In the example mentioned above the custom indicator “NNFXInfosonChart” uses the values of custom indicator “SampleSMA”, but how we can make sure that SampleSMA.LastValue is belonging to current Index (Index of NNFXInfosonChart.Calculation(THIS_INDEX)) and not to the previous index when retrieved in NNFXInfosonChart.Calculation-method?

Thank you so much.

Best regards,

Bernhard


@BernhardCS

BernhardCS
09 Nov 2023, 08:32 ( Updated at: 09 Nov 2023, 10:44 )

Hello,

the search function is a bit difficult in this forum :-) sorting by last activity instead of search by “heartbeat” I found that thread: https://ctrader.com/forum/connect-api-support/38894 about the same issue, which states: 

  • I need to send heartbeats each 10 seconds, otherwise connection will be closed after some seconds, but I will not get any notification whether my sent heartbeat has been accepted, or there was maybe any difficulty
  • just need to listen to the OnProtoHeartbeatEvent and whether there arrives a call each 30 seconds as notification that connection is still open - which has nothing to do with my sent heartbeat itself

Is that the correct solution and made I correct by my code above?

Thank you.

Bernhard


@BernhardCS