//+------------------------------------------------------------------+ // MultiLookbackLines.mq5 //+---------…
- User
//+------------------------------------------------------------------+ //| MultiLookbackLines.mq5| //+------------------------------------------------------------------+ #property copyright "ChatGPT" #property version "1.50" #property strict
//--- inputs input ENUM_TIMEFRAMES InpTimeframe = PERIOD_H1; // Timeframe to look back on input int InpLookbackCandles = 10; // Base number of candles (>=1) input double InpMultiplier = 7.0; // Max multiplier (integer part used, >=1) input bool IncludeCurrentCandle = false; // Include current forming candle in calculations
input double MinimalDistancePoints = 20; // Minimal distance between lines, in points
// Optional color inputs input color ColorHighLines = clrRed; input color ColorLowLines = clrBlue;
#define PREFIX_HIGH "MultiHL_High_" #define PREFIX_LOW "MultiHL_Low_"
//--- globals datetime lastBarTime = 0; double multiplier = 1.0; // working multiplier variable
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { if(InpLookbackCandles < 1) { Print("Error: InpLookbackCandles must be >= 1"); return(INIT_FAILED); }
multiplier = InpMultiplier; if(multiplier < 1.0) { Print("Warning: InpMultiplier < 1, setting to 1"); multiplier = 1.0; }
ClearLines();
// Draw lines immediately once on init UpdateLines();
Print("MultiLookbackLines EA initialized"); return(INIT_SUCCEEDED); }
//+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { ClearLines(); }
//+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { // Get time of the latest completed bar on the input timeframe datetime currentBarTime = iTime(_Symbol, InpTimeframe, 0); if(currentBarTime == lastBarTime) return; // no new bar yet on InpTimeframe
lastBarTime = currentBarTime;
UpdateLines(); }
//+------------------------------------------------------------------+ //| Core function to draw or update all lines with filtering | //+------------------------------------------------------------------+ void UpdateLines() { int maxMult = (int)MathFloor(multiplier); if(maxMult < 1) maxMult = 1;
int startPos = IncludeCurrentCandle ? 0 : 1;
//--- Load existing High lines --- double filteredHighsPrices[]; int filteredHighsMultipliers[];
- Assistant
- User
i want this to be an indicator not expert advisor
- Assistant
- User
best settings for ger40
- Assistant
- User
on ukoil, why i have low2 69.212 and low6 69.201 , with MinimalDistancePoints = 1000?
- Assistant
- User
contract size is 100
- Assistant
- User
yes
- Assistant
- User
send me complete code
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.