Volume for order

Created at 02 Jul 2016, 08:46
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!
TT

ttkrauss

Joined 03.11.2015

Volume for order
02 Jul 2016, 08:46


Hi there

I always want to trade the same percentage of my account balance regardless of the currency pair I trade.

Is there a smart way to calculate the volume to set an order in cAlgo?

Thanks


@ttkrauss
Replies

kricka
02 Jul 2016, 12:03

No smart way

It all depends on how accurate the calculation based on a percentage you want. If you like the spread and the commission included as well it gets complicated. The History in the API can be used to get the commission and other information before actually making the order. Unfortunately there is no smart way to calculate as there is no method in the API that does it all. Several pieces has to be glued together from different parts of the API. Best way to accomplish it is to learn the API in and out and by trial and error testing different codes, also a lot of suggestions are given from all the programmers on the forum. The Market Order 3.0 does it all, have a look at it and you get some information what can be done.

Information link: Market Order 3.0


@kricka

... Deleted by UFO ...

galafrin
03 Jul 2016, 23:44

RE:

ttkrauss said:

Hi there

I always want to trade the same percentage of my account balance regardless of the currency pair I trade.

Is there a smart way to calculate the volume to set an order in cAlgo?

Thanks

This would do in real time only

volume = Symbol.NormalizeVolume ( Account.Balance / Symbol.Bid * InpLeverage / Symbol.TickValue * Symbol.TickSize ) ;

 


@galafrin