Replies

PanagiotisCharalampous
17 Nov 2024, 08:53

Hi there,

The files used to save optimization parameters are .optset files. I just tried this and looks good to me.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Nov 2024, 08:50

RE: RE: RE: RE: How is the new EntryPrice (& thus Pips etc) of a modified or partially closed Position calculated?

martins said: 

Thank you that's very helpful. I hadn't fully realized “[modified CFD] Positions are just collections of deals traded in a FIFO manner”, even for netting accounts it seems (per https://match-trade.com/retail-hedge-account-vs-netting/ ), unlike stock trading trading where reducing a holding is often considered not to alter the average price (as in https://economics.stackexchange.com/questions/20464/how-to-calculate-average-buy-price-when-you-buy-sell-and-rebuy ).

I did try something experimental, not wanting real takeprofit or stoploss action, by keeping a calculated average EntryPrice as an override encoded in the StopLoss or TakeProfit (as 4 times the actual value so as not to trigger a real take or stop) and only needing to be maintained for volume alterations from the 1st time each position is reduced, so the adjustment to its pips/profit & balance could be made from then on. Probably not particularly useful, but can work without storing any ‘state data’ outside of cTrader if not wanting real take or stop, and without needing to track or read the whole history. 

A modifyable Position.Comment would be better, and useful for other purposes too, has it been considered?

Yes the product team is considering this


@PanagiotisCharalampous

PanagiotisCharalampous
17 Nov 2024, 08:47

Hi there,

Please provide your complete code and explain to us how we can see what you are looking at. Also explain what you would expect to see instead.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Nov 2024, 08:45

RE: RE: Sharpe Sortino Ratio Missing

robert.john.edgar said: 

PanagiotisCharalampous said: 

Hi there, 

Yes it has been removed permanently.

Best regards,

Panagiotis

Seems my local only just upgraded and removed sortino/sharpe.

Why did it get removed?

Is there any workaround for this or some plugin or other way we can get this?

My past experience with cTrader optimization is you get pretty poor results if you can't see either sharpe or sortino.

Hi there,

The previous calculation was not correct and the information required to properly calculate these metrics (risk free ratio) is not available in cTrader.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Nov 2024, 08:42

RE: RE: RE: How to code Increase of lot size

GauchoHood said: 

GauchoHood said: 

PanagiotisCharalampous said: 

Hi there,

You can use the ModifyPosition method to change your position's volume.

Best regards,

Panagiotis

 

Hi Panagiotis. if (position.UnrealizedNetProfit >= profitThreshold)
{
   // Tried to adjust the volume
   double newVolume = position.VolumeInUnits * multiplier;
   position.ModifyPosition(newVolume); // Attempted this, but it did not work
}

attempted to use the ModifyPosition method to adjust the position's volume based on certain profit thresholds. Here’s the code I used:.

However, this did not work. Upon further reading, I discovered that ModifyPosition is designed to modify properties like stop loss and take profit, and not the position's volume.

Could you confirm if there’s a method or approach to modify the volume of an open position directly, or if this is strictly not supported in cTrader?

Hi there,

I quoted the wrong method, sorry. Here you go

https://help.ctrader.com/ctrader-algo/references/Trading/Positions/Position/?h=modifyvolum#modifyvolume

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Nov 2024, 08:40

Hi there,

Can you share a link to the thread?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
16 Nov 2024, 11:50

RE: travailler avec plusieurs comptes cTrader en même temps

lahutinieremichel said: 

Ah non ! 
J'ai parlé trop vite, l'environnement graphique est unique pour toutes les sessions !
Ce matin en préparant le travail pour la semaine prochaine, je découvre que l'environnement graphique que j'avais créé pour le deuxième compte a disparu au profit du premier compte.

Dommage, peut-être un axe de développement pour cTrade desktop ?

Il faudrait vraiment que l'équipe de développement puisse nous mettre en place que les sessions puissent être totalement indépendantes, j'imagine que nous sommes nombreux a utiliser plusieurs comptes en même temps.

Hi there,

Make sure you are using different workspaces on each profile.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
16 Nov 2024, 11:47

Hi there,

Which application do you use and which broker is this?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
16 Nov 2024, 11:45

Hi there,

You can use the ModifyPosition method to change your position's volume.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
16 Nov 2024, 11:42

Hi there,

Could you please send us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.

Best regards,

Panagiotis
 


@PanagiotisCharalampous

PanagiotisCharalampous
16 Nov 2024, 11:40

Hi Vasilie,

Try using https://openapi.ctrader.com/apps/token to retrieve the token and let me know if this works.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Nov 2024, 14:28

Hi there,

You first need to talk to ClickAlgo about this.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Nov 2024, 14:26

RE: RE: when adding to a losing/winning trade, it changes the take profit

walt50050 said: 

PanagiotisCharalampous said: 

Hi there,

Unfortunately I did not understand your problem. Can you please explain it using screenshots?

Best regards,

Panagiotis

 

100 leverage

1% of account, take profit 1%

the price drops, I re enter with 1% of account, take profit 1%

however now the price need to reach 2% to give me back 1%

why is Ctrader doing this? maybe because the drawdown was too high?

 

 

Unfortunately I cannot help you if you do not provide the information I am asking for


@PanagiotisCharalampous

PanagiotisCharalampous
15 Nov 2024, 10:46

RE: RE: RE: RE: Trading for this account is disabled. Trading for this symbol is currently disabled.

sumarasarjil said: 

sumarasarjil said: 

PanagiotisCharalampous said: 

sumarasarjil said: 

 I am showing disabled symbols on my desktop and I am not able to place any trade, is there any solution for this, please help me fast.

Please talk to your broker

 

 

Hi there, 

Your responses are empty

Best regards,


@PanagiotisCharalampous

PanagiotisCharalampous
15 Nov 2024, 10:45

RE: RE: MA TYPE PARAMETERS IN THE CLOUD

GauchoHood said: 

PanagiotisCharalampous said: 

No clues unfortunately. Can you record a video demonstrating the whole UI and the entire process of adding an instance and reproducing the issue? Maybe it can provide some information we are missing

Hi Panagiotis, hope you are well. Look. I need help to code an increase with the lotsize while my position progresses. For example, when 2 pips positive, double the lot. But the Chatgpt is saying it is not possible to increase Lotsize in Ctrader. Although, we have a button on Ctrader that do Just that, Double the.position size. 

Can you help me please

 

Hi there,

Please create a separate thread with your question and make it more specific. Tell me what information is missing and what is stopping you from implementing this yourself so that I can help you.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Nov 2024, 06:56

RE: RE: Make Ctrader able to trade futures

iNeurons said: 

PanagiotisCharalampous said: 

Hi there,

You can trade futures with cTrader as long as your broker offers them.

Best regards,

Panagiotis

I have yet to find any brokers that offer futures on cTrader. Could you please let us know which brokers provide this service?

Unfortunately I cannot advertise brokers. You would need to contact them yourself


@PanagiotisCharalampous

PanagiotisCharalampous
15 Nov 2024, 06:53

Hi there,

Unfortunately I did not understand your problem. Can you please explain it using screenshots?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Nov 2024, 06:51

RE: RE: How is the new EntryPrice (& thus Pips etc) of a modified or partially closed Position calculated?

martins said: 

PanagiotisCharalampous said: 

Hi there,

The entry price of the position is the average entry price of the deals composing the position. If the position has only one opening deal, then the opening price should not change. If more opening deals are involved e.g. you have increased the size of the position after entering it, the entry price might change as partial volume is closed and deals removed from the position.

Best regards,

Panagiotis

Ok, thanks, that's helpful. I can see from logging that when the volume of a position is INCREASED the calculation of its new Position.Pips value is exactly:
 (oldPips * oldVol - spreadAsPips * increaseInVol) / newVol
which is correctly distributing the pips on the old portion plus the immediate pip loss of the new portion (due to spread) across the new larger volume (and so the EntryPrice will be that many pips from the current price and represent the weighted average). Rounding of the calculation seems usually to the nearest 0.1 pip but sometimes goes the other way, possibly to correct for accumulated rounding error. That's all fine.

HOWEVER, I'm seeing the remaining portion of a position after a REDUCTION in volume ALSO has its Position.Pips altered. Why is that?
Possibly the position was not combined really (in the live server or backtest memory) but rather kept as a collection of parts from each modification that increased volume, so that when it is later reduced some specific part is closed, in a LIFO or FIFO order or some other rule? Is this broker driven? 

So maybe ModifyPosition does not really modify a position in the sense of ending up with one homogeneous position with a single EntryPrice & Pips profit? Can't brokers running cTrader handle merging modification deals into one net holding?

If not, please could the doc say so, and how do we know what the separate parts are so we can predict partial closing results (without laboriously keeping track of all modifications)? Is there any information in a Position that can tell a cBot the position's stats will not react in a predictable way if later PARTIALLY closed ('predictable' meaning Entry & Pips stay unchanged, profit prorata etc)? 

I'm coming to the conclusion it's not good to mix increasing and decreasing volume via ModifyPosition; one or the other yes, predictable, but not both in the same cBot if it's basing decisions on Position.Pips or Account.UnrealizedProfit, or on almost anything other than Equity.

Thanks.

 

Update re "laboriously keeping track": not that hard, but involves keeping ‘account state’ data outside the cTrader account, like in a local file or cloud, not self-contained in the positions - unless perhaps cTrader could add a large Account.Comment field that could store arbitrary data, or make the Positions.Comment modifyable & bigger?? :) 


modifyDeals.Count=95 i=58 modifyDeals[i].Id=6 modifyDeals[i].Vol=19000 modifyDeals[i].Bid=1.36653 modifyDeals[i].Ask=1.36656
modifyDeals.Count=95 i=59 modifyDeals[i].Id=6 modifyDeals[i].Vol=13000 modifyDeals[i].Bid=1.36404 modifyDeals[i].Ask=1.36407
modifyDeals.Count=95 i=60 modifyDeals[i].Id=5 modifyDeals[i].Vol=4000 modifyDeals[i].Bid=1.36399 modifyDeals[i].Ask=1.36402
modifyDeals.Count=95 i=61 modifyDeals[i].Id=6 modifyDeals[i].Vol=-230000 modifyDeals[i].Bid=1.3605 modifyDeals[i].Ask=1.36053
modifyDeals.Count=95 i=62 modifyDeals[i].Id=5 modifyDeals[i].Vol=-230000 modifyDeals[i].Bid=1.3605 modifyDeals[i].Ask=1.36053
modifyDeals.Count=95 i=63 modifyDeals[i].Id=6 modifyDeals[i].Vol=-77000 modifyDeals[i].Bid=1.36007 modifyDeals[i].Ask=1.3601
modifyDeals.Count=95 i=64 modifyDeals[i].Id=5 modifyDeals[i].Vol=-77000 modifyDeals[i].Bid=1.36007 modifyDeals[i].Ask=1.3601
modifyDeals.Count=95 i=65 modifyDeals[i].Id=6 modifyDeals[i].Vol=10000 modifyDeals[i].Bid=1.35909 modifyDeals[i].Ask=1.35912
modifyDeals.Count=95 i=66 modifyDeals[i].Id=5 modifyDeals[i].Vol=19000 modifyDeals[i].Bid=1.36651 modifyDeals[i].Ask=1.36654
modifyDeals.Count=95 i=67 modifyDeals[i].Id=5 modifyDeals[i].Vol=10000 modifyDeals[i].Bid=1.36892 modifyDeals[i].Ask=1.36895
modifyDeals.Count=95 i=68 modifyDeals[i].Id=5 modifyDeals[i].Vol=13000 modifyDeals[i].Bid=1.37044 modifyDeals[i].Ask=1.37047

  struct modifyDeal {     // https://stackoverflow.com/questions/33809867/c-sharp-struct-in-a-list
  public int Id { get; set; }
  public double Vol { get; set; }
  public double Bid { get; set; }
  public double Ask { get; set; }
  public modifyDeal(int id, double vol, double bid, double ask)
  { Id = id; Vol = vol; Bid = bid; Ask = ask; }
 }

 List<modifyDeal> modifyDeals = new List<modifyDeal>(); // 14nov24

    var deal = new modifyDeal(position.Id, newVolume - position.VolumeInUnits, Symbol.Bid, Symbol.Ask);
   //or deal.Id = position.Id; etc
   modifyDeals.Add(deal); 

Might be able to extract same info using the History interface possibly (how far back does it go?), but haven't found all the doc about it, for instance where is History.OrderByDescending() other than in the example https://help.ctrader.com/ctrader-algo/references/Trading/History/History/#examples 

Later: Actually only one adjustment number per position might need remembering in order to emulate proportional netting when partially closing a position that has been increased earlier - the difference between ‘the proportional Pips or Entry expected before the partial close is done’ and ‘the actual new Pips or new Entry that appears in the Position afterwards’ - so the Bot can apply that offset to later Pips & profit (with opposite adjustment to Balance).
Is there any way of storing a small amount of data per position on the server, for instance a modifyable Comment? 
 

Hi there,

HOWEVER, I'm seeing the remaining portion of a position after a REDUCTION in volume ALSO has its Position.Pips altered. Why is that?
Possibly the position was not combined really (in the live server or backtest memory) but rather kept as a collection of parts from each modification that increased volume, so that when it is later reduced some specific part is closed, in a LIFO or FIFO order or some other rule? Is this broker driven? 

This is what I explained in my previous post. Positions are just collections of deals traded in a FIFO manner.

Is there any information in a Position that can tell a cBot the position's stats will not react in a predictable way if later PARTIALLY closed ('predictable' meaning Entry & Pips stay unchanged, profit prorata etc)? 

There isn't. As you correctly pointed out, if you need this information, you need to track it your self. 

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Nov 2024, 06:45

Hi there,

Try using multiple profiles

https://help.ctrader.com/ctrader/interface/settings/?h=profiles#startup

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
15 Nov 2024, 06:41

RE: RE: Risk-Reward - Market order lots not computer properly ?

all-raceway0m said: 

PanagiotisCharalampous said: 

Hi there,

I did not understand what you are doing and what exactly is happening. Can you record a video so that we can understand what you are looking at?

Best regards,

Panagiotis

Hi,

I undwerstood from this video that I can fix a risk reward (lets sasy 100 usd) and when I move My SL on a limit order the nb of lots is computed automatically to keep 100 usd of risk.
And that if I change to market order the nb of lots will be computer when I click the buy/sell button based on the current price to respect 100 usd risk.

https://help.ctrader.com/ctrader-web/charts/risk-reward/

On video below that I did we can see:

  • when I chose limit order and fix the risk to 100 usd. nb of lots is computed automatically when i change the entry point
  • when I change to market order and place the order the nb od lots is not recomputed but the last computed for the entry poitn which his not righ

https://share.icloud.com/photos/0adBeJVHTTMum0RYU3eeekHmQ

My be I understood wrong the feature for market order.., if i understood wrong can you any idea how I can do this as I want to always have the same risk

Thanks

Hi there,

It is impossible to set the risked amount exactly at a fixed stop loss price, since the trade eventually needs to be rounded at a volume that meets the minimum step set by the broker. Therefore you will get an approximation at best. The tool calculates the exact volume that needs to be traded for that amount to be risked but eventually you need to trade the closest valid volume.

Best regards,

Panagiotis


@PanagiotisCharalampous