BTC USD 83,836.5 Gold USD 4,285.46
Time now: Jun 1, 12:00 AM

Mari Buat the BEST EA together!

u have to find mathematically, what is the multiplication factor and use that for your LotSize calculation

eg.
(again, there are many ways, my explanation suppose to make things easy, if it is not , I am sorry)

the key is to understand also the function of MathFloor() ==> which return integer from double and also NormalizeDouble

void LotSizeCalculation()
{


double NativeBalance = 10000;

//because you define your multfactor to be NOT Linear, so, we have to figure it out, quite a bit on the calculation

LotSize = NormalizeDouble( MathFloor( (0.1 x 2 x AccountBalance() ) / ( (NativeBalance +1) * 0.1) ) * 0.1 , 1); //u want only 1 digit decimal

if (LotSize < 0.1 && AccountBalance() > 0) LotSize = 0.1;

//checking

// if accountbalance = 9999, LotSize = 0.2 x 9999/1000.1 = 1.999 ==> after MathFloor = 1 , then x 0.1 jadi 0.1 then after NormalizeDouble, LotSize = 0.1

// if accountbalance = 10000, LotSize = 0.2 x 10000/1000.1 = 1.999 ==> after MathFloor = 1 , then jadi 0.1 then after NormalizeDouble, LotSize = 0.1
// if accountbalance = 10001, LotSize = 0.2 x 10001/1000.1 = 2 ==> after MathFloor = 2 , then jadi 0.2 then after NormalizeDouble, LotSize = 0.2
// if accountbalance = 15000, LotSize = 0.2 x 15000/1000.1 = 2.999 ==> after MathFloor = 2 , then jadi 0.2 then after NormalizeDouble, LotSize = 0.2
//** by right we want if accountbalance = 15001, LotSize = 0.2 x 15001/1000.1 = 3 ==> after MathFloor = 3 , then jadi 0.3 then after NormalizeDouble, LotSize = 0.3
// but the above still give if accountbalance = 15001, LotSize = 0.2 x 15001/1000.1 = 2.999 ==> so, the formula is still wrong - kena betul sikit lagi kat NativeBalance + 1 vs accountbalance formula
// seterusnya check sendiri - i have to go for a while

}

best eh..?

ok - kembali kejap -

rasanya the formula tu kira ok - 99% tepat (tidak 100% mengikut keperluan Penyoal) - so boleh pakai -
sebab
tengok ni

//checking
//if accountbalance = 15002, LotSize = 0.2 x 15002/1000.1 = 3.00009 ==> after MathFloor = 3 , then jadi 0.3 then after NormalizeDouble, LotSize = 0.3
 
TT nak develop EA ke mmg dah ade EA?

nama topic ni pun tengah nak buat -

tapi bersama -

step terawal adalah nakbagi paham pasal MM dan LotSize Mgt - which ramaaai orang tak paham -

saya memang la dah beratus EA buat - tapi JAUH sekali nak mengatakan itu EA terbaik - (99% fail!)

makanya - saya buka -

macam objektif yang tertera pada post 1 :

1) kena ada the BEST Trading Strategy - saya perlukan Banyak IDEA - on this

2) Coding EA - yang ni tak kisah - saya percaya ramai orang terer buat

yang payah no1 tu - silakan -
 
Saya buka peluang utk kasi idea tentang BEST Trading Strategy

Sekarang, seterusnya.. saya buka, sesapa ada RASA idea yang cukup bagus utk dijadikan BEST Trading strategies -

Sila postkan -

1) ..?
2) .. ?

Silakan -
 
Salam tt,

kalau kita buat ea based on moving average n macd saja, ok ke. Cth kalau ma(ema, lmwa n bla2)confirm silang selepas 2nd bar closed and macd bersilang pun 2nd bar closed. Take profit 10-20 pip je dlm market trending. Sideway ea dok diam2 sengih je.


kalau kita dah boleh tahu market trending atau sideway - memang dah senang -

saya tak nak meletakkan keputusan samada ni BeST strategy ke tak -

saya bukak pada idea2 lain -
 
I think a martingale system is the best EA in the hands of a smart trader.

ea martingle yg boleh trade waktu news dgn boleh tukar steps,tp dan SL..bagus idea tu..dah lama mengidam..ada idea camner nak buat...boleh pm saya
 
Using First Technique - Onaji San

..harap dapat siap dalam sejam (tidak tak tidur plak)

//+------------------------------------------------------------------+
//| Ultimate1.mq4
//|
//| First Update : 23 July 2010 - Description : Developing the Best EA
//| Second Update : 24 July 2010 - Defining more variables, more function for Money Management
//} 3rd Update : 26 July 2010 - First Rule : based on Onaji San Candle
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, UltimateForexEA"
#property link "http://www.ultimateforexea.com"


#define MAGICNO 123456

extern string Pair = "EURUSD";
extern int TimeFrame = 15;
extern int Slippage = 5;

double LotSize;
extern double StopLoss = 40;
extern double TakeProfit = 60;
extern double Risk_Percent = 2.0;
extern double TP_Percent = 2.0;
extern double LotFactor = 1.0; //1 = Directional, 0.1 = Grid, 0.01 = Martingale




int init()
{

CheckGlobalVariable();
AdjustSymbolForMiniMicro();

return(0);
}

int deinit()
{

return(0);
}

int start()
{

LotSizeCalculation();

//The Rule of Opening Trades

CheckRuleOpenPosition();

if (OrdersTotal() == 0) // no rules yet.
{

OrderSend(Pair,OP_SELL,LotSize,MarketInfo(Pair,MODE_BID),Slippage,MarketInfo(Pair,MODE_BID) + StopLoss*MarketInfo(Pair, MODE_POINT),MarketInfo(Pair,MODE_BID) - TakeProfit*MarketInfo(Pair,MODE_POINT),"Sell",MAGICNO,0,Red);

}


//The Rule of Closing Trades


return(0);
}

void CheckRuleOpenPosition()
{

//based on Onaji San


}

void LotSizeCalculation()
{

if(MarketInfo(Pair,MODE_MINLOT) == 0.1) int LotSizeDigit = 1;
else if(MarketInfo(Pair,MODE_MINLOT) == 0.01) LotSizeDigit = 2;
double MinLots = NormalizeDouble(MarketInfo(Pair,MODE_MINLOT),LotSizeDigit);
double MaxLots = NormalizeDouble(MarketInfo(Pair,MODE_MAXLOT),LotSizeDigit);
double AccountFM = NormalizeDouble(AccountFreeMargin(),2);

if (MarketInfo(Pair, MODE_LOTSIZE) == 100000) LotSize = (AccountFM*(Risk_Percent/100)* 0.1 * LotFactor) / (StopLoss * MarketInfo(Pair, MODE_TICKVALUE));
else if (MarketInfo(Pair, MODE_LOTSIZE) == 10000) LotSize = (AccountFM*(Risk_Percent/100) * LotFactor)/ (StopLoss * MarketInfo(Pair, MODE_TICKVALUE));
else if (MarketInfo(Pair, MODE_LOTSIZE) == 1000) LotSize = (AccountFM*(Risk_Percent/100) * 10 * LotFactor)/ (StopLoss * MarketInfo(Pair, MODE_TICKVALUE));

LotSize = NormalizeDouble(LotSize,LotSizeDigit);

if(LotSize > MaxLots) LotSize = MaxLots;
if(LotSize < MinLots)
{
LotSize = MinLots;
Alert("Your Equity is Below Tradeable Lots, EA changed to Min Lot possible."); //Message Box will pop up
Print("Your Equity is Below Tradeable Lots, EA changed to Min Lot possible."); //This message will appear in Expert tab

}



}

void CheckGlobalVariable()
{

}

void AdjustSymbolForMiniMicro()
{
if (StringLen(Symbol()) == 7)
{
Pair = Pair + StringSubstr(Symbol(), 6, 1);

}

}
 

Latest Posts

Live Forex Chart

Currency
Rates
EUR / USD
1.13916
USD / JPY
157.291
GBP / USD
1.32530
USD / CHF
0.82854
USD / CAD
1.41445
EUR / JPY
179.184
AUD / USD
0.70328
Back
Top
Log in Register