I will write an advisor free of charge - page 63

 
Hello. Can you use this strategy to write an advisor https://www.youtube.com/watch?v=V58JIhy2rw4. Or do you have any advisor that stagnates in place or is slightly in the black.... For earnings on rebate on site fxcash.ru. Thank you. If anything, please contact me on facebook https://vk.com/id16112208 or in person.
Метод торговли на FOREX (Безубыточный)
Метод торговли на FOREX (Безубыточный)
  • 2016.01.11
  • www.youtube.com
САЙТ – http://forexbid.jimdo.com/strategy/metod/ ФОРУМ – http://forex.forumex.ru/viewtopic.php?f=5&t=45&p=73#p73 Возврат спреда http://www.getforexrebate.com...
 
Sergey Zaitsev:
Hello. Can you write an expert advisor on this strategy https://www.youtube.com/watch?v=V58JIhy2rw4. Or maybe you have an expert advisor, that stagnates on the spot or goes to profit a little bit.... For earnings on rebate on site fxcash.ru. Thanks. If that please contact https://vk.com/id16112208 or in private.
Yes I wrote this type of owls.
****
For a rebate it's fine. Gets a lot of lots without a lot of drawdown.
But during a long flat, it may lose ...
 
I take it not that it's a long flat, but exactly when the flat expands? Is it possible to get one?
 
is your rebate service globegain.com ok? why does forex4u give so much - $18.6 per lot....insta - $14.3... is it real?
 

Good afternoon!

I decided to robotize my trading a bit. I used a trend Expert Advisor from MT4 terminal "Moving Average". I have decided to use my own EA from MT4 terminal and made some slight modifications. I added one more mask, changed entry and exit conditions, added stop and profit and limited opening time. I would like to add more.

1) The ability to open two orders at once with adjustable stop loss, take profit, move to zero loss.

2) Adjustable number of entries per day.

3) Adjustable possibility to enter the next day when a trade is open.

4)Adjustable exit by stop loss, no loss or take profit.

5)Removing calculation of maximum risk. (Particular need I do not see it, besides I do not understand how he calculates the risk, the impression that from the background, lots were opened then 0.10 then 1.00)

6) Does not work correctly on the currency pair USDJPY

Perhaps something to fix, clean to improve the work of the EA. Help or tips.

Works on more than ten charts simultaneously, in each window of the currency pair chart has its own EA. The code is attached. Thank you to everyone who responds.

//+------------------------------------------------------------------+
//|                                                      MA_MA_1.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//#property strict
#define  MAGICMA  20131112
//--- Inputs
input double SL             =500; //стоп лос
input double TakeProfit     =1000; //тейк профит
input double Lots           =0.01; //розмер лота
//input double MaximumRisk    =0.1; //отключил не понятна логика расчета
input double DecreaseFactor = 3; //фактор снижение(наверно проскальзывание)
input int    MovingPeriod1  =36; //медленная средняя
input int    MovingPeriod2  =12; //быстрая средняя
input int    MovingShift1   =10; //сдвиг медленной средней
input int    MovingShift2   = 0; //сдвиг быстрой средней
extern int   TimeStart      = 8; //время начала торгов
extern int   TimeStop       =20; //время окончания торгов
//+------------------------------------------------------------------+
//| Calculate open positions     //считаем открытые позиции                                    |
//+------------------------------------------------------------------+
int CalculateCurrentOrders(string symbol)
  {  
   int buys=0,sells=0;
//---
   for(int i=0;i<OrdersTotal();i++)
     {    
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)
        {
         if(OrderType()==OP_BUY)  buys++;
         if(OrderType()==OP_SELL) sells++;
        }
     }
//--- return orders volume //объём ордеров на возврат
   if(buys>0) return(buys);
   else       return(-sells);
  }
//+------------------------------------------------------------------+
//| Calculate optimal lot size       //расчет оптимального размера лота                                |
//+------------------------------------------------------------------+
double LotsOptimized()
  {
   double lot=Lots;
   int    orders=HistoryTotal();     // history orders total (история заказов всего)
   int    losses=0;                  // number of losses orders without a break (количество потерь заказов без перерыва)
//--- select lot size //ОТКЛЮЧИЛ выбор размер лота. 
//lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1);//(логика выбора мне не понятна)
//--- calcuulate number of losses orders without a break (Расчет количества заказов на потери без перерыва)
//   if(DecreaseFactor>0)
//    {
//      for(int i=orders-1;i>=0;i--)
//        {
//         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false)
//           {
//            Print("Error in history!");
//            break;
//           }
//         if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL)
//            continue;
         //---
//         if(OrderProfit()>0) break;
//         if(OrderProfit()<0) losses++;
//        }
//      if(losses>1)
//         lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
//     }
//--- return lot size (розмер возвращаемого лота)
   if(lot<0.1) lot=0.1;
   return(lot);
  }
//+------------------------------------------------------------------+
//| Check for open order conditions       //проверка условий для открытия ордера                           |
//+------------------------------------------------------------------+
void CheckForOpen()
  {  
   double ma1; //медленная средняя
   double ma2; //быстрая средняя
   int    res;
//--- go trading only for first tiks of new bar// торговать только на первом тике нового бара
   if(Volume[0]>1) return;
//--- get Moving Average //получение скользящих средних
   ma1=iMA(NULL,0,MovingPeriod1,MovingShift1,MODE_SMA,PRICE_CLOSE,0);//медленная
   ma2=iMA(NULL,0,MovingPeriod2,MovingShift2,MODE_SMA,PRICE_CLOSE,0);//быстрая
//--- sell conditions //условия для продажи
   if(ma1<ma2 && Close[1]<ma1 && TimeHour(TimeCurrent())>TimeStart && TimeHour(TimeCurrent())<TimeStop)
     {
      res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,Bid+SL*Point,Bid-TakeProfit*Point,"",MAGICMA,0,Red);
      return;      
     }
//--- buy conditions //условия для покупки
   if(ma1>ma2 && Close[1]>ma1 && TimeHour(TimeCurrent())>TimeStart && TimeHour(TimeCurrent())<TimeStop)
     {
      res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,Ask-SL*Point,Ask+TakeProfit*Point,"",MAGICMA,0,Blue);
      return;      
     }
//---
  }
//+------------------------------------------------------------------+
//| Check for close order conditions      //проверка условий для закрытия ордера                           |
//+------------------------------------------------------------------+
void CheckForClose()
  {
   double ma1;//медленная
   double ma2;//быстрая
//--- go trading only for first tiks of new bar// торговать толькона тике нового бара
   if(Volume[0]>1) return;
//--- get Moving Average //получение средних
   ma1=iMA(NULL,0,MovingPeriod1,MovingShift1,MODE_SMA,PRICE_CLOSE,0);//медленная
   ma2=iMA(NULL,0,MovingPeriod2,MovingShift2,MODE_SMA,PRICE_CLOSE,0);//быстрая
//---
   for(int i=0;i<OrdersTotal();i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
      if(OrderMagicNumber()!=MAGICMA || OrderSymbol()!=Symbol()) continue;
      //--- check order type //проверка типа ордера
      if(OrderType()==OP_BUY)
        {
         if(Close[1]<ma2 && Open[2]>Close[1] && ma1<ma2) //(Open[1]>ma && Close[1]<ma)
           {
            if(!OrderClose(OrderTicket(),OrderLots(),Bid,3,White))
               Print("OrderClose error ",GetLastError());
           }
         break;
        }
      if(OrderType()==OP_SELL)
        {
         if(Close[1]>ma2 &&  Open[2]<Close[1] && ma1>ma2)
           {
            if(!OrderClose(OrderTicket(),OrderLots(),Ask,3,White))
               Print("OrderClose error ",GetLastError());
           }
         break;
        }
     }
//---
  }
//+------------------------------------------------------------------+
//| OnTick function  //функция нового тика                                                |
//+------------------------------------------------------------------+
void OnTick()
  {
//--- check for history and trading
   if(Bars<100 || IsTradeAllowed()==false)
      return;
//--- calculate open orders by current symbol
   if(CalculateCurrentOrders(Symbol())==0) CheckForOpen();
   else                                    CheckForClose();
//---
  }
//+------------------------------------------------------------------+
 
Sergey Zaitsev:
Hello. Can you use this strategy to write an advisor https://www.youtube.com/watch?v=V58JIhy2rw4. Or do you have any advisor that stagnates in place or is slightly in the black.... For earnings on rebate on site fxcash.ru. Thanks. If that beep in Ek https://vk.com/id16112208 or in private.

Look at the branch Avalanche, there are advisors for this TS.
 

Hello!

Can I get some help? The Expert Advisor is retrieving trades every tick. How do I write code to take away about 5 trades or only as many as I want?

extern int tp=50;

extern int sl=200;

extern double lot=0.01;

oid OnTick()

{

OrderSend("USDJPY",OP_SELL,lot,Bid,0,Ask+sl*Point,Ask-tp*Point, "Batsasho",1,0,Red);

}

What should I change or add to the code?

Thank you!

 

If I don't make it difficult you can answer ***

Thank you!

 

I tried to re-do the ready-made templates, but in the end they give out a couple of errors, all I need is an owl:

1) opens a buy position if the closed candle is bullish, and a sell position if the closed candle is bearish.

2) and so on after EVERY candlestick.

I have the second condition does not work.

If anyone can help, I will be very grateful.

 
alstefanov:

Can I get some help? The Expert Advisor will retrieve trades every tick. How do I write the code to draw about 5 trades or only as many as I want?

What should I change or add to the code?

I should add a loop and limit the number of orders before executing OrderSend.