Cost Averaging System - page 25

 
Maji:
Aaragorn, I am sorry, but I will have to say that your code has be perplexed. I can't think complicated things too much, so that is the problem. I think you are complicating a simple matter. Trading can't be that complicated. Think simple, and keep things simple.

No argument there. However there is nothing more basic to trading than simple support and resistance. Check your email I sent you the full version of what I'm doing so you can see it in context. Actually it IS simple. I'm just up against a programming task that I don't know how to do at the end. That is consolidating the data that I have generated into a histogram...I have now attempted three approaches to doing it none of which work because I don't know what I'm doing to make a histogram. You do know what a histogram is and what I mean when I say I'm trying to make a histogram don't you? It's not that I am complicating anything of the strategy what I am struggling with is the complexities of making a histogram when I really am not that competent a programmer.

here is yet another attempt on my part to do it.

https://www.mql5.com/en/forum/174700/page73

 

similar result

@ tomstaufer:

I saw your testing in Cost Averaging RSI with Trend v3 TEST4, TEST5, TEST6 give similar result.... its very interesting

CMIIW, I guess your setting for trailing stop 50pips is useless, if you just set 20pips take profit...

dedywind

 
Pecunia non olet:
Does this resemble what you're trying to do at all?

https://www.mql5.com/en/forum/173721

or this?

https://www.mql5.com/en/forum/173721

I'm pretty sure they're somewhat different from what you've described, but maybe they'll give you some ideas. I hope it helps!

those look interesting but no that's not what I'm after. I do appreciate your effort to assist me, thanks.

Perhaps I could express what I need to accomplish another way and any developers could come up with their own way to do it....

Here are the conditions and the goal....

I have 4 arrays of data Opens and Closes and OpenMatches and CloseMatches

when the array size is defined as 50 they give this result (note that the 50th value is the array index value of zero which needs to be excluded)

Open 1.2691Matches:4 Close 1.269Matches:4

Open 1.2695Matches:4 Close 1.269Matches:4

Open 1.2686Matches:2 Close 1.2694Matches:3

Open 1.2717Matches:17 Close 1.2685Matches:2

Open 1.2718Matches:13 Close 1.2718Matches:13

Open 1.2712Matches:2 Close 1.2717Matches:17

Open 1.2715Matches:8 Close 1.2711Matches:4

Open 1.2719Matches:8 Close 1.2714Matches:2

Open 1.271Matches:4 Close 1.272Matches:8

Open 1.2711Matches:4 Close 1.2711Matches:4

Open 1.2717Matches:17 Close 1.2712Matches:2

Open 1.2717Matches:17 Close 1.2716Matches:15

Open 1.2725Matches:13 Close 1.2716Matches:15

Open 1.273Matches:8 Close 1.2724Matches:13

Open 1.2729Matches:11 Close 1.2729Matches:11

Open 1.2725Matches:13 Close 1.2728Matches:10

Open 1.272Matches:8 Close 1.2724Matches:13

Open 1.2717Matches:17 Close 1.2721Matches:10

Open 1.2716Matches:15 Close 1.2716Matches:15

Open 1.2717Matches:17 Close 1.2717Matches:17

Open 1.2717Matches:17 Close 1.2716Matches:15

Open 1.2722Matches:11 Close 1.2716Matches:15

Open 1.2725Matches:13 Close 1.2723Matches:12

Open 1.2722Matches:11 Close 1.2724Matches:13

Open 1.2722Matches:11 Close 1.2723Matches:12

Open 1.2725Matches:13 Close 1.2721Matches:10

Open 1.2724Matches:13 Close 1.2726Matches:11

Open 1.2726Matches:11 Close 1.2723Matches:12

Open 1.2721Matches:10 Close 1.2725Matches:13

Open 1.273Matches:8 Close 1.272Matches:8

Open 1.273Matches:8 Close 1.2729Matches:11

Open 1.2728Matches:10 Close 1.2729Matches:11

Open 1.2722Matches:11 Close 1.2729Matches:11

Open 1.2726Matches:11 Close 1.2723Matches:12

Open 1.2726Matches:11 Close 1.2727Matches:9

Open 1.2728Matches:10 Close 1.2727Matches:9

Open 1.2736Matches:1 Close 1.2734Matches:1

Open 0Matches:0 Close 0Matches:0

[/PHP]

The goal is to eliminate the duplications in these so that each opening and closing value appears only once AND as new matches occur to update the matches appropriately.

How do we do that? The first step is to remove the duplicates...

Open 1.2763Matches:6 Close 1.2765Matches:2

Open 1.2767Matches:3 Close 1.2762Matches:8

Open 1.2762Matches:8 Close 1.2766Matches:3

Open 1.2768Matches:3 Close 1.2761Matches:6

Open 1.2771Matches:2 Close 1.2769Matches:2

Open 1.2761Matches:6 Close 1.2772Matches:2

Open 1.2718Matches:13 Close 1.2762Matches:8

Open 1.2704Matches:2 Close 1.2719Matches:8

Open 1.2698Matches:2 Close 1.2703Matches:2

Open 1.2696Matches:4 Close 1.2697Matches:3

Open 1.2691Matches:4 Close 1.2695Matches:4

Open 1.2695Matches:4 Close 1.269Matches:4

Open 1.2686Matches:2 Close 1.2694Matches:3

Open 1.2712Matches:2 Close 1.2685Matches:2

Open 1.2715Matches:8 Close 1.2718Matches:13

Open 1.2719Matches:8 Close 1.2717Matches:17

Open 1.271Matches:4 Close 1.2711Matches:4

Open 1.2711Matches:4 Close 1.2714Matches:2

Open 1.2729Matches:11 Close 1.272Matches:8

Open 1.272Matches:8

Open 1.2716Matches:15 Close 1.2712Matches:2

Open 1.2717Matches:17 Close 1.2716Matches:15

Open 1.2725Matches:13 Close 1.2724Matches:13

Open 1.2724Matches:13 Close 1.2729Matches:11

Open 1.2721Matches:10 Close 1.2728Matches:10

Open 1.273Matches:8 Close 1.2724Matches:13

Open 1.2722Matches:11 Close 1.2721Matches:10

Open 1.2726Matches:11 Close 1.2716Matches:15

Open 1.2728Matches:10 Close 1.2726Matches:11

Open 1.2736Matches:1 Close 1.2725Matches:13

Close 1.2723Matches:12

Close 1.2727Matches:9

Close 1.2734Matches:1

[/PHP]

further we can cull values which are the same for opens and closes since we only need to express each unique price level once...

Open 1.2763Matches:6 Close 1.2765Matches:2

Open 1.2767Matches:3

Open 1.2762Matches:8 Close 1.2766Matches:3

Open 1.2768Matches:3 Close 1.2769Matches:2

Open 1.2771Matches:2 Close 1.2772Matches:2

Open 1.2761Matches:6

Open 1.2718Matches:13

Open 1.2704Matches:2 Close 1.2703Matches:2

Open 1.2698Matches:2 Close 1.2697Matches:3

Open 1.2696Matches:4

Open 1.2691Matches:4 Close 1.269Matches:4

Open 1.2695Matches:4 Close 1.2694Matches:3

Open 1.2686Matches:2 Close 1.2685Matches:2

Open 1.2712Matches:2

Open 1.2715Matches:8

Open 1.2719Matches:8 Close 1.2714Matches:2

Open 1.271Matches:4

Open 1.2711Matches:4

Open 1.2729Matches:11

Open 1.272Matches:8 Close 1.2723Matches:12

Open 1.2716Matches:15 Close 1.2727Matches:9

Open 1.2717Matches:17 Close 1.2734Matches:1

Open 1.2725Matches:13

Open 1.2724Matches:13

Open 1.2721Matches:10

Open 1.273Matches:8

Open 1.2722Matches:11

Open 1.2726Matches:11

Open 1.2728Matches:10

Open 1.2736Matches:1

[/PHP]

when combining all duplicates of both opens and closes we forget about opens and closes and end up with this histogram, of course I also sorted it descendingly according to price level.

Price Level: 1.2772 Matches: 2

Price Level: 1.2769 Matches: 2

Price Level: 1.2766 Matches: 3

Price Level: 1.2765 Matches: 2

Price Level: 1.2736 Matches: 1

Price Level: 1.2734 Matches: 1

Price Level: 1.273 Matches: 8

Price Level: 1.2729 Matches: 11

Price Level: 1.2728 Matches: 10

Price Level: 1.2727 Matches: 9

Price Level: 1.2726 Matches: 11

Price Level: 1.2725 Matches: 13

Price Level: 1.2724 Matches: 13

Price Level: 1.2723 Matches: 12

Price Level: 1.2722 Matches: 11

Price Level: 1.2721 Matches: 10

Price Level: 1.272 Matches: 8

Price Level: 1.2719 Matches: 8

Price Level: 1.2717 Matches: 17

Price Level: 1.2716 Matches: 15

Price Level: 1.2715 Matches: 8

Price Level: 1.2714 Matches: 2

Price Level: 1.2712 Matches: 2

Price Level: 1.2711 Matches: 4

Price Level: 1.271 Matches: 4

Price Level: 1.2703 Matches: 2

Price Level: 1.2698 Matches: 2

Price Level: 1.2697 Matches: 3

Price Level: 1.2696 Matches: 4

Price Level: 1.2695 Matches: 4

Price Level: 1.2694 Matches: 3

Price Level: 1.2691 Matches: 4

Price Level: 1.269 Matches: 4

Price Level: 1.2686 Matches: 2

Price Level: 1.2685 Matches: 2

[/PHP]

from this it is easy to see that the strongest support/resistance line by virtue of how many times either the market closed or opened at this level in the last 50 hours is 1.2717 and 1.2716 is nearly as strong. There is also a strong line at 1.2724 and 1.2725

does that make sense now?

now...if you can figure out how to get the code to do everything I just did manually in excel then that is what I'm looking for.

Once the histogram is populated I want it to update the match values and if necessary add a new price level if it doesn't already exist in the histogram, when each new open and close occurs.

MY thinking, which may or may not be the best way to do this is to first make a two dimensional array which contains the levels and matches. This goes beyond what I know how to do. I'm studying the topic now. As near as I can tell...

1. everything has to be intergers. so...

TotalOMatches = OpenOMatches + OpenCMatches;

TotalCMatches = CloseOMatches + CloseCMatches;

OpensInt = Opens*10000;

ClosesInt = Closes*10000;

[/PHP]

the matches are already intergers so they are fine, the opens and closes can be made intergers like above so that's fine. Now what I don't understand is how to pass the values into the two dimensional array.

I think I define it like this...

#define SIZE 50 // must be set to match NumberOfBars

static int Index = 0;

static double OpenLevelsandMatches[1] = { 0 };

static double CloseLevelsandMatches[1] = { 0 };[/PHP]

which I believe will give me 50 fields and 2 columns each according to this

http://www.metatrader.info/node/161

now assuming that is true then my question is how do I fill the fields in the array?

OpenLevelsandMatches[1] = OpensInt TotalOMatches;

nope the compiler doesn't like that...

[PHP]OpenLevelsandMatches[1] = OpensInt, TotalOMatches;

nope not that either...

[PHP]OpenLevelsandMatches[1] = [OpensInt TotalOMatches];

nope the compiler hates that...

[PHP]OpenLevelsandMatches[1] = [OpensInt, TotalOMatches];

nope the compiler hates that...

[PHP]OpenLevelsandMatches[1] = (OpensInt TotalOMatches);

nope not that either...

[PHP]OpenLevelsandMatches[1] = (OpensInt, TotalOMatches);

nope not that either...

[PHP]OpenLevelsandMatches[1] = OpensInt && TotalOMatches;

hey that actually compiles!! I wonder if it did it?

 

this...

TotalOMatches = OpenOMatches + OpenCMatches;

TotalCMatches = CloseOMatches + CloseCMatches;

OpensInt = Opens*10000;

ClosesInt = Closes*10000;

OpenLevelsandMatches[1] = OpensInt && TotalOMatches;

Print("Bar: ",i4," Opens: ",Opens," Total Open Matches: ",TotalOMatches);

//Print ("Bar: ",i4," Closes: ",Closes," Total Close Matches: ",TotalCMatches);

Print(OpenLevelsandMatches[1]);

[/PHP]

gives me this..

[PHP]

Support and Resistance EURUSDm,H1: 0

Support and Resistance EURUSDm,H1: Bar: 47 OpensInt: 12688 Opens: 1.2688 Total Open Matches: 6

Support and Resistance EURUSDm,H1: 0

Support and Resistance EURUSDm,H1: Bar: 48 OpensInt: 12699 Opens: 1.2699 Total Open Matches: 4

Support and Resistance EURUSDm,H1: 0

Support and Resistance EURUSDm,H1: Bar: 49 OpensInt: 12700 Opens: 1.27 Total Open Matches: 3

Support and Resistance EURUSDm,H1: 0

Support and Resistance EURUSDm,H1: Bar: 50 OpensInt: 0 Opens: 0 Total Open Matches: 0

so I know the information is there it's just still not making it into the two dimensional array.

 

if anyone wonders why I'm so persistent about this support and resistance work it's because I believe it will be like this..

http://www.212movie.com/

is there a better way to do this than a two dimensional array? hummmm what if I concatenate?

ok that at least ties the levels and matches together as long as I remember that the value before the decimal is the level*10000 and the value after the decimal is the matches..

2006.11.01 12:36:48 2006.10.02 15:39 Support and Resistance EURUSDm,H1: Bar: 45 Concat: 12698.5 OpensInt: 12698 Opens: 1.2698 Total Open Matches: 5

2006.11.01 12:36:48 2006.10.02 15:39 Support and Resistance EURUSDm,H1: Bar: 46 Concat: 12688.6 OpensInt: 12688 Opens: 1.2688 Total Open Matches: 6

2006.11.01 12:36:48 2006.10.02 15:39 Support and Resistance EURUSDm,H1: Bar: 47 Concat: 12699.4 OpensInt: 12699 Opens: 1.2699 Total Open Matches: 4

2006.11.01 12:36:48 2006.10.02 15:39 Support and Resistance EURUSDm,H1: Bar: 48 Concat: 12700.4 OpensInt: 12700 Opens: 1.27 Total Open Matches: 4

2006.11.01 12:36:48 2006.10.02 15:39 Support and Resistance EURUSDm,H1: Bar: 49 Concat: 12719.1 OpensInt: 12719 Opens: 1.2719 Total Open Matches: 1

2006.11.01 12:36:48 2006.10.02 15:39 Support and Resistance EURUSDm,H1: Bar: 50 Concat: 0.0 OpensInt: 0 Opens: 0 Total Open Matches: 0

next, let's see...I need to get all the opens and closes in the same place and eliminate duplicate levels...

 

Ebay and Copyright

http://pages.ebay.com/help/policies/copyrights.html

At the bottom of this page is a link to report people for copyright violation. They face the following penalties:

Listing cancellation

Limits on account privileges

Account suspension

Forfeit of eBay fees on cancelled listings

Loss of PowerSeller status

Additionally, damages may be charged to citizens in any country that signed the Berne Convention. Software piracy is encouraged in some cultures, but the piracy is limited to freely distributing overcharged software. There are no people that encourage stealing something that is free so you can sell it.

I am considering starting a separate thread for people to find copyright violations of forex materials (code and Ebooks) on Ebay and close them down. Additionally, we may contact the copyright holders, and present them with the necessary information from Ebay to collect the funds earned, legal fees, and copyright violation fees. Volunteers would likely earn nothing for doing this, but we could show authors like Maji, Hendrick and others that we appreciate their efforts. Anyone interested?

 

Forward testing

I am forward testing the latest EA as emailed with the default settings.

Cost Avge RSI with Trend v1 Here are this week's results to date using M15 TF

I am also continuing to test Cost Averaging v3 Pyramid and posted is this week's results with default settings and using M1 TF

John

 

Cost Averaging RSI with Trend v3 tests with default settings

dedywind:
@ tomstaufer:

I saw your testing in Cost Averaging RSI with Trend v3 TEST4, TEST5, TEST6 give similar result.... its very interesting

CMIIW, I guess your setting for trailing stop 50pips is useless, if you just set 20pips take profit...

dedywind

Yes, you are right. I just wanted to run it for 1 week with default settings and see what happens. I will post my results on Friday AMC. Then I would like other members to take a look and suggest parameters changes.

Thanks.

 
Maji:
Absolutely sir. I have dropped everything that I have to do and am at your service. Now, how are you going to reward me for my humble services?

hallo and thank to you for sharing this EAs i knew you to be helpful. for all this i will pm you a zip up file of over 1000 very exell indicatore you may use in you new EA futures. many trader will have happy greeting on these news and will eat good when cash comes from you EA. may i have also all code to go with these EA so you not bother with peoples of usages

 

Ok i've got it down to this....

One array which contains concatenated values for both variables linked together AND they are partially filtered for being unique. What that means is that they are values which are openings which are not equal to closes. That means that the only remaining duplicates are for the values which were duplicated in the openings themselves. So all that remains to end up with a unique list is to filter out the duplicates which are duplicated within the openings... and they are all in one array.

As for the showing appreciation to developers? I'm all for it, I accept tips.