You need to enable JavaScript in order to visit our site!
 
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

GetProfitGross (Currency currency)

method
Profit/loss (without swaps or commissions) all calculated based on the current broker's price. For open position it shows the profit/loss you would make if you close the position at the current price. If position closed, this parameter show profit/loss what trader have after closing this position.

Syntax

public double GetProfitGross (Currency currency)

Parameters

currency — Currency
currency for calculation

Return

double Gross profit 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 是一個專業的交易平台,結合了強大的圖表和分析工具,並可在不同的金融市場進行交易。 它是由 PFSOFT UK LTD 開發的,該公司是全球銀行和經紀商交易技術提供商
© 2024. PTMC 為基於 Protrader 技術的專業交易平台
地址
臺北市大安區羅斯福路3段273號5樓
聯絡我們
電話: +886-2-2367-8583
E-mail: service@kcdatanet.com
社群
© 2024. PTMC 為基於 Protrader 技術的專業交易平台