Quote:
|
Originally Posted by Hendrick
Hi Salty!
Yes, I think your idea makes sense. Anyone else has opinion about this?
|
Dear Hendrick,
About the lot calculation for Money Management, I think if Phoenix run for USDJPY for risk 0.3 and GBPJPY for risk 0.3, then the trade amount for $10,000 account is 3 Lot for each. Currently Phoenix 5 doesn't open the same lot for second trade. It is true, it is not based on free margin.
But there is one thing should be taken into consideration is Leverage.
I copy and paste the code from Cyberia EA, which is actually quite good in determining number of lots open. You can place Phoenix into many Currencies, but perhaps only 2 order open at the same time. (SymbolCounts=2)
PHP Code:
S = (AccountBalance()* Risk - AccountMargin()) * AccountLeverage() /
(SymbolsCount - OrdersTotal());
The code is using OrderTotal(), however this may need to be changed, because Phoenix may open 5 trades for 1 currency!!
And I think you may need more "Risk" variables for each of classic, double trade and 123.
PHP Code:
int CyberiaLots()
{
GetMarketInfo();
// Sum of the calculation
double S;
// Cost of the lot
double L;
// Lot quantity
double k;
// Cost of one pip
if( AutoLots == true )
{
if(SymbolsCount != OrdersTotal())
{
S = (AccountBalance()* Risk - AccountMargin()) * AccountLeverage() /
(SymbolsCount - OrdersTotal());
}
else
{
S = 0;
}
// We check, does currency appear to be EURUSD?
if(StringFind( Symbol(), "USD") == -1)
{
if(StringFind( Symbol(), "EUR") == -1)
{
S = 0;
}
else
{
S = S / iClose ("EURUSD", 0, 0);
if(StringFind( Symbol(), "EUR") != 0)
{
S /= Bid;
}
}
}
else
{
if(StringFind(Symbol(), "USD") != 0)
{
S /= Bid;
}
}
S /= ModeLotSize;
S -= ModeMinLot;
S /= ModeLotStep;
S = NormalizeDouble(S, 0);
S *= ModeLotStep;
S += ModeMinLot;
Lots = S;
if (Lots>MAXLots){ Lots=MAXLots; }
if(ShowLots == True)
Print ("Lots:", Lots);
}
return (0);
}
int GetMarketInfo()
{
ModeLow = MarketInfo(Symbol(), MODE_LOW);
ModeHigh = MarketInfo(Symbol(), MODE_HIGH);
ModeTime = MarketInfo(Symbol(), MODE_TIME);
ModeBid = MarketInfo(Symbol(), MODE_BID);
ModeAsk = MarketInfo(Symbol(), MODE_ASK);
ModePoint = MarketInfo(Symbol(), MODE_POINT);
ModeDigits = MarketInfo(Symbol(), MODE_DIGITS);
ModeSpread = MarketInfo(Symbol(), MODE_SPREAD);
ModeStopLevel = MarketInfo(Symbol(), MODE_STOPLEVEL);
ModeLotSize = MarketInfo(Symbol(), MODE_LOTSIZE);
ModeTickValue = MarketInfo(Symbol(), MODE_TICKVALUE);
ModeTickSize = MarketInfo(Symbol(), MODE_TICKSIZE);
ModeSwapLong = MarketInfo(Symbol(), MODE_SWAPLONG);
ModeSwapShort = MarketInfo(Symbol(), MODE_SWAPSHORT);
ModeStarting = MarketInfo(Symbol(), MODE_STARTING);
ModeExpiration = MarketInfo(Symbol(), MODE_EXPIRATION);
ModeTradeAllowed = MarketInfo(Symbol(), MODE_TRADEALLOWED);
ModeMinLot = MarketInfo(Symbol(), MODE_MINLOT);
ModeLotStep = MarketInfo(Symbol(), MODE_LOTSTEP);
return (0);
}