Add stoploss to ea0130

Specifiche

//+------------------------------------------------------------------+
//|                                                     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());
        }
     }
  }
//+------------------------------------------------------------------+

Con risposta

1
Sviluppatore 1
Valutazioni
(22)
Progetti
21
10%
Arbitraggio
4
25% / 75%
In ritardo
0
Gratuito
2
Sviluppatore 2
Valutazioni
(623)
Progetti
980
47%
Arbitraggio
32
38% / 34%
In ritardo
96
10%
In elaborazione
Pubblicati: 6 codici
3
Sviluppatore 3
Valutazioni
(1)
Progetti
1
0%
Arbitraggio
1
0% / 100%
In ritardo
1
100%
Gratuito
4
Sviluppatore 4
Valutazioni
(37)
Progetti
59
27%
Arbitraggio
26
19% / 54%
In ritardo
10
17%
In elaborazione
Pubblicati: 1 codice
5
Sviluppatore 5
Valutazioni
(72)
Progetti
80
10%
Arbitraggio
38
8% / 58%
In ritardo
6
8%
Gratuito
6
Sviluppatore 6
Valutazioni
(278)
Progetti
340
37%
Arbitraggio
6
50% / 17%
In ritardo
7
2%
Gratuito
Pubblicati: 5 codici
7
Sviluppatore 7
Valutazioni
(47)
Progetti
67
37%
Arbitraggio
5
40% / 40%
In ritardo
1
1%
Gratuito
8
Sviluppatore 8
Valutazioni
(152)
Progetti
190
57%
Arbitraggio
10
80% / 0%
In ritardo
0
Gratuito
Pubblicati: 1 codice
9
Sviluppatore 9
Valutazioni
(4)
Progetti
4
100%
Arbitraggio
0
In ritardo
0
Gratuito
10
Sviluppatore 10
Valutazioni
(17)
Progetti
22
36%
Arbitraggio
5
0% / 100%
In ritardo
4
18%
Gratuito
11
Sviluppatore 11
Valutazioni
(43)
Progetti
66
12%
Arbitraggio
12
58% / 42%
In ritardo
1
2%
Gratuito
12
Sviluppatore 12
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
13
Sviluppatore 13
Valutazioni
(15)
Progetti
19
16%
Arbitraggio
5
40% / 40%
In ritardo
0
Gratuito
14
Sviluppatore 14
Valutazioni
Progetti
1
0%
Arbitraggio
0
In ritardo
0
Gratuito
15
Sviluppatore 15
Valutazioni
(574)
Progetti
945
47%
Arbitraggio
309
58% / 27%
In ritardo
125
13%
Gratuito
16
Sviluppatore 16
Valutazioni
(69)
Progetti
146
34%
Arbitraggio
13
8% / 62%
In ritardo
26
18%
Gratuito
Pubblicati: 6 codici
17
Sviluppatore 17
Valutazioni
(170)
Progetti
228
60%
Arbitraggio
3
33% / 33%
In ritardo
6
3%
Gratuito
Pubblicati: 1 codice
Ordini simili
i need an expert to help join 3 model i have in ninjatrader into one, kindly message me and i will be expecting from you and i need this work done in maximum of 4 days, so i need expert that can get it done
I want an EA that work with my support and resistance indicator. Buy entry condition are: 1. hen candlestick closes in side the support bar. 2. When candlestick break above resistance bar. Likewise sell condition: 1. When candlestick closes inside the resistance bar, 2. When candlestick break below support bar
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

Informazioni sul progetto

Budget
30+ USD