The principle for this work is to create a code for MQL5 that uses the stochastic and a tendency channel.
The strategy that is required to be corrected is based on the next:
Buy condition:
1.- There need to be an uptrend. Mainly in my strategy I use the CHOCH and BOSS ( I didn't programed this on the provided code. ) to determine in which direction is the price going and I mark a tendency channel using the 2 maximum values and 2 minimum values. If it matches with more maximum and minimum levels that’s better. See the example in the images added.
2.- The Stochastic shows a cross between %K and %D, where %K crosses from bellow to above %D, making a condition similar to this:
(KValue0 > 20 && DValue0 > 20 && KValue0 > DValue0 && KValue1 <= DValue1 && KValue2 < DValue2) And (KValue0 > 20 && DValue0 > 20 && KValue0 > DValue0 && KValue1 >= DValue1 && KValue2 < DValue2) See the example in the following slides.
3.- The price should be between the lower and middle lines of the tendency channel.
Sell condition:
1.- There need to be an downtrend.
2.- The Stochastic shows a cross between %K and %D, where %K crosses from above to bellow %D, making a condition similar to this:
(KValue0 < 80 && DValue0 < 80 && KValue0 < DValue0 && KValue1 >= DValue1 && KValue2 > DValue2) And (KValue0 < 80 && DValue0 < 80 && KValue0 < DValue0 && KValue1 <= DValue1 && KValue2 > DValue2) See the example in the following slides.
3.- The price should be between the upper and middle lines of the tendency channel.
The position should be opened with the following:
Sell position:
-The STP (Stop Loss) should be 3 points bellow the lower minimum of the previous 4 candles.
-The TP (Take Profit) should be 2 times the distance of the STP – Actual Price. Example: STP=15+3 , TP= (15+3)*2=36
Sell position:
-The STP (Stop Loss) should be 3 points above the higher maximum of the previous 4 candles.
-The TP (Take Profit) should be 2 times the distance of the STP – Actual Price. Example: STP=15+3 , TP= (15+3)*2=36
I require that if the account loss 1.5% of its total, stop the tradings and notify me via email. Example: the account started the day with 10000 dlls, and 13 hours after it losses 150 dlls it stops
Note: In the documents I added a code I was working in to try and do these things, please check it and tell me if it can be reworked or what can we do.
Also I added some lines to prevent the opening of operations 2 or 3 candles after one was opened and other lines to close the positions when the conditions where met.
Please use these conditions or some similar to do the same.
The code I provided does the following:
1.- It calls the stochastic, EMA and MACD indicators (the last two are for trend identification, if you have a better way to detect trends be free to modify it or improve the conditions)
2.-Creates a tendency Channel using the all the candles in the screen but it may or may not be the better way to adapt to the strategy described above, becouse the channel does not identify the changes of tendency that fast.
3.- Open and close orders, but it a lot of times does not open a position even if the conditions are met, so the code needs help there, and sometimes it does not open the correct type of order, so I changed the order type from buy and stop to buy stop and sell stop.
4.-It prevent the opening of operations 2 or 3 candles after one was opened and other lines to close the positions when the conditions where met.
5.- I added an example for the price detection of highest high and lowest low at the end of the code, but i couldn't implement the operation to obtain the correct value for TP (2 times the STP distance)
The examples I used were the basic ones, I don’t know a lot of ways to do a trading code since I am a Mechatronic Engineer and I don’t know a lot of the things of the MQL5 language. If you know a better way to do the code feel free to tell me.
If you require more examples of the strategy that I explained on top and shown on the images or need more details please notify me.
類似した注文
Требуется напи сать пользовательский форекс-индикатор на основе стандартного индикатора ZigZag для торговой платформы МТ5 с фильтрацией колен (граней) по их минимальной длине. Пояснение: используя стандартный индикатор ZigZag для МТ5, добавить в его настройки функцию\опцию задания минимальной длины граней зигзага (чтобы индикатор игнорировал мелкие грани, а рисовал \ отмечал только те грани, длина которых составляет
Project Overview We have a highly optimized, production-ready custom cTrader cBot built for a fast-paced Renko breakout strategy (specifically trading XAUUSD/Gold). The core system architecture, structural mapping, and breakout logic are flawless. We are seeking an expert C# algorithmic developer for a targeted engagement to refine the execution mechanics and add an advanced trade management module. This is not a
I really need a developer Who can help me to create my SNIPER X AI - Elite AI Trading System Overview SNIPER X AI BOT is an AI-assisted trading system for Forex, Crypto, Stocks, Indices, and Gold. Currency: USD,RAND,KWD, POUND,EURO Core Features AI Scalping, Sniper Entries, Auto Buy/Sell, Smart Risk Management, Telegram Alerts, Mobile Monitoring, VPS Deployment. Supported Platforms MetaTrader 4, MetaTrader 5, Exness
//+------------------------------------------------------------------+ //| HighPerformanceEA.mq5 | //| Copyright 2026, AI Developer | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2026" #property link " https://www.mql5.com " #property version "1.00" #property strict //
I need an experienced MQL5 developer to build a professional XAUUSD scalping Expert Advisor. The trading logic is already fully defined and will be shared privately with selected developers. Requirements Fast execution suitable for scalping Dynamic lot sizing Strict risk management Clean and optimized MQL5 code Compatible with MetaTrader 5 Additional Rules No repainting logic No delayed execution Avoid duplicate
ZigZag based on oscillators is needed The idea of the indicator Create a ZigZag indicator, which is constructed based on extreme values determined using oscillators. It can use any classical normalized oscillator, which has overbought and oversold zones. The algorithm should first be executed with the WPR indicator, then similarly add the possibility to draw a zigzag using the following indicators: CCI Chaikin RSI
Prepare expert for xauusd live chart [ expert is not executing xauusd trades , just printing the logic on the chart ] . Deletion and cleaning code ( subject to if required ) . Integration of candles with present logic, Since expert is coming out from an arbitration subject : Before project start , review the code if it is clean and ready for the developer to continue with previous developer's technical debt -thereby
Hello, I am looking for an experienced developer who can build a professional EA suitable for long-term prop firm account passing and account management. I am NOT interested in risky strategies such as martingale, grid, or aggressive recovery systems. My main priorities are: very low and stable drawdown, strong and consistent risk management, strict news filter, long-term sustainability, realistic and stable monthly
Dear developers. We seek experienced developer in PHP, MySQL, JavaScript. we want to publish custom chart and CSV to our website Homepage. Our MQL5 Script contains custom layout we seek to publish on the website. we are looking for experienced developer in the field of website engineer. we want to broadcast our custom pairs in our website, as outlined in our MQL5 Script. we need React developers
EA specification for MT5 developer (coder‑ready spec) You can copy‑paste this directly into an MQL5 Freelance job. --- 1. General * Platform: MetaTrader 5 (MT5) * Type: Expert Advisor (EA) * Markets: Major FX pairs (configurable list via inputs) * Execution: Market orders only * Timeframes: EA must work on any timeframe, but I will mainly use it on M15–H1 --- 2. Indicators & definitions * EMA 20: Exponential Moving