Volume with different brokers

Created at 06 Apr 2018, 19:07
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!
alexander.n.fedorov's avatar

alexander.n.fedorov

Joined 02.01.2018

Volume with different brokers
06 Apr 2018, 19:07


Dear Panagiotis,

I opened recently an account with one more broker, Kawase.

The line of code, which was working perfectly with FxPro

"

...

       protected void ManageRisk()
        {
            equity = Account.Equity;
            var AmountRisked = equity * risk;
            var normCostOfRange = range * (1 + BreakoutOffset / 100) / Symbol.PipSize * Symbol.PipValue;
            Print("normCostofRange = ", normCostOfRange);
            var Quantity = AmountRisked / normCostOfRange;
            volume = Symbol.NormalizeVolume(Quantity, RoundingMode.ToNearest);
            Print("This is the volume checked =  {0}, Quantity = {1}, PipSize = {2}, PipDigits = {3}", volume, Quantity, Symbol.PipSize, PipDigits);
            SL = Math.Round(range * (1 + BreakoutOffset / 100) / Symbol.PipSize, PipDigits, MidpointRounding.AwayFromZero);
            TP = Math.Round(range * (1 + TPOffset / 100) / Symbol.PipSize, PipDigits, MidpointRounding.AwayFromZero);
            Print("AmountRisked = {0}, Quantity = {1}, normCostOfRange = {2}", AmountRisked, Quantity, normCostOfRange);

        }

...

"

with this broker has given me differnt result

"

06/04/2018 18:57:06.001 | cBot "New Yourk Range v.3" was started successfully for SWITZERLAND 20, m15.
06/04/2018 18:57:06.126 | Instance NYR v.3 SWITZERLAND 20 1.0%
06/04/2018 18:57:06.141 | The Range Filter: Start the Trade = True
06/04/2018 18:57:06.188 | Stop Loss= 34.05, Take Profit = 61.2, symbol.Digitis = 2, Symbol.PipSize 1, PipDigits = 2
06/04/2018 18:57:06.204 | last trade: The were no trades on this pair
06/04/2018 18:57:12.282 | check 1
06/04/2018 18:57:12.282 | This is the volume checked =  0, normAmount = 1015.31180354502, PipSize = 1, PipDigits = 2
06/04/2018 18:57:12.282 | AmountRisked = 974.9227 
06/04/2018 18:57:12.282 | check 2
06/04/2018 18:57:12.297 | Placing Stop Order to Buy 0 SWITZERLAND 20 (Price: 8711.00, SL: 35.7, TP: 61.2)
06/04/2018 18:57:12.422 | → Placing Stop Order to Buy 0 SWITZERLAND 20 (Price: 8711.00, SL: 35.7, TP: 61.2) FAILED
with error "BadVolume"

"

Please, advise

Regards, 

Sasha

 

 

 

 


@alexander.n.fedorov
Replies

alexander.n.fedorov
06 Apr 2018, 19:12

Pangiotis,

to be more correct the printout is this:

 

"

06/04/2018 19:09:24.677 | cBot "New Yourk Range v.3" was started successfully for SWITZERLAND 20, m15.
06/04/2018 19:09:24.802 | Instance NYR v.3 SWITZERLAND 20 1.0%
06/04/2018 19:09:24.833 | The Range Filter: Start the Trade = True
06/04/2018 19:09:24.896 | Stop Loss= 34.05, Take Profit = 61.2, symbol.Digitis = 2, Symbol.PipSize 1, PipDigits = 2
06/04/2018 19:09:24.911 | last trade: The were no trades on this pair
06/04/2018 19:09:25.005 | check 1
06/04/2018 19:09:25.005 | normCostofRange = 37.1665937909926
06/04/2018 19:09:25.005 | This is the volume checked =  0, Quantity = 26.2592021611765, PipSize = 1, PipDigits = 2
06/04/2018 19:09:25.005 | AmountRisked = 975.9651, Quantity = 26.2592021611765, normCostOfRange = 37.1665937909926
06/04/2018 19:09:25.005 | check 2
06/04/2018 19:09:25.021 | Placing Stop Order to Buy 0 SWITZERLAND 20 (Price: 8711.00, SL: 35.7, TP: 61.2)
06/04/2018 19:09:25.146 | → Placing Stop Order to Buy 0 SWITZERLAND 20 (Price: 8711.00, SL: 35.7, TP: 61.2) FAILED with error "BadVolume"

 

"

The first printout did was after commented command to print normCostofRange 

Regards, 

Sasha


@alexander.n.fedorov

alexander.n.fedorov
07 Apr 2018, 14:49

Volume with different brokers

there is another thing:

this is the piece of code:

"
...

        protected override void OnStart()
        {
            Print("Broker name =: {0}, SymbolCode =: {1}, MinVolume =: {2},", Account.BrokerName.ToString(), Symbol.Code, Symbol.VolumeMin.ToString());
...
"

and this is the printout for two different symbols:
"
...
07/04/2018 14:39:37.704 | Broker name =: Kawase, SymbolCode =: EURUSD, MinVolume =: 1000,
...

"

"
...
07/04/2018 14:42:58.157 | Broker name =: Kawase, SymbolCode =: SWITZERLAND 20, MinVolume =: 0,
...

"

 

with a differen broke the result is:

"
07/04/2018 14:45:18.795 | Broker name =: FxPro, SymbolCode =: #Swiss20, MinVolume =: 1,
"

 

"
07/04/2018 14:46:45.958 | Broker name =: FxPro, SymbolCode =: EURUSD, MinVolume =: 1000,


"


@alexander.n.fedorov

PanagiotisCharalampous
10 Apr 2018, 10:45 ( Updated at: 21 Dec 2023, 09:20 )

Hi Sasha,

Each broker can configure different min and max volumes for each symbol. See below the relevant information for the two brokers you mentioned

FxPro

Kawase

The issue here is that cAlgo cannot handle fractional volumes, therefore in the case of Kawase it rounds it down to 0. This will be resolved with cTrader 3.0.

Best Regards,

Panagiotis


@PanagiotisCharalampous

alexander.n.fedorov
10 Apr 2018, 13:47

Thank you. Understood. Will wait


@alexander.n.fedorov