Job finished
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Specification
Fully write, initialize, and define all variables for a working error free functional MQL4 EA Named: "Skynet AI Hedge Fund EA" with the following external option parameters: Risk Type - (Fixed Lot or Percent Risk of Balance), Fixed Lot Size - (Initial value set to 0.01), Min Lot Size - (Initial value set to 0.01), Max Lot Size - (Initial value set to 100.00), Risk Percent - (Risk values based on an integer of a 1 - 100 range for percent of risk balance value calculations. Set initial risk value to 2) , Visible Take Profit - (Take Profit in pips as an integer value. Set initial value to 500), Visible Stop Loss - (Stop Loss in pips as an integer value. Set initial value to 500), Hidden Take Profit - (Create a hidden virtual take profit in pips with the initial value set to 20), Hidden Stop Loss - (Create a hidden virtual stop loss in pips with the initial value set to 50), Reverse Trades - (Create an option to reverse the direction of trades based of off the trading strategy and logic defined below with a boolean value of True or False) (Internally, fully code and define all functions, operators, and methods necessary to make the above external options work correctly within the mql4 code without any errors or debugging necessary for the latest MetaTrader 4 build. For the strategy logic and trade entry code hard code the following: (auto calculate the current time frame of the chart the EA will be placed on for a multi time frame compatible EA) (Create and initialize 3 Exponential Moving Averages. 1st EMA set to 6, 2nd EMA set to 14, 3rd EMA set to 26) (Create and initialize 1 Simple Moving Average. Set the SMA to 100) Define and Follow these trading rules when coding the EA: (Order executions will commence as follows - open one new trade at a time on each candle stick in the direction of the current trend based of off the EMA's and SMA) (Long Trades are defined to be executed when the 6 EMA is Above and the 14 EMA and the 14 EMA is above the 26 EMA and the 26 EMA is above the 100 SMA) (Short Trades are defined to be executed when the 100 SMA is above the 26 EMA and the 26 EMA is above the 14 EMA and the 14 EMA is above the 6 EMA) (For every trade order that is executed place a pending order in the opposite direction of the current trade 10 pips above each order for 3x the value of the current executed trade order. If the pending order becomes a market order Apply all order management to include: (visible take profit, visible stop loss, hidden take profit, and hidden stop loss) to the opposite executed trade. At the same time close the initial original executed trade only if the pending order becomes a market order. After the order closes continue trading the strategy.
Here is a Template I got from ChatGPT of what I am trying to accomplish:
// External parameters input int RiskType = 0; // 0 for Fixed Lot, 1 for Percent Risk input double FixedLotSize = 0.01; input double MinLotSize = 0.01; input double MaxLotSize = 100.00; input int RiskPercent = 2; input int VisibleTakeProfit = 500; input int VisibleStopLoss = 500; input int HiddenTakeProfit = 20; input int HiddenStopLoss = 50; input bool ReverseTrades = false; // Indicator parameters input int EMA1_Period = 6; input int EMA2_Period = 14; input int EMA3_Period = 26; input int SMA_Period = 100; // Define variables double LotSize; int Slippage = 3; int MagicNumber = 12345; // Unique identifier for this EA int LongTrade = 1; int ShortTrade = -1; int PendingOrderDistance = 10; // Define your trading strategy in the OnTick() function void OnTick() { // Calculate the current trend based on EMA and SMA values // Check if we should enter a Long Trade if (IsLongTradeConditionMet()) { // Calculate lot size based on Risk Type if (RiskType == 0) { LotSize = FixedLotSize; } else if (RiskType == 1) { LotSize = CalculateLotSizeBasedOnRisk(); } // Place a market order in the direction of the trend if (OrderSend(Symbol(), OP_BUY, LotSize, Ask, Slippage, 0, 0, "", MagicNumber, clrNONE) > 0) { // Order placed successfully // Place a pending order in the opposite direction if (ReverseTrades) { double OppositeLotSize = LotSize * 3; double OppositePrice = OrderSend(Symbol(), OP_SELL, OppositeLotSize, Bid + PendingOrderDistance * Point, Slippage, 0, 0, "", MagicNumber, clrNONE); if (OppositePrice > 0) { // Set Take Profit and Stop Loss for the opposite trade // ... // Close the initial trade if the pending order becomes a market order OrderClose(OrderSend(Symbol(), OP_BUY, LotSize, Bid, Slippage, 0, 0, clrNONE); } } } } // Check if we should enter a Short Trade if (IsShortTradeConditionMet()) { // Similar logic as for Long Trades // ... } } bool IsLongTradeConditionMet() { // Implement your Long trade logic based on EMA and SMA values // Return true if conditions are met, otherwise return false } bool IsShortTradeConditionMet() { // Implement your Short trade logic based on EMA and SMA values // Return true if conditions are met, otherwise return false } double CalculateLotSizeBasedOnRisk() { // Calculate lot size based on Risk Percent and account balance // Return the calculated lot size } // Other functions for setting Take Profit, Stop Loss, etc. // ...