How I assemble my advisor by trial and error - page 29

 

Told you to make a signal

;)

 
Renat Akhtyamov:

I told you, make a signal

;)

i need to check first - and with the settings i have not decided yet. i will run it for a month on the demo - what result will be shown. for a week, i worked it out - not bad. on 4 pairs he went from 50 000 rub to 10000 rub for a week - only he hasopen positions now - i will see how the next week will go

1 week

1 week

Совершение сделок - Торговые операции - Справка по MetaTrader 5
Совершение сделок - Торговые операции - Справка по MetaTrader 5
  • www.metatrader5.com
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
 
Aleksandr Klapatyuk:

I need to check first - and with the settings I have not yet decided. for a month I will run it on a demo - what the result will be. for a week, it worked out - not bad. on 4 pairs from 50,000 rubles to 10,000 rubles for a week - only he has open positions now - I will see how the next week will hold out

and the 0.01 risk is 0.01%?

And Sergei says that the norm.

 
Renat Akhtyamov:
Is 0.01% risk 0.01%?

I haven't quite figured out how this risk works - it always shows me 0.01

although in the tester - it sets, and with a bigger lot

---------------------------- this function sets the lot and calculates - somehow

   //+------------------------------------------------------------------+
   //| Calculate optimal lot size                                       |
   //+------------------------------------------------------------------+
   double            TradeSizeOptimized(void)
     {
      double price=0.0;
      double margin=0.0;
      //--- select lot size
      if(!SymbolInfoDouble(_Symbol,SYMBOL_ASK,price))
         return(0.0);
      if(!OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,1.0,price,margin))
         return(0.0);
      if(margin<=0.0)
         return(0.0);

      double lot=NormalizeDouble(AccountInfoDouble(ACCOUNT_MARGIN_FREE)*MaximumRisk/margin,2);
      //--- calculate number of losses orders without a break
      if(DecreaseFactor>0)
        {
         //--- select history for access
         HistorySelect(0,TimeCurrent());
         //---
         int    orders=HistoryDealsTotal();  // total history deals
         int    losses=0;                    // number of losses orders without a break

         for(int i=orders-1; i>=0; i--)
           {
            ulong ticket=HistoryDealGetTicket(i);
            if(ticket==0)
              {
               Print("HistoryDealGetTicket failed, no trade history");
               break;
              }
            //--- check symbol
            if(HistoryDealGetString(ticket,DEAL_SYMBOL)!=_Symbol)
               continue;
            //--- check Expert Magic number
            if(HistoryDealGetInteger(ticket,DEAL_MAGIC)!=Magic_Number)
               continue;
            //--- check profit
            double profit=HistoryDealGetDouble(ticket,DEAL_PROFIT);
            if(profit>0.0)
               break;
            if(profit<0.0)
               losses++;
           }
         //---
         if(losses>1)
            lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
        }
      //--- normalize and check limits
      double stepvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
      lot=stepvol*NormalizeDouble(lot/stepvol,0);

      double minvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
      if(lot<minvol)
         lot=minvol;

      double maxvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX);
      if(lot>maxvol)
         lot=maxvol;
      //--- return trading volume
      return(lot);
     }
   //+------------------------------------------------------------------+
 
Сергей Криушин:

I don't know how it works, but it works great until the demo profit goes like a tank... Well done, brilliant simply super and thanks a lot to you and Barabashkin there are other brilliant and not greedy people, great job... it looks like Lecha Volchansky's scalper from his thread https://www.mql5.com/ru/forum/259953/page12... by the way, they were going to make a scalper for MT5 as well... there was even an attempt to start it...

559
SEM 2018.07.03 10:32 EN

Will there be a version for MT5?

A small preset for MT5 (works in tester).

Opens the next trade if all previous ones by symbol and direction are in plus.

Files:

But I couldn't find the continuation...So I propose to continue and adapt it to your lines... I combined it with your poke method too until I see what will happen...)) So don't lose heart and keep doing it...)



I've combined this EA with mine ... I don't know how to manage this miracle yet.

Photo by

Files:
 
Aleksandr Klapatyuk:

merged this expert with his . still don't know how to operate this miracle.

#property version "1.01"

The buttons on the left in the tester do not work properly - but in normal mode in the terminal, it should work!

when i press them, they are not reset, i have to press again to reset them.

and only BUY and SELL do the rest do not work in the tester - but they will work in the terminal on the chart

Files:
 
Aleksandr Klapatyuk:

#property version "1.01"

buttons on the left in the tester, not working properly - but in normal mode in the terminal, should work!

they do not reset when I press them, I have to press again to reset them

and only BUY and SELL do the rest do not work in the tester - but they will work in the terminal on the chart

the test result is the same

Photo by

 
Aleksandr Klapatyuk:

#property version "1.01"

buttons on the left in the tester, not working properly - but in normal mode in the terminal, should work!

they do not reset when I press them, I have to press again to reset them

and only BUY and SELL do the rest do not work in the tester - but they will work in the terminal on the chart

I haven't enabled button initialization...and thenButtonCreate can't detect it

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit(void)
  {
      EventSetTimer(1); // количество секунд 
                     //   ButtonCreate("BUY",Black,OldLace,50,50,100,20,10);
//   ButtonCreate("SELL",Black,OldLace,160,50,100,20,10);
//
//   ButtonCreate("BUY_Close",Black,OldLace,50,80,100,20,10);
//   ButtonCreate("SELL_Close",Black,OldLace,160,80,100,20,10);
//
//   ButtonCreate("Trailing",Black,OldLace,50,110,100,20,10);
//ArraySize(_name);
   int _y=100;
   for(int i=0; i<ArraySize(_name); i++)
     {
      ButtonCreate(_name[i],125,_y,130,20,10);
      _y=_y+25;
     };
//--- create all necessary objects
   if(!ExtExpert.Init())
      return(INIT_FAILED);
//---
   if(ObjectBuySell)
     {
      bool res=false;
        {
         ObjectCreate(0,"BUY 1",OBJ_BUTTON,0,0,0);
         ObjectSetInteger(0,"BUY 1",OBJPROP_XDISTANCE,ChartGetInteger(0,CHART_WIDTH_IN_PIXELS)-102);
         ObjectSetInteger(0,"BUY 1",OBJPROP_YDISTANCE,37);
         ObjectSetString(0,"BUY 1",OBJPROP_TEXT,"BUY 1");
         ObjectSetInteger(0,"BUY 1",OBJPROP_BGCOLOR,clrMediumSeaGreen);

         ObjectCreate(0,"SELL 1",OBJ_BUTTON,0,0,0);
         ObjectSetInteger(0,"SELL 1",OBJPROP_XDISTANCE,ChartGetInteger(0,CHART_WIDTH_IN_PIXELS)-50);
         ObjectSetInteger(0,"SELL 1",OBJPROP_YDISTANCE,37);
         ObjectSetString(0,"SELL 1",OBJPROP_TEXT,"SELL 1");
         ObjectSetInteger(0,"SELL 1",OBJPROP_BGCOLOR,clrDarkOrange);

         ObjectCreate(0,"CLOSE",OBJ_BUTTON,0,0,0);
         ObjectSetInteger(0,"CLOSE",OBJPROP_XDISTANCE,ChartGetInteger(0,CHART_WIDTH_IN_PIXELS)-75);
         ObjectSetInteger(0,"CLOSE",OBJPROP_YDISTANCE,57);
         ObjectSetString(0,"CLOSE",OBJPROP_TEXT,"CLOSE");
         ObjectSetInteger(0,"CLOSE",OBJPROP_BGCOLOR,clrMagenta);
        }
      res=true;
     }

     
//--- secceed
   return(INIT_SUCCEEDED);
  }
 
Yellow buttons are supposed to open on the fly as I understand it - buy comes on, turn buy goes down, turn buy off, close buy close, turn sell and you see how much is on the yellow sell...
 
Сергей Криушин:

I haven't enabled button initialization...andButtonCreate can't detect it

it is already paired -AVGiS intelligence.mq5195 kb

you are trying - in other way, to attach. it won't work. then you have to rewrite everything without it (CSampleExpert::)--- bool CSampleExpert::Init(void)

Reason: