거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
당사 팬 페이지에 가입하십시오
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
- 게시자:
- Vladimir Karputov
- 조회수:
- 4065
- 평가:
- 게시됨:
- 2017.03.02 09:51
-
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
The EA uses two iStochastic (Stochastic Oscillator) indicators and one iRSI (RSI, Relative Strength Index).
Author of the idea — cxa, author of the MQL5 code — barabashkakvn.
Calculates the lot size based on the analysis of closed trades:
//+------------------------------------------------------------------+
//| Calculating optimal lot size |
//+------------------------------------------------------------------+
double LotsOptimized()
{
double lot=Lots;
int losses=0; // number of losses deals without a break
//--- select lot size
lot=NormalizeDouble(m_account.FreeMargin()*MaximumRisk/1000.0,2);
//--- calcuulate number of losses orders without a break
if(DecreaseFactor>0)
{
//--- request trade history
HistorySelect(TimeCurrent()-86400,TimeCurrent()+86400);
//---
uint total=HistoryDealsTotal();
//--- for all deals
for(uint i=0;i<total;i++)
{
if(!m_deal.SelectByIndex(i))
{
Print("Error in history!");
break;
}
if(m_deal.Symbol()!=Symbol() || m_deal.Entry()!=DEAL_ENTRY_OUT)
continue;
//---
if(m_deal.Profit()>0)
break;
if(m_deal.Profit()<0)
losses++;
}
if(losses>1)
lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
}
//--- return lot size
if(lot<0.1)
lot=0.1;
return(lot);
}
//| Calculating optimal lot size |
//+------------------------------------------------------------------+
double LotsOptimized()
{
double lot=Lots;
int losses=0; // number of losses deals without a break
//--- select lot size
lot=NormalizeDouble(m_account.FreeMargin()*MaximumRisk/1000.0,2);
//--- calcuulate number of losses orders without a break
if(DecreaseFactor>0)
{
//--- request trade history
HistorySelect(TimeCurrent()-86400,TimeCurrent()+86400);
//---
uint total=HistoryDealsTotal();
//--- for all deals
for(uint i=0;i<total;i++)
{
if(!m_deal.SelectByIndex(i))
{
Print("Error in history!");
break;
}
if(m_deal.Symbol()!=Symbol() || m_deal.Entry()!=DEAL_ENTRY_OUT)
continue;
//---
if(m_deal.Profit()>0)
break;
if(m_deal.Profit()<0)
losses++;
}
if(losses>1)
lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
}
//--- return lot size
if(lot<0.1)
lot=0.1;
return(lot);
}
Results of Backtests on EURUSD and USDJPY:
MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/17236

The Expert Advisor searches for the momentum: iClose(t2)-iClose(t1).

The Expert Advisor opens or closes positions at the intersection of lines.

The Expert Advisor uses the values of two iMA (Moving Average, MA) indicators.

The Expert Advisor places two pending orders (BuyStop and SellStop) with the specified expiration.