Skip to content

Commit

Permalink
3.01
Browse files Browse the repository at this point in the history
Hotfix for bugs with breakeven and hotkey.
  • Loading branch information
EarnForex authored Jul 28, 2022
1 parent 53a5c34 commit 765c85e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion MQL4/Experts/Position Sizer/Position Sizer Trading.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ void DoBreakEven()
}
else if (OrderType() == OP_SELL)
{
double BE = NormalizeDouble(OrderOpenPrice() - sets.TrailingStopPoints * _Point, _Digits);
double BE = NormalizeDouble(OrderOpenPrice() - sets.BreakEvenPoints * _Point, _Digits);
if ((Ask <= BE) && ((OrderOpenPrice() < OrderStopLoss()) || (OrderStopLoss() == 0))) // Only move to breakeven if the current stop-loss is higher (or zero).
{
// Write Open price to the SL field.
Expand Down
21 changes: 15 additions & 6 deletions MQL4/Experts/Position Sizer/Position Sizer.mq4
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//+------------------------------------------------------------------+
#property copyright "EarnForex.com"
#property link "https://www.earnforex.com/metatrader-expert-advisors/Position-Sizer/"
#property version "3.00"
string Version = "3.00";
#property version "3.01"
string Version = "3.01";
#property strict

#property description "Calculates risk-based position size for your account."
Expand Down Expand Up @@ -111,14 +111,18 @@ bool Dont_Move_the_Panel_to_Default_Corner_X_Y;
uint LastRecalculationTime = 0;
bool StopLossLineIsBeingMoved = false;
bool TakeProfitLineIsBeingMoved = false;
uchar MainKey = 0;
bool CtrlRequired = false;
bool ShiftRequired = false;
uchar MainKey;
bool CtrlRequired;
bool ShiftRequired;
bool NeedToCheckToggleScaleOffOn;
int PrevChartWidth;

int OnInit()
{
CtrlRequired = false;
ShiftRequired = false;
MainKey = 0;

ExtDialog = new CPositionSizeCalculator;
PrevChartWidth = 0;

Expand Down Expand Up @@ -316,9 +320,14 @@ int OnInit()
if (keys[i] == "SHIFT") ShiftRequired = true;
else if (keys[i] == "CTRL") CtrlRequired = true;
}
StringToUpper(keys[n - 1]);
MainKey = (uchar)StringGetCharacter(keys[n - 1], 0);
}
else MainKey = (uchar)StringGetCharacter(keys[0], 0); // Just a single key.
else
{
StringToUpper(keys[0]);
MainKey = (uchar)StringGetCharacter(keys[0], 0); // Just a single key.
}
}

if (!EventSetTimer(1)) Print("Error setting timer: ", GetLastError());
Expand Down
Binary file modified MQL5/Experts/Position Sizer/Position Sizer Trading.mqh
Binary file not shown.
21 changes: 15 additions & 6 deletions MQL5/Experts/Position Sizer/Position Sizer.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//+------------------------------------------------------------------+
#property copyright "EarnForex.com"
#property link "https://www.earnforex.com/metatrader-expert-advisors/Position-Sizer/"
#property version "3.00"
string Version = "3.00";
#property version "3.01"
string Version = "3.01";

#property description "Calculates risk-based position size for your account."
#property description "Allows trade execution based the calculation results.\r\n"
Expand Down Expand Up @@ -122,12 +122,16 @@ bool Dont_Move_the_Panel_to_Default_Corner_X_Y = true;
uint LastRecalculationTime = 0;
bool StopLossLineIsBeingMoved = false;
bool TakeProfitLineIsBeingMoved = false;
uchar MainKey = 0;
bool CtrlRequired = false;
bool ShiftRequired = false;
uchar MainKey;
bool CtrlRequired;
bool ShiftRequired;

int OnInit()
{
CtrlRequired = false;
ShiftRequired = false;
MainKey = 0;

ExtDialog = new CPositionSizeCalculator;

MathSrand(GetTickCount() + 293029); // Used by CreateInstanceId() in Dialog.mqh (standard library). Keep the second number unique across other panel indicators/EAs.
Expand Down Expand Up @@ -323,9 +327,14 @@ int OnInit()
if (keys[i] == "SHIFT") ShiftRequired = true;
else if (keys[i] == "CTRL") CtrlRequired = true;
}
StringToUpper(keys[n - 1]);
MainKey = (uchar)StringGetCharacter(keys[n - 1], 0);
}
else MainKey = (uchar)StringGetCharacter(keys[0], 0); // Just a single key.
else
{
StringToUpper(keys[0]);
MainKey = (uchar)StringGetCharacter(keys[0], 0); // Just a single key.
}
}

if (!EventSetTimer(1)) Print("Error setting timer: ", GetLastError());
Expand Down

0 comments on commit 765c85e

Please sign in to comment.