//+-------------StoreHighsAndLows Function----support and resistance arrays------thanks to Robert C for assistance on this-------+
//+-------creates array of each trade series support and resistance for signal profile matching-------------------+
void StoreHighsAndLows(double HIGH, double LOW)
{
if ( SLIndex >= SLSIZE )
{
SLIndex = 0;
}
sLocatorLows[ SLIndex ] = LOW;
sLocatorHighs[ SLIndex ] = HIGH;
SLIndex++;
}
//+-----------------------end of StoreHighsAndLows------------------------------------+
//+--------------- Get past equity function---------Thanks Robert C.-----------+
// This returns past equity from the global equity array. The howFarBack parameter is a positive integer that indicates how far back into the array to go
// 1 would be the previous equity, 2 would be the equity before that, etc.
// the HowFarBack should not be greater than the arraysize
double GetPastEquity(int HowFarBack)
{
if ( HowFarBack > EquityValuesStored )
{
Print("Error getting past equity, Looking back farther than what we have stored");
return (-1);
}
else
{
int PastIndex = EquityIndex - HowFarBack;
if ( PastIndex < 0 )
{
PastIndex += StoredEquitySIZE;
}
return (EQUITY[PastIndex]);
}
}
//+--end of get past equity function-----------+
//+---Stores account Equity value in an array for future comparisions up to as many previous trades as the declared size of the array----thanks Robert C.----+
void StoreAccountEquity(double equity)
{
if ( EquityIndex >= StoredEquitySIZE )
{
EquityIndex = 0;
}
EQUITY[EquityIndex] = equity;
EquityIndex++;
if ( EquityValuesStored < StoredEquitySIZE )
{
EquityValuesStored++;
}
}
//+-------end of Store Equity function-------------------+
//+---------count open trades function-------ty Maji--------------------------+
包含文件...
//| GoGetterfunctions.mqh |
//| In no event will author be liable for any damages whatsoever. |
//| Use at your own risk. |
//| |
//| Please do not remove this header. |
//+------------------------------------------------------------------+
#property copyright "Aaragorn and Eaglehawk & Maji & Robert C."
#property link "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"
#property link "http://forex.factoid.ca/forums/showthread.php?t=104"
#property link "https://www.forex-tsd.com/expert-advisors-metatrader-4/2840-gogetter-ea.html"
// many thanks goes to all those on the tsdforex forum and factoid forum who have encouraged us this far
//+------------------------------------------------------------------+
//| defines |
//+------------------------------------------------------------------+
//+-----------Store HIGH, LOW matching data------+
#define SLSIZE 15
static int SLIndex = 0;
static double sLocatorLows[ SLSIZE ] = { 0 };
static double sLocatorHighs[ SLSIZE ] = { 0 };
//+-----------Stored equity data-----------------+
#define StoredEquitySIZE 5
static int EquityIndex = 0;
static double EQUITY[ StoredEquitySIZE ] = { 0 };
static int EquityValuesStored = 0;
//+-----------close based on time----------------+
extern string Time_Settings="Time In Trade Settings";
extern int MonitorInMinutes = 60; // minutes after open to check state of trade
extern int ThresholdMove = 1; // if after that time we don't have +'x' pips we will exit
extern int MinsMultiplier = 75; // multiplies the MonitorInMinutes to make minutes (if 'x'=60) into hours
//+----------------increase lots variables-----+
double equity=0, ILots=0, LotIncreaseFactor=0.11;
//+------------------------------------------------------------------+
//| Commonly used GoGetter Functions | |
//+------------------------------------------------------------------+
//+-------------StoreHighsAndLows Function----support and resistance arrays------thanks to Robert C for assistance on this-------+
//+-------creates array of each trade series support and resistance for signal profile matching-------------------+
void StoreHighsAndLows(double HIGH, double LOW)
{
if ( SLIndex >= SLSIZE )
{
SLIndex = 0;
}
sLocatorLows[ SLIndex ] = LOW;
sLocatorHighs[ SLIndex ] = HIGH;
SLIndex++;
}
//+-----------------------end of StoreHighsAndLows------------------------------------+
//+--------------- Get past equity function---------Thanks Robert C.-----------+
// This returns past equity from the global equity array. The howFarBack parameter is a positive integer that indicates how far back into the array to go
// 1 would be the previous equity, 2 would be the equity before that, etc.
// the HowFarBack should not be greater than the arraysize
double GetPastEquity(int HowFarBack)
{
if ( HowFarBack > EquityValuesStored )
{
Print("Error getting past equity, Looking back farther than what we have stored");
return (-1);
}
else
{
int PastIndex = EquityIndex - HowFarBack;
if ( PastIndex < 0 )
{
PastIndex += StoredEquitySIZE;
}
return (EQUITY[PastIndex]);
}
}
//+--end of get past equity function-----------+
//+---Stores account Equity value in an array for future comparisions up to as many previous trades as the declared size of the array----thanks Robert C.----+
void StoreAccountEquity(double equity)
{
if ( EquityIndex >= StoredEquitySIZE )
{
EquityIndex = 0;
}
EQUITY[EquityIndex] = equity;
EquityIndex++;
if ( EquityValuesStored < StoredEquitySIZE )
{
EquityValuesStored++;
}
}
//+-------end of Store Equity function-------------------+
//+---------count open trades function-------ty Maji--------------------------+
int CountTrades()
{
int count=0;
int trade;
for(trade=OrdersTotal()-1;trade>=0;trade--)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()!=Symbol()&&OrderMagicNumber()!=MagicNumber)
continue;
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)
if((OrderType()==OP_SELL) || (OrderType()==OP_BUY))
count++;
}//for
return(count);
}
//+-----------end of count trades-------------------------------------+
//+---------------------Close Based on Time function------------Thanks to 'Maji' for this-------------------+
void CloseOrder()
{
double Profit=ThresholdMove*Point;
int total = CountTrades();
for (int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if ((CurTime()-OrderOpenTime())>MonitorInMinutes*60*MinsMultiplier)
{
LowTrailingStopTrigger = False;
if(OrderSymbol()==Symbol() && OrderType()==OP_BUY && Bid-Profit<OrderOpenPrice() )
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
}
if(OrderSymbol()==Symbol() && OrderType()==OP_SELL && Bid+Profit>OrderOpenPrice())
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
}
}
}
}
//+---------------------------end of close on time code---------------+
//+------------------------increase lots function-------------------------+
//+----------------increases lots based on account equity-----------------+
//+----TradeWave code-----lot sizing calculated from previous trade---------------+
//+----adjusts lot size for current position based on the previous trade being a winner or loser
double IncreaseLots(double Lots)
{
equity = AccountEquity();
double PreviousEquity = GetPastEquity(1);
if( PreviousEquity != -1 && equity > PreviousEquity )//Manipulates lot size to maximize equity growth from multiple consecutive winning positions
{
// Print("first...ILots: ",ILots," Lots: ",Lots," AccountFreeMargin: ",AccountFreeMargin());
ILots = Lots;
Lots = NormalizeDouble(AccountFreeMargin()/(LotIncreaseFactor*1000/0.1),1);
if(Lots < 0.01) Lots = 0.01;
if(Lots > 99) Lots = 99;
// Print("second...ILots: ",ILots," Lots: ",Lots," AccountFreeMargin: ",AccountFreeMargin());
}
else
{
ILots = Lots;
}
//+--------lot adjustments if the last trade lost-------+
if( PreviousEquity != -1 && equity <= PreviousEquity )//Manipulates lot size to reduce equity drawdown from multiple consecutive losing positions
{
// // Print("Previous Loser TradeWave Equity=",equity," <= PreviousEquity=",PreviousEquity," Lots = ",Lots);
Lots = 0.01; //very effective at reducing drawdown but impacts gains negatively as well
// // Print("XXXXXXXXXXXx Equity=",equity," <= PreviousEquity=",PreviousEquity," Lots = ",Lots);
}
else
{
Lots = Lots;
}
return(Lots);
}
//+----end of TradeWave code-----lot sizing calculated from previous trade---------------+> MetaQuotes HelpDesk(Tatyana)写道。
> 你好,Aaragorn。
>
> 对不起,耽搁了。
>
> 1.请尝试勾选 "重新计算 "字段。
> 问题是,每次你在启用 "重新计算 "选项后启动专家测试,数据将被重新建模。
> 由于此刻已经有了新的报价,基于这些新报价建模的数据将是不同的。
这样的回答还不够好吗?我的意思是,如果每次有新的数据时,缺失的数据被编造或以不同的方式建模,在同一时间段内运行测试显然会给你不同的结果......
为什么你认为这不是问题的原因?
帕特里克什么新的报价会进入历史?新的报价将只更新最近几天的数据。新的报价怎么会对旧的数据有影响?
如果这就是答案,那么问题又来了,"为什么它不对没有变化的旧数据进行建模,为什么它的建模方式不同?"
阿拉贡,我刚刚读完这整个主题。 首先,我得为你的坚持鼓掌。 大约一年前,我花了所有清醒的时间,试图找到顾问的圣杯。 Fib水平、枢轴点、随机指标、MA等等......。 有两个教训--a)策略测试器完全是浪费时间;b)模拟账户与真实账户的功能不同。 我想出了一些代码,在回溯测试中,交易的准确率达到90%左右。 在模拟账户上,准确率下降到75%左右,而当我尝试实盘交易时,我的准确率低于50%(如果有适当的资金管理,这仍然是可用的)。 我的观点是,不要为选择策略测试器或模拟账户而自暴自弃。 看起来你已经有了一个很好的东西。 我打算把你的顾问带回家,这个周末通读代码--并在我的真实账户上设置为0.01手交易。 这是你知道它是否有效的唯一方法。 谢谢你分享你的代码!
你发现了什么?
如何在Metatrader中删除一个账户?
[编辑]
找到了。
导航器 - 账户 - 鼠标移到账户上 - 右键 - 删除。