I will write an advisor free of charge - page 102

 
Hello :
Can an EA open pending orders at closed order prices
 
Anton Yakovlev:
If you have a good strategy and are willing to share it, I can write an EA.


How can I add a balance-dependent open order size to my EA?

e.g.

$100 lot 0.05
$200 lot 0.1
$500 lot 0.25
$1000 lot 0.5
$1200 lot 0.6
$1500 lot 0.75
$2000 lot 1.0
$3000 lot 1.5
$5000 lot 2.5
$10000 lot 5

 
liljon:


How can I add the size of the order to be opened to the EA, depending on the balance?

eg

$100 lot 0.05
$200 lot 0.1
$500 lot 0.25
$1000 lot 0.5
$1200 lot 0.6
$1500 lot 0.75
$2000 lot 1.0
$3000 lot 1.5
$5000 lot 2.5
$10000 lot 5

You can specify percentage of balance Percent=5, for example:

double One_Lot=MarketInfo(Symbol(),MODE_MARGINREQUIRED);//Value. 1 lot

double Min_Lot=MarketInfo(Symbol(),MODE_MINLOT);//Min. lot size

double Step =MarketInfo(Symbol(),MODE_LOTSTEP);// Step change size

double Free =AccountFreeMargin();

lots=MathFloor(Free*Percent/100/One_Lot/Step)*Step;

if (lots<Min_Lot) lots=Min_Lot;

 
kim9622:
Hello everyone.
There are several charts on MT4 (3-6, can be different currency pairs) each with its own EA.

Task:
There are no open orders. When opening order(s) by any EA (1 or 2, preferably by choice of quantity), all other EAs should disable auto-trading. After all open orders are closed, auto-trading should be enabled for all other Expert Advisors. If the conditions allow a maximum of 2 EAs, then auto-trading for all disabled EAs will start when any of 2 (or both) close their orders.
Please advise how to solve this problem. Maybe there is already a similar software.

can be solved via global variables
and each running EA must be modified accordingly in the code

For example: if there is an order in the market, a global variable is activated,

every EA which sees this does not trade
 

Hi all !

Anybody out there who can write a simple non-syndicator EA ! ?

 
volodymyr67:

Hi all !

Anybody out there who can write a simple non-syndicator EA ! ?

No problem ! An EA opens either BUY or SELL position with a given volume:

//+------------------------------------------------------------------+
//|                                            Open One Position.mq5 |
//|                              Copyright © 2018, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2018, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.001"
//---
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>  
CTrade         m_trade;                      // trading object
CSymbolInfo    m_symbol;                     // symbol info object
//--- input parameters
input double               InpLots     = 10.0;              // Lots
input ENUM_POSITION_TYPE   InpPosType  = POSITION_TYPE_BUY; // Open position 
input ulong                InpMagic    = 208060783;         // Magic number
//---
ulong  ExtSlippage=10;                // Slippage
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   m_trade.SetExpertMagicNumber(InpMagic);
   m_trade.SetMarginMode();
   m_trade.SetTypeFillingBySymbol(m_symbol.Name());
   m_trade.SetDeviationInPoints(ExtSlippage);
//---
   if(InpPosType==POSITION_TYPE_BUY)
      m_trade.Buy(InpLots);
   else if(InpPosType==POSITION_TYPE_SELL)
      m_trade.Sell(InpLots);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

  }
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &trans,
                        const MqlTradeRequest &request,
                        const MqlTradeResult &result)
  {
//---

  }
//+------------------------------------------------------------------+
Files:
 

I'm ready to pay a symbolic sum of acouple of hundred rubles.


The Expert Advisor opens2 differently directed orders simultaneously(1 for each currency pair) only when the specified spread forBOTH pairs is lower or equal than that specified in the settings for both currency pairs. If the condition worked for one currency pair and did not work for the other,DOES NOT OPEN ANYWHERE.

It does not open new orders after the orders have been opened, but only waits for the total profit of two orders specified in the robot settings.ONLY 2 DIFFERENTLY DIRECTED ORDERS ARE ALWAYS OPENED

After the orders are closed, the robot again monitors the spreads of both currency pairs and opens again when the spread isALREADY lower or equal to that specified in the settings.

If you are able to set the running time (beginning on Tuesday 00-00 and ending on Thursday 23-59) it will be great.

Here is how it works:the EA(when the required spread appears on both pairs)opens one buy order, the second one sells (or vice versa is not important), waits for the profit, then closes both orders and then restarts. If two orders are open, no new ones will be opened. The Expert Advisor is waiting for the profit set in the settings.


No matter what currency pair the advisor is set on, it will only work with the two currency pairs specified in its settings:

Parameters:

1. Name of the first currency pair (EURUSD)

2. Lot for the first pair (0.1)

3. Order type for the first (Buy)

4. Minimum Spread for the first In PIPS 5. at which the Expert Advisor will trigger (2)

5. Name of second currency pair (GBPUSD)

6. Lot two (0.1)

7. Type of order second (Sell)

8. Minimum spread for the second In PIPSAH 5 sign at which the advisor will trigger (2)

9. Total profit of both pairs inthe deposit currency(or percentage. if that is easier) to close both orders at once

10. Trading start time Tuesday 00-00

11. Closing time Thursday 23-59

 
Vladimir Karputov:

Easy! The Expert Advisor opens either BUY or SELL position with a given volume:

Thank you very much for the speed!

But I need it to open an order at the opening of a bar, took a profit and waited for the opening of a new bar.

Files:
image.png  68 kb
 

Hello dear programmers, I ask you to write an EA based on the indicator to open an order, but there is one catch-22, we need that the EA would open an order not only on the signal indicator, but also at certain times (for example, if the indicator gave a signal at the beginning of the formation of the candle, say from 15:00 to 15:01 then this signal is considered valid and the EA opens the order) (if the signal indicator received 15:02 then the signal is NOT valid and the Council does not open the order)

 
Good time dear coders! Would you be so kind as to write an EA for this indicator. The expert advisor opens an order on a signal from the arrow, i.e., on the next candlestick, the order execution time is one candlestick, i.e., it opens and closes on the next candlestick. The stop is not necessary. And all theindicator settings have been placed in the EA. Thanks in advance!
Files:
Reason: