I will write an advisor free of charge - page 162

 
SanAlex #:

The function is taken from the code ofVladimir Karputov

Thank you! Now I will try it

 

Hello Dear programmers, I'm really askingyou to write an EAbased on the indicator. The indicator does not draw, which is the most important thing. It shows good results. It has two modes of operation. The first one, when a diamond appears, should open a position, while the reverse signal closes the order and opens it in the opposite direction. The second mode should have a fixed take profit and stop.


<*.ex* file was deleted

Как самому создать советника или индикатор - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
Как самому создать советника или индикатор - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
  • www.metatrader5.com
Для разработки торговых систем в платформу встроен собственный язык программирования MetaQuotes Language 5 ( MQL5 ), среда разработки MetaEditor и...
Files:
 
SanAlex #:

The function is taken from the code ofVladimir Karputov

At a glance, opposite positions should be closed at the opening positions:

//--- open position
         if(m_trade.PositionOpen(Symbol(),ORDER_TYPE_BUY,InpLots,priceAsk,0.0,tpAsk))
{
            printf("Position by %s to be opened",Symbol());
            ClosePositions(POSITION_TYPE_SELL);

}
else
...
 
Maksim Sovenko #:

At a quick glance, you need to close the opposite positions at the opening positions:

You have 10 open positions in SELL and 10 positions in BUY and you only need to close BUY positions. That's what he asked. And what you're telling us has a place, if that's the logic you're looking for.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

But maybe I got it wrong. If he doesn't say anything then he has understood it!

 
Good afternoon, happy baptism to all. I've been trying to add two more lines on my own, but when I compile it, I get zero errors and the indicator stops showing up on the chart. I also tried to add a contraction or expansion between lines in the parameter Shift when zero is all right when you put 1 indicator begins to hang and then the lines are extended, can you make the parameter responsible for the expansion between the lines could enter a decimal number separated by a comma, such as 0.78. Thanks in advance.
Files:
 
Hello dear programmers. Could you write an EA or better an indicator for MT4? I want it to find two candlesticks, which necessarily go one after the other with the same High or Low. And if you can add an alert with a sound signal and a message on the monitor screen from which currency pair a signal came. Thank you very much.
Files:
41.png  218 kb
44.png  194 kb
 
acya13 #:
Hello, dear programmers. Could you write an EA or better an indicator for MT4? I would like it to find two candlesticks which follow each other with the same High or Low. And if you can add an alert with a sound signal and a message on the monitor screen from which currency pair a signal came. Thank you very much.

Hello. Will the indicator be installed in each instrument separately? Or, will the list of currency pairs to be monitored be set in the parameters?

And a question about the TF. Will it be fixed in the settings?

 
Hello. If you can, yes, it would be desirable to install it in each instrument separately. I do not really understand the second question. If you mean do you want to customize the indicator, you don't have to do it according to the system. You may do it the way you want.
 
Afternoon. Can I write an advisor that would disable auto-trading in MT4 terminal for all traded pairs at a configurable drawdown? Thanks for that.
 
gorbenko85 #:
Hi. Can I write an EA that would disable autotrading in MT4 terminal for all traded pairs at set drawdown? Thanks for that.

here - but it's easier to add in your EA - ExpertRemove();

function (keystroke) is taken from this codehttps://www.mql5.com/ru/code/8567

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

you need to allow the .dll to work

Screenshot 2022-02-07 105001

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

No, it is better not to allow the . dll - but allow in the Expert Advisor settings to .dll and Allow EA to trade

Screenshot 2022-02-07 105956

//+------------------------------------------------------------------+
//|                                                    Stop Avto.mq4 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//----
#include <WinUser32.mqh>

#define  PAUSE 10
#define  VK_MENU 0x12 //ALT key
#define  VK_CONTROL 0x11 //CTRL key
//----
input double InpSLossAll = 1000000; // ALL Stop Loss --> (In currency the amount)
//---
int     CtrlAlt=0; // 0 - Ctrl, 1 - Alt
string  Key="E";   // Key
//---
double PROFIT_CLOSE=0.00;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   PROFIT_CLOSE=AccountInfoDouble(ACCOUNT_PROFIT);
//---
   if(PROFIT_CLOSE<=-InpSLossAll)
     {
      VK_XXXX(CtrlAlt,Key);
      ExpertRemove();
      PlaySound("expert.wav");
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void VK_XXXX(int ctrlalts,string keys)
  {
   int FirstKey=VK_CONTROL;
   if(ctrlalts==1)
      FirstKey=VK_MENU;
   int SecondKey=StringGetChar(keys,0);
   keybd_event(FirstKey,0,0,0);
   Sleep(PAUSE);
   keybd_event(SecondKey,0,0,0);
   Sleep(PAUSE);
   keybd_event(SecondKey,0,2,0);
   Sleep(PAUSE);
   keybd_event(FirstKey,0,2,0);
  }
//+------------------------------------------------------------------+

ind_HotKeys_v1
ind_HotKeys_v1
  • www.mql5.com
Пример автоматического запуска скрипта при смене таймфрейма или символа
Reason: