Need program to close open position is the conditions are not valid on next candle

MQL5 Indicators Experts

Job finished

Execution time 1 hour
Feedback from customer
Gave the solution that I asked for and also helped with a few questions
Feedback from employee
5 star customer!

Specification

Hi,


Very simple code, lines in yellow need to execute on the next candle if the buy or sell signal is no longer valid, SL is just as backup if the market reverses to quickly. I am no programmer so excuse if this is not written eloquently. I have posted only the relevant bit.


      if(PriceInfo[1].close > EMA5[0] && EMA10[0] > EMA20[0] && EMA20[0] > EMA40[0] && RSI14[0] > RSI40[0] && RSI14[0] > 50 && RSI40[0] > 50) {

         if(PositionsTotal()==0) {
            trade.Buy(0.10,_Symbol,Ask,Ask-200*_Point,0,"BUY");
              if(PositionsTotal()>0 || PriceInfo[1].close < EMA5[0] || RSI14[0] < RSI40[0] ){
              trade.Sell(0.10,_Symbol,Bid,0,0,"BUY Close");    
              
              }  
         }
         //else if because we will always do either buy or sell, not both
      } else if(PriceInfo[1].close < EMA5[0] && EMA10[0] < EMA20[0] && EMA20[0] < EMA40[0] && RSI14[0] < RSI40[0] && RSI14[0] < 50 && RSI40[0] < 50) {
         if(PositionsTotal()==0) {
            trade.Sell(0.10,_Symbol,Bid,Bid+200*_Point,0,"SELL");
              if(PositionsTotal()>0 || PriceInfo[1].close > EMA5[0] || RSI14[0] > RSI40[0] ) {
              trade.Buy(0.10,_Symbol,Ask,0,0,"Sell Close");
            }
          }
       }
      Print("_________________Tick End__________________________");
   }

Responded

1
Developer 1
Rating
(281)
Projects
352
29%
Arbitration
37
27% / 65%
Overdue
10
3%
Loaded
2
Developer 2
Rating
(19)
Projects
26
27%
Arbitration
3
0% / 100%
Overdue
2
8%
Free
3
Developer 3
Rating
(101)
Projects
123
31%
Arbitration
7
29% / 29%
Overdue
5
4%
Working
4
Developer 4
Rating
(258)
Projects
269
29%
Arbitration
2
50% / 0%
Overdue
3
1%
Working
Published: 2 codes
5
Developer 5
Rating
(32)
Projects
57
23%
Arbitration
12
67% / 8%
Overdue
2
4%
Free
Similar orders
I need an AI based mt5 EA which self learns and improves on its previous mistakes. The EA must be able to utilize numerous trade set ups like; 1. CRT, 2. liquidity sweep reversal at selected higher timeframe where a candle sweeps previous candle high and closes lower or sweeps previous candle low and closes higher, 3. SMC where it trades on OB, CHoCH, BOS. 4. Support and resistance. It should trade any currency pair
i need some tradingview strategy that i want to use as a tester, i have something that i am working on currently and i need someone that can provide me with tradingview strategies that doesn't have a win rate, the one with 1:1 RR it need to have low win rate like 10% or 5% profitability, i am not paying $30 for,i dont have up to that for this cause i only want to use it as a test, if anyone have any to send me please
hello i need help building a ea bot for mt5 and i have started on claude but i will need someone if a incredible experience to make my ideas come to live. please contact so we can schedule a quick call and i can share anything that concerns you for the task
I am looking for someone with real experience developing strategies, indicators, or trading tools for Quantower . The strategy itself is relatively simple. The main issue is that I need to use some of Quantower's functions and API capabilities to program the strategy, but there is limited documentation available for some of the functionality, and I do not have enough time to fully understand the API and implement
I am looking for an experienced MQL5 developer who can BOTH research trading strategies and develop a commercial-quality MetaTrader 5 Expert Advisor. This is NOT simply a coding job. The developer is free to choose the trading logic, indicators, entry method, exit method, timeframe architecture and strategy type. I do not require the EA to copy or resemble any existing commercial EA. My priority is: ROBUST LONG-TERM
A developer will create an AI assisted EA forex watch-list scanner (not an auto-trader) designed to surface PDL/PDH bounces on M15, with coding in Python/MQL5. This will strictly be a market intelligence and scanning tool (no automatic order placement) and EA primary function will be a delivery of visual dashboard UI, 2-phased alerts (warning vs. execution), and multi-channel notification. 1. Project Overview &
Hello, please make me a simple MT5 Expert Advisor for XAUUSD on M15 timeframe. TRADING LOGIC: - BUY when EMA(10) crosses UP EMA(30) - SELL when EMA(10) crosses DOWN EMA(30) TRADING HOURS: - Only trade between 19:00 - 22:00 WIB / Jakarta time RISK SETTINGS: - Lot size: 0.01 - Stop Loss: 70 points - Take Profit: 150 - 300 points - Max 1 open position Please deliver .ex5 file ready to use. Thank you
Gods Plan v8 30 - 500 USD
//+------------------------------------------------------------------+ //| GODS PLAN V8.mq5 | //| Tebogo | //| tebogophago298@gmail.com | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Expert initialization function |
I’m looking to purchase an existing, proven Trend-Following EA for MT5 . I am NOT looking to develop a new EA from scratch , so please read the requirements carefully before applying. The EA should follow a market-structure/trend-following approach similar to this: Identify a clear Break of Structure (BOS) to confirm the trend direction. Wait for a pullback/retracement instead of chasing the initial breakout. Enter
I am looking for an experienced MQL5 developer to create a fully automatic MT5 Expert Advisor (EA) for frequent small-profit trades. My current manual strategy is simple: I watch short-term price movement, enter when price starts moving strongly up or down, and close once a small profit is achieved. I want an EA that can identify these movements and automatically repeat this process throughout the day. Main

Project information

Budget
30+ USD