У нас вы можете посмотреть бесплатно RSI Trailing Stop Expert Advisor and Source Code (download for your own AI codebase) или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Get MUCH more on AI Trading Tutorial: https://aitradingtutorial.com Download Source Code: https://mqlstreaming.s3.eu-west-1.ama... Download this Video: https://mqlstreaming.s3.eu-west-1.ama... In this video we are going to create an Expert Advisor that uses the RSI indicator to identify overbought and oversold market conditions and automatically opens positions while implementing a trailing stop mechanism. Let's see how we can do that. We start Metaeditor by clicking the little icon or pressing F4. This opens the Metaeditor where we can create our new Expert Advisor. The first thing we do is include the CTrade class from the standard library. This provides us with simplified trading methods like PositionOpen and PositionModify. We include it by writing include Trade Trade.mqh which gives us access to all the trading functionality we need. Next we instantiate a CTrade object called Trade. This object will manage all our trading operations including position management throughout the Expert Advisor's lifecycle. Now we define our strategy configuration parameters. These are all values that can be adjusted in the EA properties when we attach it to a chart. We create an input integer called LookbackBars with a default value of 50. This determines the historical range for identifying highs and lows, allowing us to look back between 1 and 1000 candles for our analysis. We add another input integer called MinCandlesBack with a default of 5. This sets the minimum age for valid highs and lows, ensuring we only consider levels that are at least 5 to 50 candles old. This prevents us from using very recent price extremes that might not be significant. An input double called TrailingOffset with a default of 10.0 points provides a safety distance for our trailing stop. This offset ranges from 1 to 20 points and determines how far we place our stop loss from the identified support or resistance levels. We include an input integer RSIPeriod with a default of 14. This is the RSI calculation period which typically ranges from 8 to 21 periods. The RSI indicator will use this period to calculate its values. Two more input integers define our RSI thresholds. OversoldLevel at 30 represents the RSI oversold threshold that generates buy signals, typically ranging from 20 to 40. OverboughtLevel at 70 represents the RSI overbought threshold for sell signals, usually between 60 and 80. Finally we define an enumeration called RSIPrice of type ENUM_APPLIED_PRICE with PRICE_CLOSE as the default. This determines which price type the RSI calculation will use, in this case the closing prices. Moving to global variables and handles, we declare an integer called rsiHandle to store the RSI indicator handle. This handle will be created during initialization and used throughout the Expert Advisor's operation. We create a double array called rsiBuffer with empty brackets to serve as a circular buffer for RSI values. This array will hold the calculated RSI values for our analysis. A MqlRates array called priceData with empty brackets is declared to store OHLC price data. This array will contain the historical price information we need for our strategy. In the Expert initialization function OnInit, which executes once when the EA starts, we create the RSI indicator handle. We use iRSI with the current symbol _Symbol, the H1 timeframe PERIOD_H1, our RSIPeriod parameter, and our RSIPrice parameter. This creates the RSI indicator for our specified parameters. We configure our arrays as time series using ArraySetAsSeries. This aligns the indices with natural time flow where index 0 represents the current data and index 1 represents the previous data. We apply this to both our rsiBuffer array and our priceData array. The function returns INIT_SUCCEEDED to indicate successful initialization. Now we create functions for opening positions. The OpenBuyPosition function executes market orders for buy positions with a specified lot size. Inside this function, we get the current Ask price using SymbolInfoDouble with _Symbol and SYMBOL_ASK. This gives us the precise price for order execution. We then execute the buy order using Trade.PositionOpen. The parameters include _Symbol for the financial instrument, ORDER_TYPE_BUY for the direction indicating a long position, 0.10 for the position size in standard lots which equals 10 micro lots, askPrice for the entry price at the current Ask, 0 for the initial stop-loss which is disabled, 0 for the take-profit which is also disabled, and RSI Position as the position comment.