Profit or Loss Calculation On CFD instruments for Developing EA with python language

 

  

Hi anyone help me on this , i'm trying to develop a EA using python language and i need to calculate the lot sizes to fix my risk reward ration .

attaching a images , in this image you can see 3 different brokers and when we trade 0.01 lot thee of them are giving different profits .

i need to know how we can implement the calculation in your Trade manager i have used the lot size calculation that was working perfectly in these brokers

if possible please share the calculation method , like what are the parameters using to calculate the profits like your trade manager


i need to risk 50$ on a single trade : in FXTM just need to open a trade with 0.01 lot and 50 point sl it will be 50$ risk

in 8cap 0.10 lot for 50 point sl

mff its 1 standard lot for 50 point sl

i need this to calculate from python code

from python i can get the following information from symbol properties :


custom=False
chart_mode=0
select=True
visible=True
session_deals=0
session_buy_orders=0
session_sell_orders=0
volume=0
volumehigh=0
volumelow=0
time=1684950237
digits=2
spread=98
spread_float=True
ticks_bookdepth=1
trade_calc_mode=2
trade_mode=4
start_time=0
expiration_time=0
trade_stops_level=0
trade_freeze_level=0
trade_exemode=2
swap_mode=1
swap_rollover3days=5
margin_hedged_use_leg=False
expiration_mode=15
filling_mode=3
order_mode=127
order_gtc_mode=0
option_mode=0
option_right=0
bid=4116.16
bidhigh=4157.16
bidlow=4110.41
ask=4117.14
askhigh=4158.14
asklow=4111.39
last=0.0
lasthigh=0.0
lastlow=0.0
volume_real=0.0
volumehigh_real=0.0
volumelow_real=0.0
option_strike=0.0
point=0.01
trade_tick_value=0.1
trade_tick_value_profit=0.1
trade_tick_value_loss=0.1
trade_tick_size=0.01
trade_contract_size=10.0
trade_accrued_interest=0.0
trade_face_value=0.0
trade_liquidity_rate=0.0
volume_min=0.01
volume_max=3.0
volume_step=0.01
volume_limit=3.0
swap_long=-7.4239999999999995
swap_short=2.762
margin_initial=0.0
margin_maintenance=0.0
session_volume=0.0
session_turnover=0.0
session_interest=0.0
session_buy_orders_volume=0.0
session_sell_orders_volume=0.0
session_open=4150.39
session_close=4150.26
session_aw=0.0
session_price_settlement=0.0
session_price_limit_min=0.0
session_price_limit_max=0.0
margin_hedged=0.0
price_change=-0.8161
price_volatility=0.0
price_theoretical=0.0
price_greeks_delta=0.0
price_greeks_theta=0.0
price_greeks_gamma=0.0
price_greeks_vega=0.0
price_greeks_rho=0.0
price_greeks_omega=0.0
price_sensitivity=0.0
basis=
category=
currency_base=USD
currency_profit=USD
currency_margin=USD
bank=
description=US SPX 500 Cash
exchange=
formula=
isin=
name=SPX500
page=
path=Indices\Major Index\SPX500



symbol details are from 8cap broker
Thanks in advance
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
 

Please read the following post ... Calculation of lot size

It is not specific for Python, but the basics are the same, and the Python API offers similar functionality.

 
Fernando Carreiro #:
Your topic has been moved to the section: Expert Advisors and Automated Trading

Thank you , after posting then only i realized that mistake then couldn't find the option to change topic category 

 
Fernando Carreiro #:

Please read the following post ... Calculation of lot size

It is not specific for Python, but the basics are the same, and the Python API offers similar functionality.

Perfect , Thank you @Fernando Carreiro it works , its been 3 days i was stuck with this issue . once again thanks for your Help 

Reason: