Complete Position Drawer and Well Test it ...
This commit is contained in:
@@ -126,8 +126,8 @@ class XCPositionDrawer : public XCBase
|
||||
//
|
||||
// Price Style ...
|
||||
priceStyle = STYLE_SOLID;
|
||||
inProfitColor = ApplyAlpha(clrAqua, 100);
|
||||
inDrawdownColor = ApplyAlpha(clrMagenta, 100);
|
||||
inProfitColor = clrAqua; // ApplyAlpha(clrAqua, 100);
|
||||
inDrawdownColor = clrMagenta; // ApplyAlpha(clrMagenta, 100);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,6 +320,7 @@ class XCPositionDrawer : public XCBase
|
||||
*/
|
||||
void HandleStopLossTriggered(const XDeal &deal)
|
||||
{
|
||||
//
|
||||
Finalize(deal.positionId);
|
||||
}
|
||||
|
||||
@@ -349,6 +350,53 @@ class XCPositionDrawer : public XCBase
|
||||
Finalize(ticket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Position Modified Event ...
|
||||
*
|
||||
* @param ticket: ulong, triggered Positions ticket ...
|
||||
* @param profit: double, Position Profit ...
|
||||
* @param comment: string, Comment ...
|
||||
*/
|
||||
void HandleOnPositionModified(
|
||||
const ulong ticket,
|
||||
const double profit,
|
||||
const string comment //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Detect Position Index ...
|
||||
int index = FindIndex(ticket);
|
||||
bool has = IsValidIndex(index);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Position of Objects ...
|
||||
XPosition _position;
|
||||
has = ((XCPositionObject *)positionObjects.At(index)).GetPosition(_position);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Get Position of Trader Instance ...
|
||||
has = trader.GetPosition(
|
||||
ticket,
|
||||
_position //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Update Position ...
|
||||
((XCPositionObject *)positionObjects.At(index)).Update(_position);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
_position.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
@@ -371,9 +419,9 @@ class XCPositionDrawer : public XCBase
|
||||
}
|
||||
|
||||
//
|
||||
XCPositionObject *iObj = positionObjects.At(index);
|
||||
positionObjects.Delete(index);
|
||||
finalizedObjects.Add(iObj);
|
||||
// XCPositionObject *iObj = positionObjects.At(index);
|
||||
// positionObjects.Delete(index);
|
||||
// finalizedObjects.Add(iObj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user