Experts: N-_Candles_v6

 

N-_Candles_v6:

The Expert Advisor searches for N identical candlesticks in a row. It buys on bullish candlesticks and sells on bearish ones. The account type is taken into account, i.e. whether it is netting or hedging.


Author: Vladimir Karputov

 

I would like to ask you to write the 7th version of Candles. The principle is also based on the "lousy sheep".

Figuratively. On the example we will use a bullish trend. The Expert Advisor checks 5 identical candles in a row. If all of them are the same, it starts tracking and waits for the next candle to form. If the formed candle is bullish, it does not take any action and waits for the next candle, and so on until a bearish candle is formed. If one or two bearish candles appear (it is better to make this parameter variable in number), then an order in the direction of SELL is formed. From this moment the Expert Advisor starts tracking again, but only bearish candles. If all candles are the same (bearish) - it waits and does not take any action. As soon as a bullish candle appears (it is better to make this parameter variable in number) - it closes the order.

Also with a bearish trend.

PS and if possible add a dynamic lot

 
issah5:

I would like to ask you to write the 7th version of Candles. The principle is also based on the "lousy sheep".

Figuratively. On the example we will use a bullish trend. The Expert Advisor checks 5 identical candles in a row. If all of them are the same - starts tracking and waits for the formation of the next candle. If the formed candle is bullish - it does not take any action and waits for the next candle, and so on until a bearish candle is formed. If one or two bearish candles appear (it is better to make this parameter variable in number), then an order in the direction of SELL is formed. From this moment the Expert Advisor starts tracking again, but only bearish candles. If all candles are the same (bearish) - it waits and does not take any action. As soon as a bullish candle appears (this parameter is also better to make variable in number) - closes the order.

The same with a bearish trend.

PS and if possible add a dynamic lot

This is a bit out of the basic strategy of "N-_Candles ..." - As soon as the number of identical candles equal to the parameter "N identical candles that go in a row" appears, we open a position immediately. You suggest not to open and wait.

 
Vladimir Karputov:

This is a little bit out of the basic strategy "N-_Candles ..." - As soon as the number of identical candles equal to the parameter "N identical candles that go in a row" appears, we open a position immediately. You suggest not to open a position and wait.

Yes, wait until a lousy sheep appears and open (a lousy sheep will be a signal to open).

 
issah5:

Yes, wait for a lousy sheep to appear and open (a lousy sheep will be the signal to open).

No, this algorithm is not suitable for the"N-_Candles ..." series. Perhaps you need to make a new Expert Advisor based on the rule: change the type of candles.

 

Doing a "modernisation" of the candle, we get much better results with code edits in the view:

//--- bull candle. Bear candle.
   int type_of_candles=0;     // "1" -> Bull candle. "-1" ->Bear candle.
   for(int i=0;i<copied;i++)
     {
       //--- we define type of the most distant candle
      if(i==0)
        {
         if(rates[i].high-rates[i].low+rates[i].close<rates[i].high-rates[i].low+rates[i].open)
            type_of_candles=1;
         else if(rates[i].high-rates[i].low+rates[i].close>rates[i].high-rates[i].low+rates[i].open)
            type_of_candles=-1;
         else
           {
            result=false;
            break;
           }
         continue;
        }
      if(type_of_candles==1) // "1" -> Bull candle
        {
         if(rates[i].high-rates[i].low+rates[i].close>rates[i].high-rates[i].low+rates[i].open)
           {
            result=false;
            break;
           }
        }
      else // "-1" -> Bear candle
        {
         if(rates[i].high-rates[i].low+rates[i].close<rates[i].high-rates[i].low+rates[i].open)
           {
            result=false;
            break;
           }
        }
     }

In addition the results of OHLC and Tiki testing based on real ones are now the same

 

Interesting Expert Advisor. But it lacks the setting of closing by profit size, not by pips.

Vladimir, can you add it?

 
narkad1212:

Interesting Expert Advisor. But it lacks the setting of closing by profit size, not by pips.

Vladimir, can you add it?

Does this version have the "close by pips" setting?

 
Vladimir Karputov:

Does this version have a "close by pips" setting?

I apologise. I was thinking about previous versions.

Can you add closing by profit to version 6 ?

 
narkad1212:

I apologise. I was thinking of previous versions.

Can you add more profit closing to version 6 ?

In money profit?

 
Vladimir Karputov:

Is the profit in money?

Yes, in the currency of the deposit. So that when profit is reached, all orders are closed and the cycle starts over again.


That is, either closing on the lousy sheep, or if the specified monetary profit is reached, which will come first.