last ...
This commit is contained in:
@@ -392,12 +392,17 @@ bool InitGUI()
|
|||||||
int startX = 5;
|
int startX = 5;
|
||||||
int startY = 25;
|
int startY = 25;
|
||||||
|
|
||||||
|
//
|
||||||
|
int defaultGap = 5;
|
||||||
|
int defaultWidth = 100;
|
||||||
|
int defaultHeight = 30;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buy ...
|
// Buy ...
|
||||||
int btnBuyStartX = startX;
|
int btnBuyStartX = startX;
|
||||||
int btnBuySizeX = startX + 100;
|
int btnBuySizeX = startX + defaultWidth;
|
||||||
int btnBuyStartY = startY;
|
int btnBuyStartY = startY;
|
||||||
int btnBuySizeY = startY + 50;
|
int btnBuySizeY = startY + defaultHeight;
|
||||||
string btnBuyName = objSuffix + "BTN_BUY";
|
string btnBuyName = objSuffix + "BTN_BUY";
|
||||||
result = btnBuy.Create(
|
result = btnBuy.Create(
|
||||||
chartId,
|
chartId,
|
||||||
@@ -422,7 +427,7 @@ bool InitGUI()
|
|||||||
//
|
//
|
||||||
// Sell ...
|
// Sell ...
|
||||||
int btnSellStartX = btnBuyStartX + btnBuySizeX;
|
int btnSellStartX = btnBuyStartX + btnBuySizeX;
|
||||||
int btnSellSizeX = btnSellStartX + 100;
|
int btnSellSizeX = btnSellStartX + defaultWidth;
|
||||||
int btnSellStartY = btnBuyStartY;
|
int btnSellStartY = btnBuyStartY;
|
||||||
int btnSellSizeY = btnBuySizeY;
|
int btnSellSizeY = btnBuySizeY;
|
||||||
string btnSellName = objSuffix + "BTN_SELL";
|
string btnSellName = objSuffix + "BTN_SELL";
|
||||||
@@ -449,9 +454,9 @@ bool InitGUI()
|
|||||||
//
|
//
|
||||||
// LABEL Position ID ...
|
// LABEL Position ID ...
|
||||||
lblPositionIdStartX = btnBuyStartX;
|
lblPositionIdStartX = btnBuyStartX;
|
||||||
lblPositionIdSizeX = lblPositionIdStartX + 100;
|
lblPositionIdSizeX = lblPositionIdStartX + defaultWidth;
|
||||||
lblPositionIdStartY = btnSellSizeY + 5;
|
lblPositionIdStartY = btnSellSizeY + defaultGap;
|
||||||
lblPositionIdSizeY = lblPositionIdStartY + 50;
|
lblPositionIdSizeY = lblPositionIdStartY + defaultHeight;
|
||||||
string lblPositionIdName = objSuffix + "LBL_POS_ID";
|
string lblPositionIdName = objSuffix + "LBL_POS_ID";
|
||||||
result = lblPositionId.Create(
|
result = lblPositionId.Create(
|
||||||
chartId,
|
chartId,
|
||||||
@@ -475,9 +480,9 @@ bool InitGUI()
|
|||||||
//
|
//
|
||||||
// Close ...
|
// Close ...
|
||||||
btnCloseStartX = startX;
|
btnCloseStartX = startX;
|
||||||
btnCloseSizeX = btnCloseStartX + 100;
|
btnCloseSizeX = btnCloseStartX + defaultWidth;
|
||||||
btnCloseStartY = lblPositionIdSizeY + 5;
|
btnCloseStartY = lblPositionIdSizeY + defaultGap;
|
||||||
btnCloseSizeY = lblPositionIdSizeY + 50;
|
btnCloseSizeY = lblPositionIdSizeY + defaultHeight;
|
||||||
string btnCloseName = objSuffix + "BTN_CLOSE";
|
string btnCloseName = objSuffix + "BTN_CLOSE";
|
||||||
result = btnClose.Create(
|
result = btnClose.Create(
|
||||||
chartId,
|
chartId,
|
||||||
@@ -501,10 +506,10 @@ bool InitGUI()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Close All ...
|
// Close All ...
|
||||||
int btnCloseAllStartX = btnCloseSizeX + 5;
|
int btnCloseAllStartX = btnCloseSizeX + defaultGap;
|
||||||
int btnCloseAllSizeX = btnCloseAllStartX + 100;
|
int btnCloseAllSizeX = btnCloseAllStartX + defaultWidth;
|
||||||
int btnCloseAllStartY = lblPositionIdSizeY + 5;
|
int btnCloseAllStartY = lblPositionIdSizeY + defaultGap;
|
||||||
int btnCloseAllSizeY = lblPositionIdSizeY + 50;
|
int btnCloseAllSizeY = lblPositionIdSizeY + defaultHeight;
|
||||||
string btnCloseAllName = objSuffix + "BTN_CLOSE_ALL";
|
string btnCloseAllName = objSuffix + "BTN_CLOSE_ALL";
|
||||||
result = btnCloseAll.Create(
|
result = btnCloseAll.Create(
|
||||||
chartId,
|
chartId,
|
||||||
@@ -1178,7 +1183,27 @@ void UpdateGUIState()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Read All Positions ...
|
// Read All Positions ...
|
||||||
|
double profits = 0;
|
||||||
|
XPosition positions[];
|
||||||
|
string positionsInfo = "";
|
||||||
|
int positionsCount = eaTrader.GetPositions(positions);
|
||||||
|
has = IsValidSize(positionsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < positionsCount; i++)
|
||||||
|
{
|
||||||
|
profits += positions[i].profit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (positionsCount > 1)
|
||||||
|
{
|
||||||
|
positionsInfo = "Positions Count: " + ToXString(positionsCount) + ", Profits: " + ToXString(profits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
if (hasPosition)
|
if (hasPosition)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1195,16 +1220,67 @@ void UpdateGUIState()
|
|||||||
"Equity: " + ToXString(eaTrader.mAccount.GetEquity());
|
"Equity: " + ToXString(eaTrader.mAccount.GetEquity());
|
||||||
|
|
||||||
//
|
//
|
||||||
string posInfos[] = {
|
string posInfos[];
|
||||||
posTicket,
|
|
||||||
posType,
|
|
||||||
posSymbolPeriod,
|
|
||||||
posProfit,
|
|
||||||
posRiskToRewardRatio,
|
|
||||||
accountInfo //
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Ticket ...
|
||||||
|
Add(
|
||||||
|
posTicket,
|
||||||
|
posInfos //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Type ...
|
||||||
|
Add(
|
||||||
|
posType,
|
||||||
|
posInfos //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Symbol Period ...
|
||||||
|
Add(
|
||||||
|
posSymbolPeriod,
|
||||||
|
posInfos //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Profit ...
|
||||||
|
Add(
|
||||||
|
posProfit,
|
||||||
|
posInfos //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Risk to Reward Ratio ...
|
||||||
|
Add(
|
||||||
|
posRiskToRewardRatio,
|
||||||
|
posInfos //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add Positions Info if Exists ...
|
||||||
|
if (IsSpecifiedValid(positionsInfo))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
positionsInfo,
|
||||||
|
posInfos //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Clear Info Array ...
|
||||||
|
selectedPosInfoArr.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Adding Account Info ...
|
||||||
|
Add(
|
||||||
|
accountInfo,
|
||||||
|
posInfos //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create Button If Not Exists ...
|
||||||
if (btnSelectedPosInfo == NULL)
|
if (btnSelectedPosInfo == NULL)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1254,13 +1330,14 @@ void UpdateGUIState()
|
|||||||
//
|
//
|
||||||
int posInfoCount = ArraySize(posInfos);
|
int posInfoCount = ArraySize(posInfos);
|
||||||
int lblInfoCount = selectedPosInfoArr.Total();
|
int lblInfoCount = selectedPosInfoArr.Total();
|
||||||
has = IsValidSize(lblInfoCount);
|
has = IsValidSize(lblInfoCount) && lblInfoCount == posInfoCount;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create info Labels ...
|
// Create info Labels ...
|
||||||
if (!has)
|
if (!has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
selectedPosInfoArr.Clear();
|
||||||
has = IsValidSize(posInfoCount);
|
has = IsValidSize(posInfoCount);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
@@ -1272,10 +1349,11 @@ void UpdateGUIState()
|
|||||||
|
|
||||||
//
|
//
|
||||||
int lblHeight = 25;
|
int lblHeight = 25;
|
||||||
|
int lblWidth = 450;
|
||||||
|
|
||||||
//
|
//
|
||||||
int startX = chartWidth - 300 - 5;
|
int startX = chartWidth - lblWidth - 5;
|
||||||
int sizeX = startX + 300;
|
int sizeX = startX + lblWidth;
|
||||||
|
|
||||||
//
|
//
|
||||||
int startY = 5;
|
int startY = 5;
|
||||||
@@ -1364,6 +1442,9 @@ void UpdateGUIState()
|
|||||||
//
|
//
|
||||||
ZeroMemory(posInfos);
|
ZeroMemory(posInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
SpecifiedClean(positions);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user