The regularities of price movements: Part 1. Price orientation - page 11

 
HideYourRichess:
Say a few words about the testing methodology. Did you honestly generate a series of bars and then check external/internal, or were the SB numbers just used?


I already had a pre-prepared random series of 3,000,000 independent bars. The generation mechanism is simple: it's the usual +1 -1 binary wander assembled into bars with an equal number of ticks. Here is the full code in C# (by the way, the algorithm generates phenomenally fast):

/// <summary>
        /// Возвращает случайно сгенерированную серию баров
        /// </summary>
        /// <param name="Сount"> Количество баров</param>
        /// <returns></returns>
        public static Bars GetRandomBars(int Count)
        {
            Bars RandomBars = new Bars("Random Bars", BarScale.Minute, 1);
            Random rnd = new Random();
            byte[] byte_array = new byte[375];
            int open = 100000;
            int close;
            int high;
            int low;
            DateTime first_data = DateTime.Now.AddMinutes(Count * (-1));
            for (int bar = 0; bar < Count; bar++)
            {
                close = open;
                high = open;
                low = open;
                rnd.NextBytes(byte_array);
                BitArray MyBit = new BitArray(byte_array);
                for(int k = 0; k < MyBit.Count; k++)
                {
                    close += MyBit[k] ? 1 : -1;
                    if(close < high && close > low)continue;
                    if(close > high) high = close;
                    else if(close < low) low = close;
                }
                RandomBars.Add(first_data, open, high, low, close, MyBit.Count);
                first_data = first_data.AddMinutes(1);
                open = close;
            }
            SaveBarsToCSV(RandomBars);
            return RandomBars;
        }

Next, the following WL script is run on the resulting chart:

namespace WealthLab.Strategies
{
        public class MyStrategy : WealthScript
        {
                protected override void Execute()
                {
                        int ExBar=0, EnBar=0;
                        for(int bar = 1; bar < Bars.Count; bar++)
                        {
                                if(High[bar] < High[bar-1] && Low[bar] > Low[bar-1])
                                        EnBar++;
                                if(High[bar] > High[bar-1] && Low[bar] < Low[bar-1])
                                        ExBar++;
                        }
                        double percent_ex = Math.Round((double)ExBar /(double)Bars.Count * 100.0, 2);
                        double percent_en = Math.Round((double)EnBar /(double)Bars.Count * 100.0, 2);
                        PrintDebug("Расширение диапозона: " + ExBar + "(" + percent_ex + "%)");
                        PrintDebug("Сужение диапозона: " + EnBar + "(" + percent_en + "%)");
                }
        }
}

The Pareto distribution came out easy too. Instead of a fixed number of ticks I used a EURUSD 5m tick volume. It turns out that each bar quite accurately imitates the volatility of the real EURUSD.
 
poruchik:
I posted it here:)
Senc. Already downloaded...
 
Roman100:
There will be a 50/50 chance of moving one way or the other.

Have you tested it or are you guessing? Let me repeat the question: what are the statistics for the direction of price movement after breaking a tapering triangle in relation to the direction of the volatile (outer) bar? I assume that the direction should be in the opposite direction.
 
C-4:


I already had a pre-prepared random series of 3,000,000 independent bars. The generation mechanism is simple: it's the usual +1 -1 binary wander assembled into bars with an equal number of ticks. Here is the full code in C# (by the way, the algorithm generates phenomenally fast) :

Cool, yeah. And how does this function run from WL? by the way, five or six?
 
C-4:

A test of Paretto-type distribution:

Range widening: 69206(8.04%)
Range narrowing: 68867(8%)

Figures? The probabilities are equal! The version of volatility is not confirmed.

As can be seen, the differences are significant.

This means that the Paretto distribution does not reflect the effects of the real ox. The script is based on the real one and the ratio of inside to outside bars is almost the same as in the real one.
 

Unfortunately I use unlicensed 5. Real-algorithms are traded under Stock C# and there is no need for WL6 license as such. But for research Wealth is almost an ideal platform. You can load anything you want into it.

The WL codes themselves are usually special XML-files with C# code inside them. But you can also use C# dll and corresponding development environments. I test simple ideas directly in WL, while I write special classes in VS2008 in the form of dlls and link them inside the XML wrapper. Here is an example of complete work:

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using WealthLab.MyIndicators;

namespace WealthLab.Strategies
{
        public class MyStrategy : WealthScript
        {
                protected override void Execute()
                {
                        //Получить последовательность из 1000 случайных баров
                        Bars RandomBars = PriceGenerator.GetRandomBars(1000);
                        //Подготовить новое окно чарта.
                        ChartPane RandomPane = CreatePane(50, false, true);
                        //Синхронизировать по времени данные текущего графика с данными RandomBars
                        RandomBars = Synchronize(RandomBars);
                        //Отобразить в виде свечей график случайного блуждания под окном основного инструмента.
                        PlotSymbol(RandomPane, RandomBars, Color.Black, Color.Black);
                }
        }
}

The PriceGenerator class and its GetRandomBars() method are defined in an external dll library with WealthLab.MyIndicators namespace. As a result of this code, another chart appears on the chart showing a random ramp in parallel. Try to do the same in MT4/5 with 4 lines of code:)

 
Avals:

This means that the Paretto-type distribution does not reflect the effects of the real ox. I have given a version of the script where the ox is taken from the real one and the ratio of inside bars to outside bars is almost the same as in the real one.

We will dig. I'll double-check the distribution.
 
gpwr:

Have you tested it or are you guessing? I'll repeat the question: what are the statistics of the direction of price movement after the break of the narrowing triangle in relation to the direction of the volatile (outer) bar? I assume that the direction should be in the opposite direction.

I made some calculations that indirectly show it.
But this is a slightly different formulation of the question)

If the ratio is an absolute summation, then you are right; if it is a quantity ratio, then you are wrong.

I think so... But for the sake of interest it is better to check.

 
poruchik:
Dima, I remembered this thing today - the master candle - 4 candles inside 1
the results are quite favorable
Look at the stats on that one, but there's also a range of p. so 60
Ok, I will look at it later. I am now writing scripts for a new topic - the next part of "Regularities of price movements".
 
DmitriyN:

A very useful topic. Dmitriy, well done!)
Reason: