Adviser Ivan - the best of ilan - page 2

 
Vladimir Karputov:

Generally, I think the entry conditions are

  • Buy if the close price two bars ago was below the close price on the previous bar and the RSI is below the RsiMaximum (overbought zone).
  • Sell if the close price two bars ago was above the close price on the previous bar and the RSI is above the RsiMinimum (oversold area).

are not the best. The RSI indicator has several entry patterns(Relative Strength Index):

  • Tops and bottoms
    The Relative Strength Index usually tops above 70 and bottoms below 30, and these usually outpace the formation of tops and bottoms on the price chart.
  • Chart Patterns
    The Relative Strength Index often forms graphic patterns, such as 'head and shoulders' or triangles, which may not show up on a price chart.
  • Failed Swing (Support and Resistance Breaks)
    Occurs when the Relative Strength Index rises above the previous high (peak) or falls below the previous low (trough).
  • Support and resistance levels
    The Relative Strength Index chart shows support and resistance levels even more clearly than the price chart.
  • Divergences
    As mentioned above, divergences occur when price makes a new high (low) but is not confirmed by a new high (low) on the RSI chart. This usually results in a price correction in the direction of the Relative Strength Index.

Entry signals from the indicator(Williams' Percent Range) may be worth considering:

Indicator values between -80% and -100% indicate an oversold condition. Values between -0% and -20% indicate that the market is overbought.

I also think the CCI indicator would be of interest here

 

There are also several ways to deal with signals

  1. On every bar, if there is a signal, gain a position, and when the opposite signal comes, start "fixing" the situation.
  2. If the signal is in the same direction as the previous one, then wait for the price to move away from the previous signal by a certain step
  3. ...

 

Here's the code from the video I posted above, but it's for B, I wrote it for C too, but I can't seem to find it

if(filtr==CCI)
     {
      double CCI_S1=0.0;
      double CCI_S2=0.0;
      double CCI_F1=0.0;
      double CCI_F2=0.0;
      int cci_trend=-1;

      if(iBars(_Symbol,_Period)<cci_period_t+1)return(-1);
      if(iBars(_Symbol,_Period)<cci_period_s+1)return(-1);
      int i=0;
      do
        {
         if(i>iBars(_Symbol,_Period))break;

         CCI_S1=iCCI(_Symbol,_Period,cci_period_t,cci_price,1+i);
         CCI_S2=iCCI(_Symbol,_Period,cci_period_t,cci_price,2+i);

         if(CCI_S1>cci_level_up_t){cci_trend=OP_BUY;break;}
         if(CCI_S1<cci_level_dw_t){cci_trend=OP_SELL;break;}

         if(CCI_S1>cci_level_up_t && CCI_S2<cci_level_up_t){cci_trend=OP_BUY;break;}
         if(CCI_S1<cci_level_dw_t && CCI_S2>cci_level_dw_t){cci_trend=OP_SELL;break;}
         i++;
        }
      while(i<iBars(_Symbol,_Period) && !IsStopped());

      CCI_F1=iCCI(_Symbol,_Period,cci_period_s,cci_price,1);
      CCI_F2=iCCI(_Symbol,_Period,cci_period_s,cci_price,2);

      if(cci_trend==OP_BUY)
        {
         if(Variant_cci_01==ON && CCI_F1<cci_level_dw_s)return(OP_BUY);
         if(Variant_cci_02==ON && CCI_F1<cci_level_dw_s && CCI_F2>cci_level_dw_s)return(OP_BUY);
         if(Variant_cci_03==ON && CCI_F1>cci_level_dw_s && CCI_F2<cci_level_dw_s)return(OP_BUY);
         if(Variant_cci_04==ON && CCI_F1>cci_level_up_s && CCI_F2<cci_level_up_s)return(OP_BUY);
         if(Variant_cci_05==ON && CCI_F1>cci_level_up_s)return(OP_BUY);
        }
      if(cci_trend==OP_SELL)
        {
         if(Variant_cci_01==ON && CCI_F1>cci_level_up_s)return(OP_SELL);
         if(Variant_cci_02==ON && CCI_F1>cci_level_up_s && CCI_F2<cci_level_up_s)return(OP_SELL);
         if(Variant_cci_03==ON && CCI_F1<cci_level_up_s && CCI_F2>cci_level_up_s)return(OP_SELL);
         if(Variant_cci_04==ON && CCI_F1<cci_level_dw_s && CCI_F2>cci_level_dw_s)return(OP_SELL);
         if(Variant_cci_05==ON && CCI_F1<cci_level_dw_s)return(OP_SELL);
        }
     }

....

 
I'm still watching the video...
 
Vladimir Karputov:

Generally, I think the entry conditions are

  • Buy if the close price two bars ago was below the close price on the previous bar and the RSI is below the RsiMaximum (overbought zone).
  • Sell if the close price two bars ago was above the close price on the previous bar and the RSI is above the RsiMinimum (oversold area).

are not the best. The RSI indicator has several entry patterns(Relative Strength Index):

  • The tops and the bottoms
    The Relative Strength Index usually tops above 70 and bottoms below 30, and they usually outpace the formation of tops and bottoms on the price chart.
  • Chart Patterns
    The Relative Strength Index often forms graphic patterns, such as 'head and shoulders' or triangles, which may not show up on a price chart.
  • Failed Swing (Support and Resistance Breaks)
    Occurs when the Relative Strength Index rises above the previous high (peak) or falls below the previous low (trough).
  • Support and resistance levels
    The Relative Strength Index chart shows support and resistance levels even more clearly than the price chart.
  • Divergences
    As mentioned above, divergences occur when price makes a new high (low) but is not confirmed by a new high (low) on the RSI chart. This usually results in a price correction in the direction of the Relative Strength Index.

Entry signals from the indicator(Williams' Percent Range) may be worth considering:

Indicator values between -80% and -100% indicate an oversold condition. Values between -0% and -20% indicate that the market is overbought.

You have a wrong idea about the indicator, it does not show anything when there is a trend (from the word "trend"), it works only in flat condition like all the oscillators. For a martingale, it's crucial to separate the trend from the flat, otherwise it will sell out. It may be tried to use in combination with the stdv indicator, it forms distinct tops, and if we measure it several bars ago, we may determine when the trend is over (indicator line will reverse downwards) and use the rsi to find the direction. Well, it is not a universal solution, but it will work much more accurately than the version with one raci.

 
Vladimir Karputov:
I am also watching the video...

So far the following option has emerged: an indicator that has two states - buy or sell. Something in the form of

buy or sell

Thus we create a signal of the custom indicator. Assemble in the wizard of MQL5 an Expert Advisor on the basis of TWO modules of the custom indicator - one with a period of 100, the second with a period of 13. The indicator with period 100 has greater weight and indicates the direction of the global trend, the indicator with period 13 is used for scaling in.

 
Vladimir Karputov:

So far the following option has emerged: an indicator that has two states - buy or sell. Something in the form of

Thus we create a signal of the custom indicator. Assemble in the wizard of MQL5 an Expert Advisor on the basis of TWO modules of the custom indicator - one with a period of 100, the second with a period of 13. The indicator with period 100 has a greater weight and indicates the direction of the global trend, by the indicator with period 13 we fill.

This is nonsense, what's the use of indicators? I do not understand what this code is about.
 
sani soi:
What the hell is the use of indicators? I do not understand what this code is about.

Well, if you don't understand anything, then this thread is not for you. Indicators may not be necessary for manual trading, but automatic trading needs a signal to enter, so indicators are used.

Good luck!

 

Checking the CCI strategy (based on the video from the post) - it can be tentatively described as follows

  • buy - if CCI>"+100.0"
  • Sell - if CCI<"-100.0".
Signal module of custom indicator "SignalCCI_Buy_or_Sell.mqh", version 1.000.

It has only one pattern so far.

An Expert Advisor can be generated on the basis of this signal using the MQL5 Wizard and quickly check the theory for CCI(100).

Files:
 
Vladimir Karputov:

Checking the CCI strategy (based on the video from the post) - it can be tentatively described as follows

  • buy - if CCI>"+100.0"
  • Sell - if CCI<"-100.0".
Signal module of custom indicator "SignalCCI_Buy_or_Sell.mqh", version 1.000.

It has only one pattern so far.

An Expert Advisor can be generated on the basis of this signal using MQL5 Wizard and quickly check the theory for CCI(100).

On the basis of the signals module of the custom indicator, the Expert Advisor (for a quick check of the ideas) "CCI_Byu_or_Sell.mq5" version 1.000 (the signals module itself should be placed in the Expert\MySig\ folder)

  • only one module of signals is used (to maximize simplicity)
  • lot calculation as a percentage of the risk of the margin
  • stop loss 200 points (in old 100 points :) )
  • no trailing
Here's a H4 test on all forex pairs (20 pairs) in "All ticks" mode from 2016.01.01 to 2017.02.14, starting balance 3000:

CCI_Byu_or_Sell all symbols

Files: