Phoenix - Development+Suggestions - MQ4 in Post#1 - page 21

 

MM & MaximunRisk

I've searched all of the fhoenix forum for an explanation for how does the risk factor works in phoenix, and thats all I could find:

  1. M6M6: maxrisk uses the account balance to choose lot size. If the balance goes up (Phoenix is winning) then the lotsize goes up automatically.
  2. Mario: About MM - lower number (0.05) lower risk, higher number (you shoud not go over 0.3) higher risk. Don't know in % terms.
  3. Hendrik showed an example (he ran phoenix in both setteings, 0.05 compared to 0.3) back at 10-09-2006, 08:27 PM, but never explained it.
  4. Flikko: For example, if risk=0.2 & money $1000, then first trade will be 0.1 Lot, second trade will be another 0.1 Lot, that will be within the maximum risk.
  5. So, since I've failed to find the answer in the past, I'll ask it again:

  6. What is the correlation between the MM option and the MaximunRisk one? Does the former activates the latter?
  7. Does the risk factor parameter is in fact the % of your un used equity that your EA will invest in this trade?
  8. is the equity that your EA will invest in this trade calculated from your total equity or your unused equity?
  9. Does Phoenix regards as "used equity" only to the funds that it itself invested, or to the total funds invested (By me or other EA's)?

Thank you so much for your time & help.

 

trend recognition indicators

Previously posted by darakanor

I plan to make it "trend aware" in version 6. Any and all recommendations on indicators to recognize trends are appreciated (painting the past after a few days is okay if the indicator knows when to quit real time).

I find these quite useful in some of my different strategies, hope they help.

Files:
 

Potential Bug in 5.7.1 Mode 1

Potential Bug in 5.7.1

Mode 1

GBP/USD

M15

Monday I got cut in a negative trade after it almost T/P at 2 pips from the target. So to prevent that, I activated the setting "U_Mode1_BreakEvenAfterPips" and change the 0 for 25. I also changed the "P_Mode12_TrailingStop" to 25.

The BreakEven is working but nut the Trailing Stop. I feel that the BreakEven as priority over the TralingStop.

Is it a bug or is there something I did not catch ?

 

lot=NormalizeDouble(AccountFreeMargin()*U_MaximumRisk/1000.0,decimalPlaces);

That is the basic calculation from line 954. All it does is take FreeMargin*MaxRisk/1000 to come up with lotsize. There is also "decrease factor" which I don't think anyone uses, and it automatically cuts down on the lotsize based on how many consecutive losses there are.

The default settings have this feature turned off. A value of 1 is ignored (the EA would stop trading), a value of 2 cuts the lotsize in half. The lotsize = lots -lots/decreasefactor.

If anyone wants to use decrease factor I have a few ideas. I'm thinking that this should have a magic number restriction, it should work on buy orders, and it should be percentage based. When we don't have a series of consecutive losses, we probably shouldn't use this.

cre666:
I've searched all of the fhoenix forum for an explanation for how does the risk factor works in phoenix, and thats all I could find:
  1. M6M6: maxrisk uses the account balance to choose lot size. If the balance goes up (Phoenix is winning) then the lotsize goes up automatically.
  2. Mario: About MM - lower number (0.05) lower risk, higher number (you shoud not go over 0.3) higher risk. Don't know in % terms.
  3. Hendrik showed an example (he ran phoenix in both setteings, 0.05 compared to 0.3) back at 10-09-2006, 08:27 PM, but never explained it.
  4. Flikko: For example, if risk=0.2 & money $1000, then first trade will be 0.1 Lot, second trade will be another 0.1 Lot, that will be within the maximum risk.
  5. So, since I've failed to find the answer in the past, I'll ask it again:

  6. What is the correlation between the MM option and the MaximunRisk one? Does the former activates the latter?
  7. Does the risk factor parameter is in fact the % of your un used equity that your EA will invest in this trade?
  8. is the equity that your EA will invest in this trade calculated from your total equity or your unused equity?
  9. Does Phoenix regards as "used equity" only to the funds that it itself invested, or to the total funds invested (By me or other EA's)?
Thank you so much for your time & help.
 
daraknor:
lot=NormalizeDouble(AccountFreeMargin()*U_MaximumRisk/1000.0,decimalPlaces); That is the basic calculation from line 954. All it does is take FreeMargin*MaxRisk/1000 to come up with lotsize.

Why "/1000.0"?

I'd think that it should be devided by the lot# itself (100,000 for a regular account, and 10,000 for a mini one).

Or was it 10.000 (and you talked about a mini account)? In that case what happens with regular accounts?

 

What broker actually uses standard lot sizes of 10,000? I havent traded a mini in a while, but isn't a mini lot 0.1? Also, this formula provides enough result to MAYBE keep you out of trouble, but to accuratly calculate the position size as a percentage of the Account Free Margin, you need to take into account the conversion to your currency type on deposit. Please see the following as an example of how to accomplish accurate MM as a margin% of free margin.

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

cre666:
Why "/1000.0"?

I'd think that it should be devided by the lot# itself (100,000 for a regular account, and 10,000 for a mini one).

Or was it 10.000 (and you talked about a mini account)? In that case what happens with regular accounts?
 
cre666:
Why "/1000.0"?

I'd think that it should be devided by the lot# itself (100,000 for a regular account, and 10,000 for a mini one).

Or was it 10.000 (and you talked about a mini account)? In that case what happens with regular accounts?

cre666:

to take some things upfront:

the kind of "money management" as used here does only work in certain cases, mainly in standart accounts and 1:100 leverage. and it is only accurate when trading a single currency pair.

a setting of MM=false overrides everything. the traded lot size will be as defined by Lots=n. when trading in mode3 it will be further divided by 3.

the account balance and account equity have nothing to do with the calculation. it is solely based on the free margin. the free margin can vary from broker to broker and is a certain %-rate from your balance.

as already mentioned in earlier posts, the key function to determine the lot size is this:

lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,decimalPlaces)

(forget about the NormalizeDouble function for now - it just takes care of some "rounding/normalizing" stuff)

AccountFreeMargin()*MaximumRisk -> calculates the amount of money you want to put at risk to buy or sell 'n' amounts of lots.

the number 1000 comes from 1 lot (which is a $100,000) at a 1:100 leverage. in other words 1 lot needs a $1000 free margin.

let's say the current free margin is $15,000 and you want to trade with 5% risk exposure.

$15,000 * 0.05 / $1,000 = 0.75 lots (but this works only if you have a standart account with a standart lot size and a 1:100 leverage)

0.75 lots require $750 of you margin which is 5% of $15,000

if you trade a mini account, where the lot size is "only" $10,000 and you trade with 1:200 the formula need to be changed.

to trade one lot at 1:200 leverage you would need $50 ($10,000 / 200).

with a free margin of $7,000 and 20% risk exposure, the math looks like this: $15,000*0.2/$50=28 lots

28 lots require 28*$50=$1400 which is 20% of $7k.

one of my "test" accounts is a mini account (lot size = $10,000) and i trade with 1:100 leverage. right now it has a free margin of $5650 and i trade it with a 10% risk exposure.

according to the original formula 5650*0.1/1000=0.57 lots (the normalizedouble funtion rounds to 0.6), the EA trades with 0.6 lots which is going to eat $60 of my free margin.

but $60 is not 10% of $5650 ! why?

because of the incorrect function call. the margin requirement per lot is not $1000, it is only $100 (remember: $10000 lot size at 1:100 = $100)

for my situation i had to change the function to lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/100.0,decimalPlaces)

the correct amount of lots has to be 10 times higher since the size of each lot is 10 times smaller -> $5650 * 0.1 / 100 = 5.7, which in turn

equal to a margin requirement of 5.7*$100 = $570 and this is 10% of my free margin.

now, since i am trading 5 different currencies at a time i really should divide the calculated lots by 5 to make it perfect.

otherwise the first currency in trade gets the full allocation (10% of free margin), the second gets 10% of what is left after the first and so on until everything is used up.

i hope i didn't confuse you completely and you were able follow my thoughts.

(if i made any mistakes, please correct me!!)

AZBOfin

 
 

Great help

AZBOfin:
i hope i didn't confuse you completely and you were able follow my thoughts. AZBOfin

Not at all AZBOfin, great explanation, very precise, very erudite. You have set everything straight.

Nicholishen - Thanks for that importent addition.

Am I to understand that each EA have a different grasp of the notion "risk" thus calculating it in a diferent way? Thats trouble.

Programers - will you consider making the account size & leverage an external option, so we won't make stupid mistakes with MM?

 
m6m6:
Potential Bug in 5.7.1

Mode 1

GBP/USD

M15

Monday I got cut in a negative trade after it almost T/P at 2 pips from the target. So to prevent that, I activated the setting "U_Mode1_BreakEvenAfterPips" and change the 0 for 25. I also changed the "P_Mode12_TrailingStop" to 25.

The BreakEven is working but nut the Trailing Stop. I feel that the BreakEven as priority over the TralingStop.

Is it a bug or is there something I did not catch ?

The BE code didn't care what the value was, and it executed twice. You are correct, it was overriding the TS code. Having both settings with the same value is redundant since the TS would make the system do BE SL once the profit hit 25 pip. 26 pip profit should have 1 pip SL, but BE sets it back to 0pip SL as you noticed. To get the intended functionality, you should just turn off BE setting and only use the TS.

I incorporated some fixes into my 5.7.2 development version corrects this behavior by default. Should I release these minor fixes?

Reason: