0
готово:




//+------------------------------------------------------------------+
//|                                                       Candle.mq4 |
//|                                              Copyright 2020, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict

//--- Inputs
extern double Lots       = 0.1;      // лот
extern double KLot       = 2;        // умножение лота
extern double MaxLot     = 5;        // максимальный лот
extern int StopLoss      = 0;        // лось
extern int TakeProfit    = 0;        // язь
extern int Slip          = 30;       // реквот
extern int Magic         = 123;      // магик

extern string Comm       = "5";

datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Comment("");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
  {
   int r=0;
   color clr=Green;
   double sl=0,tp=0;

   if(type==1 || type==3 || type==5)
     {
      clr=Red;
      if(StopLoss>0)
         sl=NormalizeDouble(price+StopLoss*_Point,_Digits);
      if(TakeProfit>0)
         tp=NormalizeDouble(price-TakeProfit*_Point,_Digits);
     }

   if(type==0 || type==2 || type==4)
     {
      clr=Blue;
      if(StopLoss>0)
         sl=NormalizeDouble(price-StopLoss*_Point,_Digits);
      if(TakeProfit>0)
         tp=NormalizeDouble(price+TakeProfit*_Point,_Digits);
     }

   r=OrderSend(NULL,type,Lot(),NormalizeDouble(price,_Digits),Slip,sl,tp,Comm,Magic,0,clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountTrades()
  {
   int count=0;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()<2)
               count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int Loss()
  {
   int loss=0;
   for(int i=OrdersHistoryTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==0)
              {
               if(OrderClosePrice()-OrderOpenPrice()<0)
                  loss++;
               if(OrderClosePrice()-OrderOpenPrice()>0)
                  break;
              }
            if(OrderType()==1)
              {
               if(OrderClosePrice()-OrderOpenPrice()>0)
                  loss++;
               if(OrderClosePrice()-OrderOpenPrice()<0)
                  break;
              }
           }
        }
     }
   return(loss);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Lot()
  {
   double lot=NormalizeDouble(Lots*MathPow(KLot,Loss()),2);
   if(lot>MaxLot)
      lot=Lots;
   return(lot);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(CountTrades()<1)
     {
      if(Close[1]>Open[1])
        {
         PutOrder(0,Ask);
        }
      if(Close[1]<Open[1])
        {
         PutOrder(1,Bid);
        }
     }

   Comment("\n Lot: ",Lot(),
           "\n Losses: ",Loss());
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 30 марта 2021, 21:53
0
на 9-е
avatar

AM2

  • 30 марта 2021, 21:50
0
советник не под бо
avatar

AM2

  • 30 марта 2021, 20:45
0
скиньте логин и пароль демки, я отлажу советник
avatar

AM2

  • 30 марта 2021, 20:43
0
готово:




//+------------------------------------------------------------------+
//|                                                     High_Low.mq4 |
//|                        Copyright 2019, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
input double lot= 0.22;
extern int TP   = 1000;  // ПРОФИТ
input int _period_ma  = 55;        // Период МА
extern bool _trailingStop = true;        // вкл. трала
input int magic = 123;

// -----------------------------------------------Number of bars to scan

//+------------------------------------------------------------------+
//| Подсчет ордеров по типу                                          |
//+------------------------------------------------------------------+
int CountOrders(int type=-1)
  {
   int count=0;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
           {
            if(OrderType()==type || type==-1)
               count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Profit()
  {
   double pr=0;

   for(int i=OrdersHistoryTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
           {
            pr=OrderProfit();
            break;
           }
        }
     }
   return(pr);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(CountOrders()<1)
     {
      Alert("Order Profit: ",Profit());
     }

   if(_trailingStop)
     {
      _TrailingStop();
     }
   int r=0;
   CountOrders();
   if(NormalizeDouble(iHigh(_Symbol, _Period, 1), Digits) < Ask && CountOrders(OP_BUY) < 1 &&
      NormalizeDouble(iMA(NULL,0,_period_ma,0,MODE_SMA,PRICE_CLOSE,1), Digits)< NormalizeDouble(iClose(_Symbol, _Period, 1), Digits) &&
      NormalizeDouble(iMA(NULL,0,_period_ma,0,MODE_SMA,PRICE_CLOSE,1), Digits)> NormalizeDouble(iLow(_Symbol, _Period, 1), Digits))
     {
      r = OrderSend(Symbol(),
                    OP_BUY,
                    NormalizeDouble(lot, 2),
                    Ask,
                    30,
                    0,   //SL
                    NormalizeDouble(iHigh(_Symbol, _Period, 1) + TP*Point, Digits),  //TP
                    "МАША",
                    magic,
                    0,
                    Blue); // BUY
     }
   else
      if(NormalizeDouble(iLow(_Symbol, _Period, 1), Digits) > Bid && CountOrders(OP_SELL) < 1 &&
         NormalizeDouble(iMA(NULL,0,_period_ma,0,MODE_SMA,PRICE_CLOSE,1), Digits)> NormalizeDouble(iClose(_Symbol, _Period, 1), Digits) &&
         NormalizeDouble(iMA(NULL,0,_period_ma,0,MODE_SMA,PRICE_CLOSE,1), Digits)< NormalizeDouble(iHigh(_Symbol, _Period, 1), Digits))
        {
         r = OrderSend(Symbol(),
                       OP_SELL,
                       NormalizeDouble(lot, 2),
                       Bid,
                       30,
                       0,  //SL
                       NormalizeDouble(iLow(_Symbol, _Period, 1) - TP*Point, Digits), //TP
                       "МАША",
                       magic,
                       0,
                       Red); // SELL


        }
  }

//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void _TrailingStop()
  {
   int i;
   bool m;
   double _stopLossSellF=NormalizeDouble(iMA(NULL,0,_period_ma,0,MODE_SMA,PRICE_CLOSE,1), Digits),
          _stopLossBuyF=NormalizeDouble(iMA(NULL,0,_period_ma,0,MODE_SMA,PRICE_CLOSE,1), Digits);
   if(OrdersTotal()>0)
     {
      for(i=OrdersTotal()-1; i>=0; i--)
        {
         if(OrderSelect(i, SELECT_BY_POS))
           {
            if(OrderSymbol()==Symbol() /*&& OrderMagicNumber()==-1*/)
              {

               if(OrderType()==OP_BUY && OrderOpenPrice() < _stopLossBuyF)
                 {
                  while(IsTradeContextBusy())
                     Sleep(1000);
                  RefreshRates();
                  m = OrderModify(OrderTicket(),OrderOpenPrice(),_stopLossBuyF,OrderTakeProfit(),OrderExpiration(),CLR_NONE);
                 }

               if(OrderType()==OP_SELL && OrderOpenPrice() > _stopLossSellF && _stopLossSellF!=0.0)
                 {
                  while(IsTradeContextBusy())
                     Sleep(1000);
                  RefreshRates();
                  m = OrderModify(OrderTicket(),OrderOpenPrice(),_stopLossSellF,OrderTakeProfit(),OrderExpiration(),CLR_NONE);
                 }
              }
           }
        }
     }
   return;
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

avatar

AM2

  • 30 марта 2021, 19:24
0
не берусь
avatar

AM2

  • 30 марта 2021, 19:05
0
посмотрю 7-го
avatar

AM2

  • 30 марта 2021, 19:00
0
убрал риск:


//+------------------------------------------------------------------+
//|                                                       Candle.mq4 |
//|                                              Copyright 2020, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict

//--- Inputs
extern double Lots       = 0.1;      // лот
extern double KLot       = 2;        // умножение лота
extern double MaxLot     = 5;        // максимальный лот
extern int StopLoss      = 0;        // лось
extern int TakeProfit    = 0;        // язь
extern int Slip          = 30;       // реквот
extern int Magic         = 123;      // магик

extern string Comm       = "";

datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Comment("");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
  {
   int r=0;
   color clr=Green;
   double sl=0,tp=0;

   if(type==1 || type==3 || type==5)
     {
      clr=Red;
      if(StopLoss>0)
         sl=NormalizeDouble(price+StopLoss*_Point,_Digits);
      if(TakeProfit>0)
         tp=NormalizeDouble(price-TakeProfit*_Point,_Digits);
     }

   if(type==0 || type==2 || type==4)
     {
      clr=Blue;
      if(StopLoss>0)
         sl=NormalizeDouble(price-StopLoss*_Point,_Digits);
      if(TakeProfit>0)
         tp=NormalizeDouble(price+TakeProfit*_Point,_Digits);
     }

   r=OrderSend(NULL,type,Lot(),NormalizeDouble(price,_Digits),Slip,sl,tp,"",Magic,0,clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountTrades()
  {
   int count=0;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()<2)
               count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Lot()
  {
   double lot=Lots;

   for(int i=OrdersHistoryTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderProfit()>0)
               break;
            if(OrderProfit()<0)
              {
               lot=OrderLots()*KLot;
               break;
              }
           }
        }
     }
   if(lot>MaxLot)
      lot=Lots;
   return(lot);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CloseAll(int ot=-1)
  {
   bool cl;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==0 && (ot==0 || ot==-1))
              {
               RefreshRates();
               cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,_Digits),Slip,White);
              }
            if(OrderType()==1 && (ot==1 || ot==-1))
              {
               RefreshRates();
               cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,_Digits),Slip,White);
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(t!=Time[0])
     {
      CloseAll();

      if(Close[1]>Open[1])
        {
         PutOrder(0,Ask);
        }
      if(Close[1]<Open[1])
        {
         PutOrder(1,Bid);
        }
      t=Time[0];
     }

   Comment("\n Lot: ",Lot());
  }
//+------------------------------------------------------------------+

avatar

AM2

  • 30 марта 2021, 18:55
0
у super-signals-channel другой тип сигнала

T3MA ALARM Alert в тестере чудеса показывает. но когда есть сигнал позу открывает советник.
avatar

AM2

  • 28 марта 2021, 12:38
0
напиши какие пробовал. я проверю
avatar

AM2

  • 27 марта 2021, 18:33
0
надо писать под конкретный индикатор. а так что получилось смотрите:



www.opentraders.ru/downloads/2970/
avatar

AM2

  • 27 марта 2021, 09:17
0
советник не тестируется но в онлайне срабатывает: www.opentraders.ru/downloads/2969/

avatar

AM2

  • 26 марта 2021, 21:22
0
на 2-е
avatar

AM2

  • 26 марта 2021, 21:16
0
Советник под любой стрелочный индикатор

опишите подробно под какой тип сигнала писать советник?
avatar

AM2

  • 26 марта 2021, 17:46