You need to enable JavaScript in order to visit our site!
30% off on any PTMC license

Still no PTMC license? Don't waste your time and get yourself 30% discount on any PTMC license.

Hurry to buy at the best price of the year! The promotion is valid from 22.11.17 to 03.12.17.

 
Logo PTMC
NAVIGATION
CANCEL
 
or via PTMC account
Restore password
or via PTMC account
Logo PTMC
NAVIGATION
or via PTMC account
Restore password
or via PTMC account
or via PTMC account
Restore password
or via PTMC account

GetExposition (Currency currency)

method
Returns amount of counter instrument part on which your position is open. For open position recalculating occurs after every new quote. If position close - return exposition fixing when position was close. The Exposure calculated using the amount and cross price.

Syntax

public double GetExposition (Currency currency)

Parameters

currency — Currency
currency for calculation

Return

double exposition of the position by the specified currency

Example


using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using PTLRuntime.NETScript;

namespace PositionClassExamples
{
     public class PositionClassExamples : NETStrategy
     {
         Position[] All_pos;
         
         public override void OnQuote()
         {
             All_pos=Positions.GetPositions();
        
             for(int i=0;All_pos.Length-1>i;i++)
             {
                 //PositionClass Properties
                 Print(All_pos[i].Account);
                 Print(All_pos[i].Amount);
                 Print(All_pos[i].CloseOrderId);
                 Print(All_pos[i].ClosePrice);
                 Print(All_pos[i].CloseTime);
                 Print(All_pos[i].Comment);
                 Print(All_pos[i].CurrentPrice);
                 Print(All_pos[i].Exp1);
                 Print(All_pos[i].Exp1Close);
                 Print(All_pos[i].Exp2);
                 Print(All_pos[i].Exp2Close);
                 Print(All_pos[i].GroupId);
                 Print(All_pos[i].Id);
                 Print(All_pos[i].Instrument);
                 Print(All_pos[i].IsGroupPart);
                 Print(All_pos[i].MagicNumber);
                 Print(All_pos[i].OpenOrderId);
                 Print(All_pos[i].OpenPrice);
                 Print(All_pos[i].OpenTime);
                 Print(All_pos[i].Side);
                 Print(All_pos[i].StopLossOrder);
                 Print(All_pos[i].TakeProfitOrder);
        
                 //PositionClass Methods
                 Print(All_pos[i].GetCommission(Currency.Server));
                 Print(All_pos[i].GetExposition(Currency.Server));
                 Print(All_pos[i].GetProfitExp2());
                 Print(All_pos[i].GetProfitGross(Currency.Server));
                 Print(All_pos[i].GetProfitNet(Currency.Server));
                 Print(All_pos[i].GetSwaps(Currency.Server));
                 Print(All_pos[i].GetUsedMargin(Currency.Server));
                 Print(All_pos[i].RemoveStopLoss());
                 Print(All_pos[i].RemoveTakeProfit());
                 Print(All_pos[i].SetStopLoss(1950));
                 Print(All_pos[i].SetTakeProfit(2000));
                 All_pos[i].Close();
             }
         }
     }
}
 
Discussion
Join PTMC community to post your comments
No comments yet. Be the first.
PTMC is a professional trading platform that combines all the best charting and analytical tools to trade on different financial markets. It is developed by PFSOFT UK LTD, a global provider of trading technology for banks & brokers
© 2017. PTMC is based on Protrader technology
PFSOFT UK LTD
71-75, Shelton Street,
Covent Garden,
London, WC2H9SQ,
United Kingdom
Support & Development
PFSOFT Ukraine
Office #701
Mechnikova Street, 10B
49000, Dnipro, Ukraine
Contact us
Phone: +380 56 740 30 01
E-mail: info@protrader.org
Skype: PTMC_support
Find more ways to contact
Join us in social networks