A supertrend ea with: - martingale that resets back to initial lot size only after a specified number of wins in a row. - Immediately when I place it on the chart, I want it to check the past signals and determine the current number of losses in a row according to the set TradeDirection, TakeProfit and StopLoss. (Look at the historical data to check the past signals and determine the current number of losses in a row and then update those losses as the chart updates with new data) - I want it to display the number of current losses in a row on the right side of the chart and reset the counter if a win occurs. - If the current losses in a row have reached the set LossAlertThreshold, I want it to show an alert on the chart. - Close trade on opposite signal. - Option to show an alert when a new signal occurs, which can be turned on or off. Example of settings: // Input parameters input double Period = 10; // ATR period for Supertrend input double Multiplier = 3.0; // Multiplier for Supertrend input double TradeDirection = direction // Trade direction (regular, inverse, buy only, sell only) input double LotSize = 0.1; // Initial lot size input double MartingaleMultiplier = 2.0; // Martingale multiplier input int MartingaleReset = 3; // Reset Martingale after specified consecutive wins in a row input double TakeProfit = 100; // Take profit in points input double StopLoss = 50; // Stop loss in points input int LossAlertThreshold = 3; // Alert after specified consecutive losses in a row is reached input double AlertOnNewSignal = True; // Alert On New Signal input int MagicNumber = 123456; // Magic number for trades *** Include a custom comment, and settings for the font size of the displayed consectutive losses as well. ............................................................................................ ............................................................................................ ............................................................................................ Supertrend EA Requirements || To clarify more Main Features: Martingale System: The EA should increase the lot size after a loss. The Martingale should reset back to the initial lot size only after a specified number of consecutive wins. Historical Analysis on Initialization: When the EA is placed on the chart, it should immediately check past signals based on TradeDirection, TakeProfit, and StopLoss. It should calculate and display the current number of consecutive losses in a row. This counter should update in real-time as new data arrives. Loss Counter Display: Show the current number of consecutive losses on the right side of the chart. Reset the counter when a win occurs. Loss Alert: If consecutive losses reach the LossAlertThreshold, display an alert on the chart. Trade Management: Close open trades when an opposite Supertrend signal appears. Signal Alerts: Option to display an alert when a new signal occurs. This alert should be toggleable (can be turned on/off in settings). Customization Options: Custom trade comment. Adjustable font size for the displayed consecutive losses. // Supertrend Settings input double Period = 10; // ATR period for Supertrend input double Multiplier = 3.0; // Multiplier for Supertrend // Trade Settings input int TradeDirection = 0; // Trade direction (0 = regular, 1 = inverse, 2 = buy only, 3 = sell only) input double LotSize = 0.1; // Initial lot size input double TakeProfit = 100; // Take profit in points input double StopLoss = 50; // Stop loss in points // Martingale Settings input double MartingaleMultiplier = 2.0; // Martingale multiplier input int MartingaleReset = 3; // Reset Martingale after specified consecutive wins // Alerts & Display input int LossAlertThreshold = 3; // Alert after specified consecutive losses input bool AlertOnNewSignal = true; // Toggle alert on new signal input int FontSize = 12; // Font size for loss counter display input bool EnableEmailNotifications = false; // Send email alerts input bool EnablePushNotifications = false; // Send mobile push notifications // Other Settings input string CustomComment = "Supertrend EA"; // Custom trade comment input int MagicNumber = 123456; // Magic number for trade identification