Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

margin cut
 Post subject: margin cut Post rating: 0   Post Posted: Sat 05 Oct, 2013, 19:26 

User rating: 0
Joined: Sat 28 Sep, 2013, 23:42
Posts: 8
Location: Poland,
Hello I need to display the information where it will be the MC for open positions. I can draw a red line and set it to any level but I do not know how to calculate this level for open positions ? I was thinking of something like this I do not know whether it will be correct calculation?

douuble EQ = account.getEquity();
double Total_lot_for_open_position = 0.3; //
double Margin_Cut_Level=0;
double EP =0;

//****************
JFUtils utils = context.getUtils();
pipCost = ( utils.convertPipToCurrency(instrument, context.getAccount().getCurrency()) ) *100000 * total_lot_for_open_position;
EP = EQ/ pipCost ;
MC = ask +EP;

//****************

IChart chart = context.getChart(instrument);
IChartObject MC_Line = chart.draw("MC_Line", IChart.Type.HLINE, tick.getTime(), tick.getBid()+EP);
MC_Line.setColor(Color.RED);


Image


Attachments:
mc.png [16.14 KiB]
Downloaded 241 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
The Best Answer  Post subject: Re: margin cut Post rating: 0   Post Posted: Mon 07 Oct, 2013, 12:35 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/swiss/english/ ... ts/margin/
For order calculations see:
https://www.dukascopy.com/wiki/#Order_Management
And please don't use the deprecated API methods, see the current ones:
https://www.dukascopy.com/wiki/#Create_and_manage_chart_objects


 

Jump to:  

  © 1998-2026 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com