add support for dynamic volume calculation in ea ...

This commit is contained in:
2024-08-10 16:25:34 +03:30
parent 0aafd0b14e
commit b76565f0b9
2 changed files with 115 additions and 6 deletions
+36 -5
View File
@@ -49,9 +49,12 @@ input bool eaUseMaxAllowedTradesPerSymbol = true; /
input string eaSymbols = "EURUSDb,GBPUSDb,USDJPYb,USDCHFb,XAUUSDb,DowJones30"; // Trading Symbols
//
// Trades ...
input group "Trades";
input double eaVolume = 0.3; // Static Volume
// Risk Management ...
input group "Risk Management";
//
// Risk Management > Risk / Reward Calculation ...
input group "Risk/Reward";
input double eaR2R = 1.5; // Risk to Reward Ratio for Dynamic TP SL
input bool eaUseFixedTPSLPoints = true; // Use Fixed TP SL in Points
input bool eaIgnoreTP = false; // Ignore TP
@@ -60,8 +63,12 @@ input double eaTPPoint = 200; // Static TP Point
input double eaSLPoint = 500; // Static SL Point
//
// Risk Management ...
input group "Risk Management";
// Risk Management > Volume Calculation ...
input group "Volume";
input bool eaUseDynamicVolume = false; // Use Dynamic Volume
input double eaDynamicVolumeStep = 0.01; // Increase Volume Step
input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume
input double eaVolume = 0.3; // Static Volume
//
// Risk Management > Trade Management ...
@@ -646,6 +653,30 @@ void OnSignalRecieved(
return;
}
//
// Prepare Signal Dynamic Volume
// if Provided ...
if (eaUseDynamicVolume &&
eaDynamicVolumeStep > 0 &&
eaDynamicVolumeBalanceFactor > 0)
{
//
double dVolume = eaTrader.GetDynamicVolume(
signal.symbol,
eaDynamicVolumeBalanceFactor,
eaDynamicVolumeStep //
);
//
if (dVolume > 0)
{
signal.volume = dVolume;
}
//
eaTradeHandler.UpdateSignal(signal);
}
//
// Since Signal Filtering done based on
// Strategy and it's not related to Public