//+------------------------------------------------------------------+ //| MyEA.mq5 | //| Copyright 2025, Daruma00 | //| https://forge.mql5.io/Daruma00/my-ea-template | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, Daruma00" #property link "https://forge.mql5.io/Daruma00/my-ea-template" #property version "1.00" #property strict // === 1. Input Parameters === // These can be changed by the user from the EA settings in MetaTrader input double LotSize = 0.1; // Trading lot size input int StopLoss = 100; // Stop loss in points input int TakeProfit = 200; // Take profit in points // === 2. Include Required Library === // Provides trading functions (buy, sell, etc.) #include // === 3. Global Variables === CTrade trade; // Trading object for executing orders // === 4. Main Event Functions === // Called once when the EA is attached to a chart int OnInit() { Print("EA started"); return(INIT_SUCCEEDED); } // Called once when the EA is removed from the chart void OnDeinit(const int reason) { Print("EA stopped"); } // Called on every new market tick void OnTick() { // Simple trading logic: open buy if no position exists if(PositionsTotal() == 0) { // Open a buy position with the specified lot size, stop loss, and take profit trade.Buy(LotSize, _Symbol, Bid, (Bid-StopLoss*_Point), (Bid+TakeProfit*_Point)); } }