THE IDEA EXCHANGE - page 35

 
OnGoing:
Whatever it is, there are not enough trades to draw any conclusions.
you can increase the trades many times - the equity staircase will be mln and frequent, but the FS will decrease.
 
alex12:
you can increase the trades many times - the equity staircase will be small and frequent, but the FS will decrease.
Let it be so, the result will still be more reliable.
 

I came across an interesting result by chance yesterday.

The idea is to trace quickly how one currency behaves in relation to the other.

We download this Expert Advisor, it is also in the codebase of this forum: ReverseSystemBEST

It tests an instrument using historical data from a file - we test USD/Franc from year 2000 and at the end of the

of thetest open the chart and see the following picture:

Further we save it as a template. Open the daily eurobucks chart and open the saved template

On this chart. Then 2 times click the mouse on icons and the right button select delete all icons.

As a result you will see a picture like below.

That is, you can see that the dollar/franc and the eurobucks are absolutely mirror currency instruments.





 
alex12:

I came across an interesting result by chance yesterday.

The idea is to trace quickly how one currency behaves in relation to the other.

We download this Expert Advisor, it is also in the codebase of this forum: ReverseSystemBEST

It tests an instrument using historical data from a file - we test USD/Franc from year 2000 and at the end of the

of thetest open the chart and see the following picture:

Further we save it as a template. Open the daily eurobucks chart and open the saved template

On this chart. Then 2 times click the mouse on icons and the right button select delete all icons.

As a result you will see a picture like below.

That is, you can see that the dollar/franc and the eurobucks are absolutely mirror currency instruments.






Oh, how many wonderful discoveries for us ......
 
The idea is to create an indicator.

I originally came up with this idea with ticks, but it turns out there is no tick history in the tester
so I transferred it to bars.
The idea is a combination of bars. The settings may be:

Up - Buy:

Bears = 0, Value
Bears = 0, Value
Colour
Line Thickness

Down - Sell:

Bears = 0, Value
Bears = 0, Value
Colour
Line Thickness

For example one bar 1 up and 2 down, 1 up and 3 down, then 1/4, 1/5, !/6, 1/7 etc. for Sell.
For Bai - 1 bar down and 2 bars up, 1 down and 3 up, then 1/4, 1/5, etc.

For example let's take a combination of 3 bars up and 7 bars down ( 3/7 for short ) for the Sell. We take the value
of the highest price of the 3rd bar and the lowest price of the 7th bar = calculate the average price and draw a line
on the average price of this combination of bars. I would also like this combination to be outlined with a circle
using the same indicator.
Next you can write an EA using this indicator and check the result.

If anyone writes an indicator and/or advisor, post it here if you don't mind.

--------------------------------------------------------------------------------------------------------------+

By the way - it can be done with points - just trade directly online.
Not by time, like in the WOC EA, but exactly by combinations of points and it will turn out
that the Expert Advisor will not trade by history, but by the current situation. But it's so,
is probably too shallow and implausible - although I'm not sure myself
.
 

leonid553:

There is an Envelopes indicator, and the classic tactics of working with it are known. But due to its structure it is too "sensitive", or with a large period - it lags a lot of signals. However, if we smooth out this indicator, the situation will change immediately! We select the deviation of the borders so that the borders cover only the tips of the candles and we enter by these crossings strictly following the trend. - set it (the trend) programmatically by the slope angle (for example) of these borders.

One version works in buy. The other version works for sell. At the same time we surprisingly miss losing trades at trend reversals! - No irony! And besides during a flat - no deals! (because the trend is set by the angle of slope!)

Here's a smoothed indicator chart - entry points are shown with arrows.

One more trick. You can use it as a filter or as a separate version. Stochastic. It should not be used according to classical rules but a little bit non-standard! Take a long period and enter at crossing not from outside to inside of overbought/oversold zones, but vice versa! - I have shown the entries with arrows in the stochastic window.

I have already made primitive Expert Advisors using both described methods. The results are satisfactory so far...

At the request of moderator Granit77 the original post was deleted and the discussion of Expert Advisor on filtered stochastics was moved here https://www.mql5.com/ru/forum/112887/page15#518639

 
alex12:
The idea is to create an indicator.

This idea was originally invented by me with ticks, but it turns out that there is no tick history in the tester
So I shifted it to bars.
The essence is a combination of bars.The settings may be as follows:

Up - Buy:

Bullish = 0, Value.
Bears = 0, Meaning
Colour
Line Thickness

Down - Sell:

Bears = 0, Value
Bullish = 0, Value
Colour
Line Thickness

E.g. 1 bar up and 2 bars down, 1 bar up and 3 bars down, then 1/4, 1/5, !/6, 1/7 etc. for Sell.
For Bai - 1 bar down and 2 bars up, 1 down and 3 up, then 1/4, 1/5, etc.

For example let's take a combination of 3 bars up and 7 bars down ( 3/7 for short ) for the Sell. We take the value
the highest price of the 3rd bar and the lowest price of the 7th bar = calculate the average price and draw a line
I would also like this combination of bars to be drawn as a circle
using the same indicator.
Then you can write an EA using this indicator and check the result.

If anyone writes an indicator and/or advisor, post it here if you don't mind.

--------------------------------------------------------------------------------------------------------------+

By the way - it can be done with points - only online trading is needed.
Not by time, like in the WOC-advisor, but precisely by combinations of points.
that the Expert Advisor will not trade based on the history, but on the current situation. But it is so,
although I don't know for sure.
Although I myself do not know exactly.

I made a custom indicator as described above. Pretty interesting - because = Accurate ( Unmistakably identifies given Fractal Patterns ).


Here is the code itself:

//+------------------------------------------------------------------+
//|                             Copyright © 2010, Trishkin Artyom A. |
//|                                           support@goldsuccess.ru |
//|                                           Skype: Artmedia70      |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Trishkin Artyom A."
#property link      "support@goldsuccess.ru"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Gold
#property indicator_color2 LightBlue
//---- input parameters
extern int        BarsBefore=2;        // Баров до...
extern int        BarsAfter=2;         // Баров после
extern int        Width=2;             // Размер значка
extern int        BarsToProcess=100;   // Количество баров для поиска
//---- buffers
double FractUpBuffer1[];
double FractDnBuffer2[];
string sy, Prefix, NameIND;
int    tf;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,EMPTY,0);
   SetIndexBuffer(0,FractUpBuffer1);
   SetIndexArrow(0,119);
   SetIndexLabel(0,"Fractal Up");
   SetIndexEmptyValue(0,0.0);
   
   SetIndexStyle(1,DRAW_ARROW,EMPTY,0);
   SetIndexBuffer(1,FractDnBuffer2);
   SetIndexArrow(1,119);
   SetIndexLabel(1,"Fractal Dn");
   SetIndexEmptyValue(1,0.0);
//----
   NameIND="Pattern_v1_01";
   IndicatorShortName(NameIND+"_"+GetNameTF(Period()));
   Prefix=NameIND+"_"+GetNameTF(Period());    // Префикс для имён объектов
   sy=Symbol();
   tf=Period();
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
// -------- Блок удаления всех объектов, построенных на графике --------
   string Name_Del[1]; 
   int Quant_Del=0;                    
   int Quant_Objects=ObjectsTotal();   
   int LenPref=StringLen(Prefix);
   ArrayResize(Name_Del,Quant_Objects);
   for(int k=0; k<Quant_Objects; k++) {
      string Obj_Name=ObjectName(k);   
      string Head=StringSubstr(Obj_Name,0,LenPref);
      if (Head==Prefix) {                              
         Quant_Del+=1;        
         Name_Del[Quant_Del-1]=Obj_Name;
         }
     }
   for(int i=0; i<Quant_Del; i++)    
      ObjectDelete(Name_Del[i]); 
// ----- Конец блока удаления всех объектов, построенных на графике -----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int   counted_bars=IndicatorCounted();
   int   i, k, j, limit;
//----
   if(counted_bars>0)      counted_bars--;
   limit=Bars-counted_bars;
   if(limit>BarsToProcess) limit=BarsToProcess;
   
//   if (limit>0) 
      FindUpFractals(BarsBefore, BarsAfter);
      FindDnFractals(BarsBefore, BarsAfter);
   
//----
   return(0);
}
//==============================================================================
// --------------------------------- Функции ----------------------------------+
//==============================================================================
int FindDnFractals(int nl, int nr) {
   int      i, k, nb;
   double   fractal;
   datetime tm;
   string   nm;
   bool     fl, fr;
   int delta=SetDistance(Period());
   for (i=BarsToProcess; i>0; i--) {
      fl=false;
      FractDnBuffer2[i]=0;
      if (Open[i]<Close[i]) {                   
         for (k=1; k<=nl; k++) {
            if (Open[i+k]>Close[i+k]) fl=true;
            else { fl=false; break; }
            }
         if (!fl || Open[i+nl+1]>Close[i+nl+1]) continue;
         fr=false;
         for (k=0; k<nr; k++) {
            if (Open[i-k]<Close[i-k]) fr=true;
            else { fr=false; break; }
            }
         if (!fr || Open[i-nr]<Close[i-nr] || iBarShift(sy,tf,Time[i-nr])==0) continue;
         if (Low[i]<Low[i+1]) { fractal=Low[i]; nb=i; tm=Time[i];}
         else { fractal=Low[i+1]; nb=i+1; tm=Time[i+1]; }
         FractDnBuffer2[nb]=fractal;
         nm=Prefix+"_Down_Fractal_"+nl+"/"+nr+"_"+TimeToStr(tm);
         fractal=MathMin(Low[i], Low[i+1]);
         SetArrow(218, LightBlue, nm, tm, fractal-delta*Point, Width);
         WindowRedraw();
         }
      }
   return(0);
}   
//+----------------------------------------------------------------------------+
int FindUpFractals(int nl, int nr) {
   int      i, k, nb;
   double   fractal;
   datetime tm;
   string   nm;
   bool     fl, fr;
   int delta=SetDistance(Period());
   for (i=BarsToProcess; i>0; i--) {
      fl=false;
      FractUpBuffer1[i]=0;
      if (Open[i]>Close[i]) {                   
         for (k=1; k<=nl; k++) {
            if (Open[i+k]<Close[i+k]) fl=true;
            else { fl=false; break; }
            }
         if (!fl || Open[i+nl+1]<Close[i+nl+1]) continue;
         fr=false;
         for (k=0; k<nr; k++) {
            if (Open[i-k]>Close[i-k]) fr=true;
            else { fr=false; break; }
            }
         if (!fr || Open[i-nr]>Close[i-nr] || iBarShift(sy,tf,Time[i-nr])==0) continue;
         if (High[i]>High[i+1]) { fractal=High[i]; nb=i; tm=Time[i];}
         else { fractal=High[i+1]; nb=i+1; tm=Time[i+1]; }
         FractUpBuffer1[nb]=fractal;
         nm=Prefix+"_Up_Fractal_"+nl+"/"+nr+"_"+TimeToStr(tm);
         fractal=MathMax(High[i], High[i+1]);
         SetArrow(217, PaleGoldenrod, nm, tm, fractal+4*delta*Point, Width);
         WindowRedraw();
         }
      }
   return(0);
}   
//+----------------------------------------------------------------------------+
string GetNameTF(int TimeFrame=0) {
   switch (TimeFrame) {
      case PERIOD_M1:  return("M1");
      case PERIOD_M5:  return("M5");
      case PERIOD_M15: return("M15");
      case PERIOD_M30: return("M30");
      case PERIOD_H1:  return("H1");
      case PERIOD_H4:  return("H4");
      case PERIOD_D1:  return("Daily");
      case PERIOD_W1:  return("Weekly");
      case PERIOD_MN1: return("Monthly");
      default:         return("UnknownPeriod");
      }
}
//+----------------------------------------------------------------------------+
int SetDistance(int TimeFrame) {
   switch (TimeFrame) {
      case PERIOD_M1:  return(1);
      case PERIOD_M5:  return(1);
      case PERIOD_M15: return(2);
      case PERIOD_M30: return(3);
      case PERIOD_H1:  return(4);
      case PERIOD_H4:  return(4);
      case PERIOD_D1:  return(4);
      case PERIOD_W1:  return(4);
      case PERIOD_MN1: return(4);
      default:         return(0);
      }
}
//+----------------------------------------------------------------------------+
void SetArrow(int cd, color cl, string nm, datetime t1=0, double p1=0, int sz=0) {
   if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_ARROW, 0, 0, 0);
   ObjectSet(nm, OBJPROP_TIME1    , t1);
   ObjectSet(nm, OBJPROP_PRICE1   , p1);
   ObjectSet(nm, OBJPROP_ARROWCODE, cd);
   ObjectSet(nm, OBJPROP_COLOR    , cl);
   ObjectSet(nm, OBJPROP_WIDTH    , sz);
}
//+----------------------------------------------------------------------------+
Files:
 
alex12:

Here's a custom-built turkey as described above. Pretty interesting - because = Accurate ( Detects Fractal Patterns correctly).


Here's the code itself:

Thank you for the code. For some reason it only shows on the Hourly, not on the other halves.
 

То есть видно что доллар/франк и евробакс – абсолютно зеркальные валютные инструменты.

Maybe we should be a little more careful with the word "absolutely".

Forthose in the tank Comment to the picture: The averaging was taken for X= 10, 20, 100 and 250 candlesticks. The timeframe on the left is M30, on the right - D1. Anything near zero means absence of any "mirroring" for the last X candles [on the average].

As it is, the instruments move similarly, sometimes in the same direction, which is confirmed by periodic correlations. But it is not even cointegrated, which is proved by the non-stationary EURCHF chart (though I can't confirm it unambiguously - I haven't tested it, I think it is senseless).

 
alex12:

Here's a custom-built turkey as described above. Pretty interesting - because = Accurate ( Detects Fractal Patterns correctly).

Here is the code itself:


Thank you! Interesting idea!

It shows on all TFs. But something is wrong with yellow fractal. It is drawn on all TFs at different distances and not the same as on blue.

Please check it!

SetArrow(217, PaleGoldenrod, nm, tm, fractal+4*delta*Point, Width);//?????