last works on EA Volume Panel Implementation ...
This commit is contained in:
@@ -146,6 +146,26 @@ class XCEdit : public XCObject
|
||||
return ObjectGetString(mChartID, mName, OBJPROP_TEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Font Size of Object ...
|
||||
*
|
||||
* @param value: size
|
||||
*/
|
||||
void FontSize(int value)
|
||||
{
|
||||
ObjectSetInteger(mChartID, mName, OBJPROP_FONTSIZE, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Font Name Of Object ...
|
||||
*
|
||||
* @param value: font name
|
||||
*/
|
||||
void Font(string value)
|
||||
{
|
||||
ObjectSetString(mChartID, mName, OBJPROP_FONT, value);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+228
-37
@@ -121,25 +121,6 @@ input double eaPartialCloseInProfitVolume = 0; // Specify Partial Close in Pro
|
||||
// Protector > In Drawdown Positions Protecting ...
|
||||
input group "In Drawdown Positions Protecting";
|
||||
|
||||
//
|
||||
// Freeze ...
|
||||
// input group "Freeze";
|
||||
// input bool eaAllowFreeze = false; // Allow Freezing
|
||||
// input double eaFreezeDistance = 100; // Specify Freeze Start Drawdown in Point
|
||||
// input bool eaRemoveFreezedPositionTPSL = true; // Remove Freezed Positions TPSL
|
||||
// input bool eaDisableTrailWhenFreezedPosition = true; // Disable Trail when has Freezed Position
|
||||
|
||||
//
|
||||
// Support ...
|
||||
// input group "Support";
|
||||
// input bool eaAllowSupport = false; // Allow Support
|
||||
// input double eaSupportStartDistance = 0; // Specify Start Support Drawdown in Point
|
||||
// input int eaMaxAllowedSupport = 2; // Max Allowed Number of Support Position
|
||||
// input double eaSupportVolumeMultiplier = 1; // Specify Support Volume Multiplier
|
||||
// input bool eaMultiplySupportLevelOnVolume = false; // Multiply Support Level on Volume Multiplier
|
||||
// input bool eaDoSupportOnConditions = true; // Do Support on Conditions
|
||||
// input int eaDelayBetweenTwoSupport = 60; // Delay Between To Support in Second
|
||||
|
||||
//
|
||||
// Protect ...
|
||||
input group "Protect";
|
||||
@@ -232,6 +213,14 @@ bool eaEnableProtecting = false;
|
||||
|
||||
//
|
||||
// VOLUME GUI ...
|
||||
XCPanel eaVolumePanel;
|
||||
XCButton eaDynamicVolumeBtn;
|
||||
XCEdit eaStaticVolumeTb;
|
||||
XCLabel eaStaticVolumeLbl;
|
||||
XCButton eaSetStaticVolumeBtn;
|
||||
XCButton eaResetStaticVolumeBtn;
|
||||
bool eaAppliedStaticVolume = false;
|
||||
bool eEnableDynamicVolumeVolume = false;
|
||||
|
||||
//
|
||||
// Event Handlers ...
|
||||
@@ -358,6 +347,7 @@ void OnChartEvent(
|
||||
{
|
||||
//
|
||||
// Handle Panel Removing ...
|
||||
eaVolumePanel.OnEvent(id, lparam, dparam, sparam);
|
||||
eaProtectorPanel.OnEvent(id, lparam, dparam, sparam);
|
||||
eaSignallingPanel.OnEvent(id, lparam, dparam, sparam);
|
||||
|
||||
@@ -599,23 +589,6 @@ bool InitEA()
|
||||
//
|
||||
// In Drawdown Positions Protecting ...
|
||||
|
||||
//
|
||||
// Freeze ...
|
||||
// eaTradeHandler.AllowFreeze(eaAllowFreeze);
|
||||
// eaTradeHandler.FreezeDistance(eaFreezeDistance);
|
||||
// eaTradeHandler.RemoveFreezedPositionTPSL(eaRemoveFreezedPositionTPSL);
|
||||
// eaTradeHandler.DisableTrailWhenFreezedPosition(eaDisableTrailWhenFreezedPosition);
|
||||
|
||||
//
|
||||
// Support ...
|
||||
// eaTradeHandler.AllowSupport(eaAllowSupport);
|
||||
// eaTradeHandler.SupportStartDistance(eaSupportStartDistance);
|
||||
// eaTradeHandler.MaxAllowedSupport(eaMaxAllowedSupport);
|
||||
// eaTradeHandler.SupportVolumeMultiplier(eaSupportVolumeMultiplier);
|
||||
// eaTradeHandler.MultiplySupportLevelOnVolume(eaMultiplySupportLevelOnVolume);
|
||||
// eaTradeHandler.DoSupportOnConditions(eaDoSupportOnConditions);
|
||||
// eaTradeHandler.DelayBetweenTwoSupport(eaDelayBetweenTwoSupport);
|
||||
|
||||
//
|
||||
// Protect ...
|
||||
eaTradeHandler.AllowProtect(eaAllowProtect);
|
||||
@@ -878,6 +851,14 @@ bool InitGUI()
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Initial Volume GUI ...
|
||||
result = InitVolumeGUI();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
@@ -887,6 +868,7 @@ bool InitGUI()
|
||||
void UpdateGUI()
|
||||
{
|
||||
//
|
||||
UpdateVolumeGUI();
|
||||
UpdateProtectorGUI();
|
||||
UpdateSignallingGUI();
|
||||
}
|
||||
@@ -896,6 +878,7 @@ void UpdateGUI()
|
||||
void DestroyGUI()
|
||||
{
|
||||
//
|
||||
DestroyVolumeGUI();
|
||||
DestroyProtectorGUI();
|
||||
DestroySignallingGUI();
|
||||
}
|
||||
@@ -1071,6 +1054,33 @@ void HandleOnClickEvent(string name)
|
||||
HandleChangeProtectingState();
|
||||
eaProtectingBtn.State(false);
|
||||
}
|
||||
//
|
||||
// Dynamic Volume State ...
|
||||
else if (name == eaDynamicVolumeBtn.Name())
|
||||
{
|
||||
//
|
||||
isClicked = true;
|
||||
HandleChangeDynamicVolumeState();
|
||||
eaDynamicVolumeBtn.State(false);
|
||||
}
|
||||
//
|
||||
// Change Static Volume ...
|
||||
else if (name == eaSetStaticVolumeBtn.Name())
|
||||
{
|
||||
//
|
||||
isClicked = true;
|
||||
HandleChangeStaticVolume();
|
||||
eaSetStaticVolumeBtn.State(false);
|
||||
}
|
||||
//
|
||||
// Reset Static Volume to Default Value ...
|
||||
else if (name == eaResetStaticVolumeBtn.Name())
|
||||
{
|
||||
//
|
||||
isClicked = true;
|
||||
HandleResetStaticVolume();
|
||||
eaResetStaticVolumeBtn.State(false);
|
||||
}
|
||||
|
||||
//
|
||||
if (isClicked)
|
||||
@@ -1456,10 +1466,12 @@ void UpdateSignallingGUI()
|
||||
void DestroySignallingGUI()
|
||||
{
|
||||
//
|
||||
eaSignallingPanel.Destroy();
|
||||
eaSignallingBtn.Destroy();
|
||||
eaSignallingLongBtn.Destroy();
|
||||
eaSignallingShortBtn.Destroy();
|
||||
|
||||
//
|
||||
eaSignallingPanel.Destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1733,6 +1745,8 @@ void DestroyProtectorGUI()
|
||||
eaHedgingBtn.Destroy();
|
||||
eaTraillingBtn.Destroy();
|
||||
eaProtectingBtn.Destroy();
|
||||
|
||||
//
|
||||
eaProtectorPanel.Destroy();
|
||||
}
|
||||
|
||||
@@ -1824,4 +1838,181 @@ void UpdateProtectingOnTradeHandler()
|
||||
UpdateProtectorGUI();
|
||||
}
|
||||
|
||||
//
|
||||
// VOLUME GUI ...
|
||||
|
||||
/**
|
||||
* Initial Volume GUI ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool InitVolumeGUI()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
string eaVolumePanelName = mTag + "VOLUME";
|
||||
|
||||
//
|
||||
// Create a Panel ...
|
||||
result = eaVolumePanel.Create(
|
||||
eaVolumePanelName,
|
||||
10,
|
||||
205,
|
||||
300,
|
||||
75 //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
eaVolumePanel.Caption("Volume");
|
||||
|
||||
//
|
||||
string eaVolumePrefix = eaVolumePanelName + "_";
|
||||
|
||||
//
|
||||
// Dynamic Volume ...
|
||||
string eaDynamicVolumeBtnName = eaVolumePrefix + "DYNAMIC_VOLUME_btn";
|
||||
result = eaDynamicVolumeBtn.Create(
|
||||
eaDynamicVolumeBtnName,
|
||||
10,
|
||||
225,
|
||||
300,
|
||||
25 //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
eaDynamicVolumeBtn.Text("");
|
||||
eaVolumePanel.Add(eaDynamicVolumeBtnName);
|
||||
|
||||
//
|
||||
// Static Volume ...
|
||||
|
||||
//
|
||||
// Label ...
|
||||
string eaStaticVolumeLblName = eaVolumePrefix + "STATIC_VOLUME_lbl";
|
||||
result = eaStaticVolumeLbl.Create(
|
||||
eaStaticVolumeLblName,
|
||||
10,
|
||||
250 //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
eaStaticVolumeLbl.FontSize(10);
|
||||
eaStaticVolumeLbl.Color(clrWhite);
|
||||
eaStaticVolumeLbl.Text("Static Volume: ");
|
||||
eaVolumePanel.Add(eaStaticVolumeLblName);
|
||||
|
||||
//
|
||||
// Text Box ...
|
||||
string eaStaticVolumeTbName = eaVolumePrefix + "STATIC_VOLUME_tb";
|
||||
result = eaStaticVolumeTb.Create(
|
||||
eaStaticVolumeTbName,
|
||||
150,
|
||||
250,
|
||||
150,
|
||||
25 //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
eaStaticVolumeTb.Text("");
|
||||
eaStaticVolumeTb.FontSize(10);
|
||||
eaStaticVolumeTb.Color(clrBlack);
|
||||
eaStaticVolumeTb.BGColor(clrWhite);
|
||||
eaVolumePanel.Add(eaStaticVolumeTbName);
|
||||
|
||||
//
|
||||
// Set Static Volume ...
|
||||
string eaSetStaticVolumeBtnName = eaVolumePrefix + "STATIC_VOLUME_SET_btn";
|
||||
result = eaSetStaticVolumeBtn.Create(
|
||||
eaSetStaticVolumeBtnName,
|
||||
10,
|
||||
275,
|
||||
150,
|
||||
25 //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
eaSetStaticVolumeBtn.Text("Change Volume");
|
||||
eaVolumePanel.Add(eaSetStaticVolumeBtnName);
|
||||
|
||||
//
|
||||
// Reset Static Volume ...
|
||||
string eaResetStaticVolumeBtnName = eaVolumePrefix + "STATIC_VOLUME_RESET_btn";
|
||||
result = eaResetStaticVolumeBtn.Create(
|
||||
eaResetStaticVolumeBtnName,
|
||||
160,
|
||||
275,
|
||||
150,
|
||||
25 //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
eaResetStaticVolumeBtn.Text("Default");
|
||||
eaVolumePanel.Add(eaResetStaticVolumeBtnName);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Volume GUI ...
|
||||
*/
|
||||
void UpdateVolumeGUI()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Volume GUI ...
|
||||
*/
|
||||
void DestroyVolumeGUI()
|
||||
{
|
||||
//
|
||||
eaStaticVolumeTb.Destroy();
|
||||
eaStaticVolumeLbl.Destroy();
|
||||
eaDynamicVolumeBtn.Destroy();
|
||||
eaSetStaticVolumeBtn.Destroy();
|
||||
eaResetStaticVolumeBtn.Destroy();
|
||||
|
||||
//
|
||||
eaVolumePanel.Destroy();
|
||||
}
|
||||
|
||||
void HandleChangeDynamicVolumeState()
|
||||
{
|
||||
|
||||
//
|
||||
UpdateVolumeOnTradeHandler();
|
||||
}
|
||||
|
||||
void HandleChangeStaticVolume()
|
||||
{
|
||||
|
||||
//
|
||||
UpdateVolumeOnTradeHandler();
|
||||
}
|
||||
|
||||
void HandleResetStaticVolume()
|
||||
{
|
||||
|
||||
//
|
||||
UpdateVolumeOnTradeHandler();
|
||||
}
|
||||
|
||||
void UpdateVolumeOnTradeHandler()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user