Issue / explanation AmountRisked

Created at 28 Apr 2024, 10:48
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
SE

sebastien.t

Joined 12.03.2024

Issue / explanation AmountRisked
28 Apr 2024, 10:48


Good day,

I have a problem the  function AmountRisked. I would like to risk 0.5% of my Balance for each trade.

So I tried to use that function. So basically for the same % of risk, I expect the Volume calulated to be doubled when my Stop Loss is divided by 2.

 

Here is my code

protected override void OnStart()

{

Print("Pip size "+Symbol.PipSize);

Print("Account Balance " + Account.Balance);

var Volume_10pips_SL = Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 10);

var Volume_20pips_SL = Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 20);

Print("Volume for 0.5% Risk of the Balance with 10 pips Stop Loss "+ Volume_10pips_SL);

Print("Volume for 0.5% Risk of the Balance with 20 pips Stop Loss "+ Volume_20pips_SL);

Print("AmountRisked for 0.5% Risk of the Balance with 10 pips Stop Loss " + Symbol.AmountRisked(Volume_10pips_SL, 10));

Print("AmountRisked for 0.5% Risk of the Balance with 20 pips Stop Loss " + Symbol.AmountRisked(Volume_20pips_SL, 20));

}

 

 

And the result for US500

 

Could you help what is going wrong in my usage of the function Symbol.VolumeForProportionalRisk?

 

Thank you


@sebastien.t
Replies

PanagiotisCharalampous
28 Apr 2024, 15:44

Hi there,

I don't see any problem.

Can you please explain what the problem is?

Best regards,

Panagiotis


@PanagiotisCharalampous

sebastien.t
28 Apr 2024, 19:59

RE: Issue / explanation AmountRisked

True in your case it is perfectly fine. 

But look at my results for the same code on a Demo account

I have no idea why I get the weird results…

 

 

PanagiotisCharalampous said: 

Hi there,

I don't see any problem.

Can you please explain what the problem is?

Best regards,

Panagiotis

 


@sebastien.t

PanagiotisCharalampous
29 Apr 2024, 05:58

RE: RE: Issue / explanation AmountRisked

sebastien.t said: 

True in your case it is perfectly fine. 

But look at my results for the same code on a Demo account

I have no idea why I get the weird results…

 

 

PanagiotisCharalampous said: 

Hi there,

I don't see any problem.

Can you please explain what the problem is?

Best regards,

Panagiotis

 

Can you confirm you are using cTrader for Mac?


@PanagiotisCharalampous

sebastien.t
29 Apr 2024, 06:25

RE: RE: RE: Issue / explanation AmountRisked

Good day,

 

I have both Mac and Windows

Here is the results this morning from my Mac 

 

And from my Windows server

 

The only difference I can see with your screenshot is the PipSize…

 


@sebastien.t

PanagiotisCharalampous
29 Apr 2024, 07:46

RE: RE: RE: RE: Issue / explanation AmountRisked

sebastien.t said: 

Good day,

 

I have both Mac and Windows

Here is the results this morning from my Mac 

 

And from my Windows server

 

The only difference I can see with your screenshot is the PipSize…

 

Can you please advise your broker and cTrader version?


@PanagiotisCharalampous

sebastien.t
29 Apr 2024, 08:15

RE: RE: RE: RE: RE: Issue / explanation AmountRisked

On Mac, I use the Demo account for my bot testing 

 

 

On Windows :

The same Demo account 


@sebastien.t

sebastien.t
29 Apr 2024, 08:39

RE: RE: RE: RE: RE: RE: Issue / explanation AmountRisked

Your issue is definitely coming from the Spotware Demo Account.

Here is my result for the S&P with an other broker

But i would need your Demo account because you have by far deeper historical for my backtesting…


@sebastien.t

sebastien.t
29 Apr 2024, 15:08 ( Updated at: 30 Apr 2024, 05:23 )

RE: RE: RE: RE: RE: RE: RE: Issue / explanation AmountRisked

Hi PanagiotisCharalampous

Do you have any idea where the issue is?

It is very weird…

Thank you


@sebastien.t

PanagiotisCharalampous
30 Apr 2024, 05:24

RE: RE: RE: RE: RE: RE: RE: RE: Issue / explanation AmountRisked

sebastien.t said: 

Hi PanagiotisCharalampous

Do you have any idea where the issue is?

It is very weird…

Thank you

It's a bug, it will be fixed in upcoming updates


@PanagiotisCharalampous

sebastien.t
30 Apr 2024, 08:32

RE: RE: RE: RE: RE: RE: RE: RE: RE: Issue / explanation AmountRisked

Hello,

 

I think there is also a huge issue on the lot calculation on the FOREX. I tried the function on GBPUSD

For an account of $1.000.000 and 10 pips Stop Loss, the function Symbol.VolumeForProportionalRisk proposed me to buy 2.500.00 lots which is by far too much…

But when I trued to reverse it with the function Symbol.AmountRisked, it says that I risk $2.500 which is the right number because my risk is 0.25% of the balance.

But obviously, it is not the risk that I have for 2.500.000 lots with a 10pips Stop Loss.  

I can't even put a trade with that figures…

 

Is it also a but? When do you expect to fix it?

 

Thank you

 

protected override void OnStart()

{

Print("Symbol "+ Symbol.Name);

Print("Pip size "+Symbol.PipSize);

Print("Account Balance " + Account.Balance);


 

Print("Volume to risk for SL 10pips " + Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 10));

Print("Amount risked for Volume 2 500 000 with SL 10pips " + Symbol.AmountRisked(Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 10), 10));

}

 


@sebastien.t

PanagiotisCharalampous
30 Apr 2024, 10:15

RE: RE: RE: RE: RE: RE: RE: RE: RE: RE: Issue / explanation AmountRisked

sebastien.t said: 

Hello,

 

I think there is also a huge issue on the lot calculation on the FOREX. I tried the function on GBPUSD

For an account of $1.000.000 and 10 pips Stop Loss, the function Symbol.VolumeForProportionalRisk proposed me to buy 2.500.00 lots which is by far too much…

But when I trued to reverse it with the function Symbol.AmountRisked, it says that I risk $2.500 which is the right number because my risk is 0.25% of the balance.

But obviously, it is not the risk that I have for 2.500.000 lots with a 10pips Stop Loss.  

I can't even put a trade with that figures…

 

Is it also a but? When do you expect to fix it?

 

Thank you

 

protected override void OnStart()

{

Print("Symbol "+ Symbol.Name);

Print("Pip size "+Symbol.PipSize);

Print("Account Balance " + Account.Balance);


 

Print("Volume to risk for SL 10pips " + Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 10));

Print("Amount risked for Volume 2 500 000 with SL 10pips " + Symbol.AmountRisked(Symbol.VolumeForProportionalRisk( ProportionalAmountType.Balance, RiskPerTrade, 10), 10));

}

 

We will fix this in the next update of cTrader


@PanagiotisCharalampous