# Experts: ComFracti_v2 , Comfracti_final

Moderator
192512

Update 2009.10.25

Author: Mich

16316

Hi mich99

First of all thanks for sharing this nice code. Only two comments. The first, you assume that minimum lot size and increment is 0,1. There are brokers where minimum of 0,01 and increments of 0,01 are allowed.

Second point. When you close the order it's better not to recalculate the lot size, the result could in some ocasions be different from the opening value. It's better to use OrderLots().

OrderClose(OrderTicket(),OrderLots(),MarketInfo(Symbol(),MODE_BID),30,GreenYellow);

Thanks again

16316

Josep:

Hi mich99

First of all thanks for sharing this nice code. Only two comments. The first, you assume that minimum lot size and increment is 0,1. There are brokers where minimum of 0,01 and increments of 0,01 are allowed.

Second point. When you close the order it's better not to recalculate the lot size, the result could in some ocasions be different from the opening value. It's better to use OrderLots().

OrderClose(OrderTicket(),OrderLots(),MarketInfo(Symbol(),MODE_BID),30,GreenYellow);

Thanks again

Yes can you please fix the money management part of this? It only goes .1 then to .6. Be a great EA with that fixed. Thanks

50

metalriff:

Yes can you please fix the money management part of this? It only goes .1 then to .6. Be a great EA with that fixed. Thanks

//-----------------------------------------------------------------------------------------------------------

double LotSize2(){
double lotMM = MathCeil(AccountFreeMargin() * Risk / 1000)/10;

if (!MM) lotMM =lots;
if (lotMM < 0.01) lotMM = lots;
if (lotMM > 1.0) lotMM = MathCeil(lotMM);
if (lotMM > 50) lotMM = 50;
return (lotMM);

//------------------------------------------------------------------------------------------------------------

Hi metalriff.

Try this one.

50

Halo  Gentleman's

In the code are lines 127 and 129 :

if ( Crof(0, sh2)>0 && Crof(60, sh3)>0 && m6<50 && s1>= s2) return(1);

if ( Crof(0, sh4)<0 && Crof(60, sh5)<0 && m6>50 && s1<= s2 ) return(-1);

Iff We change Psar filter condition- like this example :

if ( Crof(0, sh2)>0 && Crof(60, sh3)>0 && m6<50 && s1>Open[0] && s2<Open[0] ) return(1);

if ( Crof(0, sh4)<0 && Crof(60, sh5)<0 && m6>50 && s1<Open[0] && s2>Open[0] ) return(-1);

Results looks much better:)))

note:in this case we can't turn of Psar filter with same parameters for sars1 & sars2.

set file:

mn=65488
mn,F=0
mn,1=88
mn,2=0
mn,3=0
tp=500.00000000
tp,F=0
tp,1=2000.00000000
tp,2=0.00000000
tp,3=0.00000000
sl=1000.00000000
sl,F=0
sl,1=1000.00000000
sl,2=0.00000000
sl,3=0.00000000
TrailingStop=0.00000000
TrailingStop,F=0
TrailingStop,1=200.00000000
TrailingStop,2=100.00000000
TrailingStop,3=1000.00000000
lots=0.10000000
lots,F=0
lots,1=0.10000000
lots,2=0.00000000
lots,3=0.00000000
MM=1
Risk=0.00100000
Risk,F=0
Risk,1=0.50000000
Risk,2=0.00000000
Risk,3=0.00000000
multilot=0.00000000
multilot,F=0
multilot,1=1.00000000
multilot,2=0.00000000
multilot,3=0.00000000
closeby=1
sh2=9
sh2,F=1
sh2,1=2
sh2,2=1
sh2,3=10
sh3=5
sh3,F=1
sh3,1=2
sh3,2=1
sh3,3=10
sh4=10
sh4,F=1
sh4,1=2
sh4,2=1
sh4,3=10
sh5=7
sh5,F=1
sh5,1=2
sh5,2=1
sh5,3=10
per_rsi=6
per_rsi,F=1
per_rsi,1=2
per_rsi,2=1
per_rsi,3=7
sars1=0.00300000
sars1,F=1
sars1,1=0.00200000
sars1,2=0.00100000
sars1,3=0.05000000
sars2=0.00700000
sars2,F=1
sars2,1=0.00200000
sars2,2=0.00100000
sars2,3=0.05000000

16316

Hi Mich99,

Ran the EA with the defaults on the past three months and lost 680 dollars. It only opened one order and lost a bundle. So clearly I am not doing something right. I am not new to programming EAs or even programming but would not consider myself an expert so some things escape me. For example, what is the deal with the set file? My only experience with set files is when you load or save them based on the parameters in the "properties" box. These set files have a lot more parameters than are asked for in the properties box. So clearly I am not doing something right. Saw no arrays so that could not be it... Saw no files being read in so that could not be it... So what am I missing?

50

Hi Vigilanti:)

Easy way to make .set file from posted one is pasted  them in notepad and next exchenge extension from .txt to .set  . Then You can load it from "properties box".

... or in "properties box" mark :Files of type - All Files(*.*) and open what You like.

Note:  settings are for 5 digits brokers. For 4 digits cut of one zero from SL and TP.

16316

mich99:

Hi Vigilanti:)

Easy way to make .set file from posted one is pasted them in notepad and next exchenge extension from .txt to .set . Then You can load it from "properties box".

... or in "properties box" mark :Files of type - All Files(*.*) and open what You like.

Note: settings are for 5 digits brokers. For 4 digits cut of one zero from SL and TP.

HI,

I still donot understand the process,i put notepad file to preset folder and load it,but cannot get results like you did, what's wrong ? if i put the settings manully,which one should i choose to fill in the box,just like this one features :

mn=65488
mn,F=0
mn,1=88
mn,2=0
mn,3=0

thank you

50

Hi  YALEWANG

Choose the first one.

But better run optimization with Yours broker historical dates.

For optimization setings: Maximal drawdown = 50%

4 to 12 months without last one.(Chekt Your history dates)

After that look for best profit with best profit factor and chekt  how it works with last month.

It is simple.

16316

Hello Mich99,

Thank you very for your job but I also have a problem with this EA.

There is never any open order.

I followed the procedure has given Vigilanti without difficulty, but testing with the default settings in the newspaper there are many error messages, for example:

Test Generator: unmatched data error (volume limit 343 at 2009.10.02 18:30 exceeded) this message is repeated many times with date change of course.

CombFracti_V2.1 EUR-USD, M15: invalid price 1.45837000 for OrderSend function

CombFracti_V2.1 EUR-USD, M15: OrderSend error 4107.

Can you help me find a solution?

Domick

50

domick:

Helou:_)

unmatched data error (volume limit 343 at 2009.10.02 18:30 exceeded) -Try download the History of EURUSD.(History center)

invalid price 1.45837000 for OrderSend function -  hmmm... for buy is Ask and Bid for sell.  Don't know why Your mt4 have problem .Which one is Your broker ? Only this EA has problem?

Regards