mirror of
https://github.com/rithsila/MT5-EA-Sniper-Strategy.git
synced 2026-08-18 05:08:13 +00:00
Update StartRiskCalculator TP and Gold lot calculation
This commit is contained in:
+6
-6
@@ -105,7 +105,7 @@ void OnChartEvent(const int id, // Event identifier
|
||||
if(id==CHARTEVENT_OBJECT_DRAG)
|
||||
{
|
||||
price = ObjectGetDouble(0, sparam, OBJPROP_PRICE, 0);
|
||||
Print("The anchor point coordinates of the object with name ",sparam," has been changed. Price ", price);
|
||||
///Print("The anchor point coordinates of the object with name ",sparam," has been changed. Price ", price);
|
||||
}
|
||||
|
||||
if(id==CHARTEVENT_KEYDOWN)
|
||||
@@ -122,7 +122,7 @@ void OnChartEvent(const int id, // Event identifier
|
||||
Alert("Sell " + LotSize + " lot " + Symb + " at " + Bid + " SL at " + price);
|
||||
break;
|
||||
default:
|
||||
Print("Do nothing");
|
||||
//Print("Do nothing");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ void LotSizeCalculate(double stopLoss)
|
||||
{
|
||||
SL = (stopLoss-PriceBid)/_Point;
|
||||
}
|
||||
Print("Stop loss distance ", SL);
|
||||
//Print("Stop loss distance ", SL);
|
||||
|
||||
//If the position size is dynamic
|
||||
if(InpRiskDefaultSize==RISK_DEFAULT_AUTO)
|
||||
@@ -180,7 +180,7 @@ void LotSizeCalculate(double stopLoss)
|
||||
RiskBaseAmount=InpBalance;
|
||||
|
||||
//Calculate the Position Size
|
||||
Print("RiskBaseAmount ", RiskBaseAmount, " MaxRiskPerTrade ", InpMaxRiskPerTrade, "Stop loss ", SL, " TickValue ", TickValue);
|
||||
//Print("RiskBaseAmount ", RiskBaseAmount, " MaxRiskPerTrade ", InpMaxRiskPerTrade, "Stop loss ", SL, " TickValue ", TickValue);
|
||||
|
||||
LotSize=((RiskBaseAmount*InpMaxRiskPerTrade/100)/(SL*TickValue));
|
||||
StoplossPips = SL;
|
||||
@@ -200,12 +200,12 @@ void LotSizeCalculate(double stopLoss)
|
||||
//Limit the lot size in case it is greater than the maximum allowed by the broker
|
||||
if(LotSize>SymbolInfoDouble(Symb,SYMBOL_VOLUME_MAX))
|
||||
LotSize=SymbolInfoDouble(Symb,SYMBOL_VOLUME_MAX);
|
||||
Print("Lot ", LotSize, " Max lot ", SymbolInfoDouble(Symb,SYMBOL_VOLUME_MAX));
|
||||
//Print("Lot ", LotSize, " Max lot ", SymbolInfoDouble(Symb,SYMBOL_VOLUME_MAX));
|
||||
//If the lot size is too small then set it to 0 and don't trade
|
||||
if(LotSize < SymbolInfoDouble(Symb,SYMBOL_VOLUME_MIN))
|
||||
{
|
||||
LotSize=0;
|
||||
Print("Lot size too small");
|
||||
Alert("Lot size too small");
|
||||
}
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
|
||||
Reference in New Issue
Block a user