Fix HIGH/LOW input variable scope - use InpManualHigh/Low for inputs and GridHigh/Low for runtime
This commit is contained in:
@@ -22,8 +22,8 @@ input int MagicNum= 333;
|
||||
//--- Smart Grid Settings
|
||||
input string GridSettings = "=== Smart Grid Settings ===";
|
||||
input bool UseAutoPivots = true;
|
||||
input double InpHigh= 0; // Manual HIGH level (0 = use AutoPivots)
|
||||
input double InpLow= 0; // Manual LOW level (0 = use AutoPivots)
|
||||
input double InpManualHigh= 0; // Manual HIGH level (0 = use AutoPivots)
|
||||
input double InpManualLow= 0; // Manual LOW level (0 = use AutoPivots)
|
||||
input double Entry= 10;
|
||||
input double TP= 15;
|
||||
input double Lots=0.01;
|
||||
@@ -75,6 +75,8 @@ double PivotR1 = 0;
|
||||
double PivotR2 = 0;
|
||||
double PivotS1 = 0;
|
||||
double PivotS2 = 0;
|
||||
double GridHigh = 0; // Actual high level used for trading (manual or auto)
|
||||
double GridLow = 0; // Actual low level used for trading (manual or auto)
|
||||
|
||||
//--- Original OrdersEA Variables
|
||||
int initialCycleEquity= 0;
|
||||
@@ -205,17 +207,17 @@ void CalculatePivotPoints()
|
||||
|
||||
if(UseATRFilter && atr > 0)
|
||||
{
|
||||
InpHigh = NormalizeDouble(PivotP + (atr * ATRMultiplier), _Digits);
|
||||
InpLow = NormalizeDouble(PivotP - (atr * ATRMultiplier), _Digits);
|
||||
GridHigh = NormalizeDouble(PivotP + (atr * ATRMultiplier), _Digits);
|
||||
GridLow = NormalizeDouble(PivotP - (atr * ATRMultiplier), _Digits);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use standard pivot levels
|
||||
InpHigh = PivotR1;
|
||||
InpLow = PivotS1;
|
||||
GridHigh = PivotR1;
|
||||
GridLow = PivotS1;
|
||||
}
|
||||
|
||||
Print("AutoPivots Set: HIGH=", InpHigh, " LOW=", InpLow, " ATR=", atr);
|
||||
Print("AutoPivots Set: HIGH=", GridHigh, " LOW=", GridLow, " ATR=", atr);
|
||||
}
|
||||
|
||||
Print("Pivot Calculated: P=", PivotP, " R1=", PivotR1, " S1=", PivotS1);
|
||||
@@ -257,8 +259,8 @@ bool IsRangingMarket()
|
||||
}
|
||||
}
|
||||
|
||||
double actualHigh = (InpHigh > 0) ? InpHigh : PivotR1;
|
||||
double actualLow = (InpLow > 0) ? InpLow : PivotS1;
|
||||
double actualHigh = (InpManualHigh > 0) ? InpManualHigh : PivotR1;
|
||||
double actualLow = (InpManualLow > 0) ? InpManualLow : PivotS1;
|
||||
|
||||
if(currentPrice > actualHigh || currentPrice < actualLow)
|
||||
{
|
||||
@@ -584,8 +586,8 @@ void CloseAllPositions(string reason)
|
||||
//+------------------------------------------------------------------+
|
||||
bool IsBreakout()
|
||||
{
|
||||
double actualHigh = (InpHigh > 0) ? InpHigh : PivotR1;
|
||||
double actualLow = (InpLow > 0) ? InpLow : PivotS1;
|
||||
GridHigh = (InpManualHigh > 0) ? InpManualHigh : PivotR1;
|
||||
GridLow = (InpManualLow > 0) ? InpManualLow : PivotS1;
|
||||
double s2 = PivotS2;
|
||||
double r2 = PivotR2;
|
||||
double currentPrice = SymbolInfoDouble(_Symbol, SYMBOL_BID);
|
||||
@@ -715,8 +717,10 @@ void OnTick()
|
||||
}
|
||||
|
||||
// Get grid boundaries
|
||||
double actualHigh = (InpHigh > 0) ? InpHigh : PivotR1;
|
||||
double actualLow = (InpLow > 0) ? InpLow : PivotS1;
|
||||
double actualHigh = (InpManualHigh > 0) ? InpManualHigh : PivotR1;
|
||||
double actualLow = (InpManualLow > 0) ? InpManualLow : PivotS1;
|
||||
GridHigh = actualHigh;
|
||||
GridLow = actualLow;
|
||||
double currentPrice = SymbolInfoDouble(_Symbol, SYMBOL_BID);
|
||||
double point = SymbolInfoDouble(_Symbol, SYMBOL_POINT);
|
||||
double entryPips = Entry * point;
|
||||
|
||||
Reference in New Issue
Block a user