Add stoploss to ea0130

Termos de Referência

//+------------------------------------------------------------------+
//|                                                     MyEA.mq5     |
//|                        Copyright 2024, Your Company Name        |
//|                                       http://www.yourwebsite.com|
//+------------------------------------------------------------------+
#property copyright "2024, Your Company Name"
#property link      "http://www.yourwebsite.com"
#property version   "1.00"
#property strict

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   // Place your initialization code here
   return INIT_SUCCEEDED;
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   // Place your deinitialization code here
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   // Place your trading logic here
   double stopLossDistance = 30.0; // Stop loss distance in pips
   double stopLossPrice = 0.0;     // Stop loss price
   double entryPrice = Ask();      // Get current ask price (assuming long trade)

   // Calculate stop loss price
   if (stopLossDistance > 0)
     {
      stopLossPrice = entryPrice - stopLossDistance * Point;
     }

   // Place stop loss order
   if (stopLossPrice > 0)
     {
      int ticket = OrderSend(Symbol(), OP_BUY, 0.1, entryPrice, 2, stopLossPrice, 0, "Stop Loss", 0, 0, clrNONE);
      
      if (ticket > 0)
        {
         Print("Stop loss order placed successfully at price ", stopLossPrice);
        }
      else
        {
         Print("Error placing stop loss order: ", GetLastError());
        }
     }
  }
//+------------------------------------------------------------------+

Respondido

1
Desenvolvedor 1
Classificação
(22)
Projetos
21
10%
Arbitragem
4
25% / 75%
Expirado
0
Livre
2
Desenvolvedor 2
Classificação
(623)
Projetos
980
47%
Arbitragem
32
38% / 34%
Expirado
96
10%
Trabalhando
Publicou: 6 códigos
3
Desenvolvedor 3
Classificação
(1)
Projetos
1
0%
Arbitragem
1
0% / 100%
Expirado
1
100%
Livre
4
Desenvolvedor 4
Classificação
(37)
Projetos
59
27%
Arbitragem
26
19% / 54%
Expirado
10
17%
Trabalhando
Publicou: 1 código
5
Desenvolvedor 5
Classificação
(72)
Projetos
80
10%
Arbitragem
38
8% / 58%
Expirado
6
8%
Livre
6
Desenvolvedor 6
Classificação
(278)
Projetos
340
37%
Arbitragem
6
50% / 17%
Expirado
7
2%
Livre
Publicou: 5 códigos
7
Desenvolvedor 7
Classificação
(47)
Projetos
67
37%
Arbitragem
5
40% / 40%
Expirado
1
1%
Livre
8
Desenvolvedor 8
Classificação
(152)
Projetos
190
57%
Arbitragem
10
80% / 0%
Expirado
0
Livre
Publicou: 1 código
9
Desenvolvedor 9
Classificação
(4)
Projetos
4
100%
Arbitragem
0
Expirado
0
Livre
10
Desenvolvedor 10
Classificação
(17)
Projetos
22
36%
Arbitragem
5
0% / 100%
Expirado
4
18%
Livre
11
Desenvolvedor 11
Classificação
(43)
Projetos
66
12%
Arbitragem
12
58% / 42%
Expirado
1
2%
Livre
12
Desenvolvedor 12
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
13
Desenvolvedor 13
Classificação
(15)
Projetos
19
16%
Arbitragem
5
40% / 40%
Expirado
0
Livre
14
Desenvolvedor 14
Classificação
Projetos
1
0%
Arbitragem
0
Expirado
0
Livre
15
Desenvolvedor 15
Classificação
(574)
Projetos
945
47%
Arbitragem
309
58% / 27%
Expirado
125
13%
Livre
16
Desenvolvedor 16
Classificação
(69)
Projetos
146
34%
Arbitragem
13
8% / 62%
Expirado
26
18%
Livre
Publicou: 6 códigos
17
Desenvolvedor 17
Classificação
(170)
Projetos
228
60%
Arbitragem
3
33% / 33%
Expirado
6
3%
Livre
Publicou: 1 código
Pedidos semelhantes
1. Goal I want a MetaTrader 5 Expert Advisor that trades a simple Supertrend trend‑following idea, but with professional‑grade risk management and filters. It should be robust enough for real money on instruments like XAUUSD and GBP pairs, using small, consistent risk per trade rather than martingale or grid. 2. Strategy Logic Indicators (I will supply the .mq5 files if needed): Supertrend (ATR‑based), with
Hi developers, I need someone to help me create a simple EA with my indicators and trading plan... I will give you all parameters and you help me create... 2 moving averages, one candle pattern
Please a need a very good expert for this jou I want to create 2 robot one a trade manager Perfect — here’s a clean, professional order description you can post directly to an EA freelancer (MQL5). I’ve written it so it’s clear, serious, and attractive to skilled developers 👌 MQL5 Trade Manager EA – Development Request I am looking for an experienced MQL5 developer to build a robust Trade Manager Expert Advisor for
Henryy999 30 - 3000 USD
The Ai robot must help me with forex and I don't have money soon can the Ai robot give me some money and I will pay it back if the Ai robot does a good job making me rich
Project Title: MT5 Algo Trading EA (Single Strategy + License Panel + Ownership + Manual Trade) --- Project Description I am looking for an experienced MT5 (MQL5) developer to create a clean, stable and professional Algo Trading EA for my company and future clients. This is a long-term business project, not a one-time personal EA. --- 1. Strategy Requirements - Only 1 single trading strategy - No martingale - No grid
I am looking for an experienced StrategyQuant X (SQX) developer to build a reusable trading template , not a single strategy. ⚠️ Please do NOT apply unless you actively use StrategyQuant X and have access to it. This project cannot be completed without SQX. 1. Session and Time Filters Trading restricted to fixed GMT sessions per index Sessions must convert correctly to broker server time and remain correct through
Is there someone who coded the PipJuice indicator? Here is the link: https://www.pipjuice.io/ Unfortunately, I don‘t have access to the indicator or the code. If someone have it please send me some screenshots
Strategy Development: Suggest a high-probability trading strategy based on Technical Analysis (using indicators like RSI, MACD, or Price Action). Risk Management: Explain how to calculate position sizing so I don't lose more than 1-2% of my capital per trade. Market Analysis: Teach me how to identify Support and Resistance levels and how to spot a trend reversal. Psychology: Give me 5 golden rules to maintain
A Grid EA with a hedge that open trades on a percentage based on whats is opened on the other side, closes losing trades with current profits made and utilizes a grid trading strategy combined with hedging technique to mitigate risk and potentially lock in profits. It involves placing buy and sell orders at predetermined price intervals, forming a grid. When a trade within the grid moves against the initial
MQL5 Expert Advisor Development (MT5) I need a professional MQL5 developer to create a custom Expert Advisor (EA) for MetaTrader 5 with high accuracy, low drawdown, and fast execution . 🔹 Strategy Requirements: Timeframe: Scalping-friendly (M1 / M5) Indicators Used: EMA 9 EMA 12 EMA 21 VWAP (as a trend filter) RSI (for trade confirmation) 🔹 Trade Logic: Buy and Sell entries based on EMA crossover + VWAP direction

Informações sobre o projeto

Orçamento
30+ USD