MidPoint statistics - surprising results!

never design a trading system without proper prior analysis. post your market statistics here

Moderator: moderators

moneymarkets
rank: <50 posts
rank: <50 posts
Posts: 13
Joined: Mon May 22, 2006 12:52 am
Reputation: 0
Gender: Male

Postby moneymarkets » Sat Jun 03, 2006 5:09 pm

Thanks for all the work you have done.
I downloaded your 3D Zone Stats and got a file append function error?
Thanks for your help.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Postby michal.kreslik » Sat Jun 03, 2006 10:08 pm

Moneymarkets,

have a look at the iFileFolder parameter within the code. By default, it is set to "c:\data\temp".

If that directory doesn't exist, you'll get a file append function error when you apply the program to a chart.

Either create this directory on your disk or change the value so that it points to an existing directory.

I've chosen not to declare these variables as inputs since there are other variables that must be changed manually as well since the EasyLanguage doesn't support multidimensional dynamic arrays neither it supports the array boundary declaration via input.

You're welcome. Have a very nice day!

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 11430
Joined: Sun May 14, 2006 9:31 pm
Reputation: 45
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Sat Jun 03, 2006 10:34 pm

Michal:

Thanks.

However, I don't know the answer to the question.

I wanted a simple answer.

I only want to consider the midpoint... not 3 zones.

So, for the EURUSD 60 minute interval, if it closes above the middle, what is the "probability" it will close above the middle again?

Ditto for the 15 minute interval.

Thanks.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!

Please do NOT PM me with trading or coding questions, post them in a thread.

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 11430
Joined: Sun May 14, 2006 9:31 pm
Reputation: 45
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Sat Jun 03, 2006 11:06 pm

Michal:

You have 3D but you don't have separate statistics for above/below the middle!

I am sure the stats will be different for above/below.

That's part of the "edge" I am looking for.

You have some coding to do, my friend :smt003
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!



Please do NOT PM me with trading or coding questions, post them in a thread.

User avatar
heyen
rank: <50 posts
rank: <50 posts
Posts: 20
Joined: Fri May 19, 2006 10:41 am
Reputation: 0
Location: Germany
Gender: Male

Zone divider

Postby heyen » Sat Jun 03, 2006 11:08 pm

Hello Folks,

there is one problem to the statistic:

3 consecutive same bars (equal H,L,C) will show up as 3 consecutive positive or negativ bars, but the price itself did not change over time (only within the bars).

i recommend rerunnig using the previous close instead the midpoint as reference. H & L will only be known after the bars is closed. Also only previous H & L should be referenced to avoid "lookoing into the future".

Sorry Avery, this remained unnoticed in the StockFetcher Forum.

But after all this work i had to point that out!

Thomas

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Postby michal.kreslik » Sat Jun 03, 2006 11:34 pm

TheRumpledOne wrote:Michal:

Thanks.

However, I don't know the answer to the question.

I wanted a simple answer.

I only want to consider the midpoint... not 3 zones.

So, for the EURUSD 60 minute interval, if it closes above the middle, what is the "probability" it will close above the middle again?

Ditto for the 15 minute interval.

Thanks.


Avery,

You can export the coveted results from the 3D stats easily.

OK, I will gift-wrap the values just because it's you, Avery:
Attachments
15min_60min_EURUSD_50-Zone.png
15min_60min_EURUSD_50-Zone.png (20.1 KiB) Viewed 1395 times

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Postby michal.kreslik » Sat Jun 03, 2006 11:42 pm

TheRumpledOne wrote:Michal:

You have 3D but you don't have separate statistics for above/below the middle!

I am sure the stats will be different for above/below.

That's part of the "edge" I am looking for.

You have some coding to do, my friend :smt003


Avery, there's an assumption the price behavior is symmetric:

Michal wrote:For the research to be valid with my algorithm that tracks only absolute Zone changes instead of upper to lower / lower to upper Zone change, we assume that the price behaviour in this respect is symmetric, i.e. there's no significant statistical difference between the tendency to change from the upper Zone to the lower Zone and the tendency to change from the lower Zone to the upper Zone.


There's no reason to believe the price behaves asymetrically in this respect (i.e. that there's a higher tendency towards changing from the upper Zone to the lower one than the other way round)

Stop scaring me, no more MidPoint coding ](*,)

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Re: Zone divider

Postby michal.kreslik » Sun Jun 04, 2006 1:25 am

heyen wrote:Hello Folks,

there is one problem to the statistic:

3 consecutive same bars (equal H,L,C) will show up as 3 consecutive positive or negativ bars, but the price itself did not change over time (only within the bars).

i recommend rerunnig using the previous close instead the midpoint as reference. H & L will only be known after the bars is closed. Also only previous H & L should be referenced to avoid "lookoing into the future".

Sorry Avery, this remained unnoticed in the StockFetcher Forum.

But after all this work i had to point that out!

Thomas



Thomas,

you may use a slightly modified original 2D Zone stats code to export the "close Zone" data:

Code: Select all

{
   program name: 2DZone statistics
   last change: Jun/04/2006
   version: 3.22
   author: Michal Kreslik
   email: michal.kreslik @ kreslik.com
   website: http:// kreslik.com
   comments: prints 2D Zone statistics
}


{ ***** begin settings ***** }

vars: { inputs }
   iZonePercent( 30 ),
   { -infinity to +50% }

   iMinNumOfCases( 50 ),
   { minumim number of observations to deem the results statistically significant }   

   iPercentDecPrecision( 2 ),
   { number of decimal places to use for the export of % proabbilities }   

   iPrintToOutputBar( true ),
   { print the results to output bar? }

   iPrintToFile( true ),
   { print the results to file? }
   iAppendMode( false ),
   { if set to true, then append the results to the existing file
   if set to false, create a brand new file for every test }
   iFileFolder( "c:\data\temp" );
   { directory to save the resulting files(s) to }

{ ***** end settings ***** }


{ ***** begin global declarations ***** }
   
vars: { numerical variables }
   nUpperZoneBoundary( 0 ),
   nLowerZoneBoundary( 0 ),
   nZoneState( 0 ),
   nZoneStayCounter( 0 ),
   nMaxBarsInZone( 0 );

vars: {string variables }
   sStartDate( "" );

vars: { boolean variables }
   bZoneAbandoned( false ),
   bRunStats( false ),
   intrabarpersist bFirstRun( true );

arrays: { array variables }
   anCasesOfAbandonment[]( 0 ),
   anCasesOfStay[]( 0 );

{ ***** end global declarations ***** }


{ ***** begin collecting data ***** }

bZoneAbandoned = false;

{
nUpperZoneBoundary = high - (high - low)*iZonePercent/100;
nLowerZoneBoundary = low + (high - low)*iZonePercent/100;}

nUpperZoneBoundary = close;
nLowerZoneBoundary = close;


if close > nUpperZoneBoundary[1] then
      nZoneState = 1
   else if close < nLowerZoneBoundary[1] then
         nZoneState = -1
      else if close >= nLowerZoneBoundary[1] AND close <= nUpperZoneBoundary[1] then
            nZoneState = 0;

if nZoneState <> nZoneState[1] then
   begin
      bZoneAbandoned = true;
      nZoneStayCounter = 1;
   end
else
   nZoneStayCounter = nZoneStayCounter + 1;

if bRunStats = false
   AND bZoneAbandoned
   AND nZoneState <> 0
   AND   BarNumber > 1 then
      begin
         bRunStats = true;
         sStartDate = DateToString(DateToJulian(date));
      end;

if bRunStats[1] AND nZoneState[1] <> 0 then
   begin
      nMaxBarsInZone = MaxList(nMaxBarsInZone, nZoneStayCounter[1]);

      if nMaxBarsInZone > nMaxBarsInZone[1] then
         begin
            Array_SetMaxIndex(anCasesOfAbandonment, nMaxBarsInZone);
            Array_SetMaxIndex(anCasesOfStay, nMaxBarsInZone);
         end;

      if bZoneAbandoned then
         anCasesOfAbandonment[nZoneStayCounter[1]] = anCasesOfAbandonment[nZoneStayCounter[1]] + 1
      else
         anCasesOfStay[nZoneStayCounter[1]] = anCasesOfStay[nZoneStayCounter[1]] + 1;
   end;

{ ***** end collecting data ***** }
   

{ ***** begin analysis ***** }
   
if LastBarOnChart AND bFirstRun AND iZonePercent <= 50 then
   begin
      bFirstRun = false;


      { ***** begin local declarations ***** }

      vars: { numerical variables }
         vTotalRows( 0 ),
         vTotalCases( 0 );

      vars: { string variables }
         sTimeFrame( "" ),
         sFileName( "" ),
         sNotValid( "" );

      vars: { boolean & temp variables }
         bStatValidResults( false ),            
         tIndex( 0 );

      arrays: { array variables }
         asTimeFrames[4]( "" ),
         asHeaderRows[]( "" );

      { ***** end local declarations ***** }


      { ***** begin set up the strings *****}

      asTimeFrames[0] = NumToStr(BarInterval, 0) + "_ticks";
      asTimeFrames[1] = NumToStr(BarInterval, 0) + "_min";
      asTimeFrames[2] = "daily";
      asTimeFrames[3] = "weekly";
      asTimeFrames[4] = "monthly";
      sTimeFrame = asTimeFrames[datacompression];
   
      vTotalRows = 9;
      Array_SetMaxIndex(asHeaderRows, vTotalRows);   


      asHeaderRows[1] = "2DZone statistics by michal.kreslik @ kreslik.com";
      asHeaderRows[2] = "Zone %: " + NumToStr(iZonePercent, 0);
      asHeaderRows[3] = "Total bars examined: " + NumToStr(BarNumber, 0);
      asHeaderRows[4] = "Time period: " + sStartDate + " to " + DateToString(DateToJulian(date));
      asHeaderRows[5] = "Exchange: " + GetExchangeName;
      asHeaderRows[6] = "Symbol: " + GetSymbolName;
      asHeaderRows[7] = "Timeframe: " + sTimeFrame;
      asHeaderRows[8] = "Stat. validity - min # of cases setting: "
         + NumToStr(iMinNumOfCases, 0);
      asHeaderRows[9] = "cons.bars,zone abandoned %,zone retained %,zone abandoned #,zone retained #";


      sNotValid = "ERROR: no statistically valid results! "
         + "Load more bars or decrease the minimum cases value "
         + "for a statistical validity.";

      { ***** end set up the strings *****}
         

      { ***** begin print to output bar section ***** }
         
      if iPrintToOutputBar then
         begin
            ClearPrintLog;               
            bStatValidResults = false;

            for tIndex = 1 to vTotalRows
               begin
                  Print(asHeaderRows[tIndex]);
               end;

               for tIndex = 1 to nMaxBarsInZone
                  begin
                     vTotalCases = anCasesOfAbandonment[tIndex] + anCasesOfStay[tIndex];
                     if  vTotalCases >= iMinNumOfCases then
                        begin
                           bStatValidResults = true;
                           Print(NumToStr(tIndex, 0), " ",
                                 NumToStr(anCasesOfAbandonment[tIndex]/vTotalCases*100, iPercentDecPrecision), " ",
                                 NumToStr(anCasesOfStay[tIndex]/vTotalCases*100, iPercentDecPrecision), " ",
                                 NumToStr(anCasesOfAbandonment[tIndex], 0), " ",
                                 NumToStr(anCasesOfStay[tIndex], 0));
                        end;
                  end;
                  if bStatValidResults = false then
                     Print(sNotValid);
         end;


      { ***** end print to output bar section ***** }


      { ***** begin print to file section ***** }
               
      if iPrintToFile then
         begin
            bStatValidResults = false;      

            if iAppendMode then
                  sFileName = iFileFolder + "" + "Zone_Statistics.csv"
               else
                  begin
                     sFileName = iFileFolder
                        + ""
                        + GetSymbolName + "_"
                        + sTimeFrame + "_"
                        + "statistics.csv";

                     FileDelete(sFileName);
                  end;
            
            for tIndex = 1 to vTotalRows
               begin
                  FileAppend(sFileName, asHeaderRows[tIndex] + NewLine);
               end;

               for tIndex = 1 to nMaxBarsInZone
                  begin
                     vTotalCases = anCasesOfAbandonment[tIndex] + anCasesOfStay[tIndex];
                     if vTotalCases >= iMinNumOfCases then
                        begin
                           bStatValidResults = true;
                           FileAppend(sFilename, NumToStr(tIndex, 0) + ","
                              + NumToStr(anCasesOfAbandonment[tIndex]/vTotalCases*100, iPercentDecPrecision) + ","
                              + NumToStr(anCasesOfStay[tIndex]/vTotalCases*100, iPercentDecPrecision) + ","
                              + NumToStr(anCasesOfAbandonment[tIndex], 0) + ","
                              + NumToStr(anCasesOfStay[tIndex], 0) + NewLine);
                        end;
                  end;
               if bStatValidResults = false then
                  FileAppend(sFileName, sNotValid + NewLine);
               FileAppend(sFileName, NewLine);
         end;

      { ***** end print to file section ***** }


   end;

{ ***** end analysis ***** }



The results for EURUSD 15 min & EURUSD 60 min:
Attachments
close_Zone.png
close_Zone.png (15 KiB) Viewed 1390 times

Ali Son
rank: 150+ posts
rank: 150+ posts
Posts: 179
Joined: Sun May 28, 2006 1:30 am
Reputation: 0
Location: Boston, MA
Gender: None specified

Postby Ali Son » Tue Jun 06, 2006 11:43 am

Please explain the results without jargon. I know somoene mentioned results might be better looking at the close for some reason or other, but I thought this exercise was to see the predictive dynamics of the midpoint in terms of trend direction and trend continuation. Also, Why not also post the results for a couple of the other popular major currency pairs?


OPTIONSWINGS

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Postby michal.kreslik » Tue Jun 06, 2006 12:02 pm

Ali,

I guess the results on the graphs are pretty self-explanatory. There's nothing mysterical to that.

Also, I couldn't post every single combination of timeframe/symbol since that would take up too much space. You are free to run the Zone stats code on your charts by yourself and post any results you deem interesting here.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “statistics”