I will write an advisor free of charge - page 150

 
Александр:

I've given it to you somewhere before. Here's more.

I mean, what functionality has been changed?)))) I don't understand the code

 
Александр:

The market does not move by the pips, i.e. it does not move by the pips at its core. It moves from level to level. Distance is better measured in trend time. Perhaps in ticks, but not in pips.

And? Is there a code, can you share? I don't get it, to be honest
 

I am just learning, so something is starting to come out. This EA uses strategy as described above (without trailing stops so far), closing trades at TP or at opening of opposite one, transfer to Breakeven +5 pips when TP price reaches 100 pips from opening.

I've been working with 30M EURUSD, last 4 years, I've been losing on history since 1999, but it lasted till 2014)...

If you want to participate in improvement, I can send you the source code.

If you play with periods of "waving" maybe something good will come out, plus Manimental and/or Martingale

So, the overall performance is not bad: drawdown 32%, losing trades 33%, expected payoff is not so good.


 
Ivan:

I mean, what functionality has been changed?)))) I don't understand the code

1. Increased accuracy.

2. Zero equity is taken into account.

 
Дмитрий Хлыстов:
And? Is there a code, can you share it? I don't understand it, to be honest.
//+------------------------------------------------------------------+
input int  BarrierMinute_Buy;
datetime   openTime = 0;
////////////////////////////////
int start()
{

         CheckForLongetivityClose();
{
....Ваш код
}


}
//+------------------------------------------------------------------+
void CheckForLongetivityClose()
  {
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
        {
         datetime openTime = OrderOpenTime();
         datetime timeDistance = TimeCurrent() - openTime;
         if(OrderType() == OP_BUY)
           {
            if(timeDistance > 60 * BarrierMinute_Buy)
              {
               int a=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),3,Red);
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
Closing on the elapsed time from the start of the order opening. For longs. It's more complicated with levels.
 
Александр:
It is closing by the elapsed time from the order opening. For long positions. It's more difficult with levels.

Alexander, ok. But such a strategy has to be justified in some way? Why not wait for TP, for example? and what if the close is a loss? it's still not very clear.

How is this strategy justified and where can it be applied? It may as well be prohibited to allow the EA to trade long.

 
Александр:

1. Improved accuracy.

2. Zero equity has been taken into account.

Well, then please transfer these changes to version

Knock-knock Indicator Ver 4

so that everything is in one version

 
Дмитрий Хлыстов:


What doesn't work and needs to be completed:

1. Stop Loss and Take Profit are set to fixes of 100 and 200 respectively, these levels are not enough. It is necessary to calculate minimum/maximum stop loss from the set of candlesticks for the last X bars (the number of bars X is set as an input parameter) and to calculate take profit from it. The most important point, because the robot fails exactly because of closing on the stop, even though the signal was correct and the profit would have gone further.

2. The robot, for some reason, opens (in the tester) several orders on the same bar within some ticks, even though it is checking to open an order on the same bar (borrowed from this forum), but it is not working. We have to modify the check and see why it does not work.

3. Complete adding a trailing stop (incoming parameters of the robot) when the BU reaches a certain level, for example, 1/2 of the calculated TP (it is also possible to specify the BU factor in the parameters, for example, from 0.3 to 0.7). Separately trailing is described in the robot (the code is taken from this forum), but it does not take into account the BU. Moreover, for some reason it does not work in the Strategy Tester, I need to understand why.

4. I want to add money management, but I don't know how. For example, the prohibition to open orders more than 5 in one direction, if there are active. Or prohibit to trade when setting balance/equity on account.

5. Martingale. Filtering of signals. (Optional)


What have you already completed:

1. Calculation of the minimum by the "box" of history.

2. Fixed the opening, thanks to Aleksey. I did not notice more orders on one bar

3. Trailing stops now, but has turned it off since it does not give great effect.

4. money management should be improved! i have added only floating lot opening (% of balance).

5. I have added Martin's rule; if a previous deal was closed with a loss the next one will be opened with the ratio specified in the settings


As for the 4th item, have you got any ideas? I would like to try adding different tactics and see, for instance, opening to the opposite side under certain conditions or opening several orders in one direction through a certain step with a multiplier, etc.

As for martin, it gave some results, but not stunning, and the drawdown has become insane. In general I still need a MM)


 
Aleksei Stepanenko:

Agreed

I have one more idea, to output points from ch1 to m15, i am scalping on m15 and the levels are given by ch1.

It would be nice to implement such a function. perhaps with a different point colour or size

 
Дмитрий Хлыстов:

Alexander, ok. But such a strategy has to be justified in some way? Why not wait for the TP, for example? and what if the closing is a loss? it's still not very clear.

Justified by the experience. TP and SL cannot be the main way out. Another thing is level, high, low on months, weeks, days. Well, TP and SL do not work. Make your Expert Advisor without TP, SL, and when it is ready, attach TP, SL. Thus, you will gain 2-3%. For example. The EA fulfills the conditions for closing a position. We modify the order and change the TP by a few points.