ゴゲッターEA - ページ 15

 

インクルードファイルが...

//+------------------------------------------------------------------+

//| 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---------------+
 
Mistigri:
> MetaQuotes HelpDesk (Tatyana) さんが書き込みました。

> Aaragornさん、こんにちは。

>

> 遅れて申し訳ありません。

>

> 1.Recalculateフィールドをucheckしてみてください。

> 再計算」オプションを有効にしてエキスパートテストを起動するたびに、データが新しくモデル化されることが問題です。

> 今この瞬間にはすでに新しい相場が来ているので、この新しい相場に基づいてモデル化されたデータは異なるものになります。

十分な回答ではないでしょうか?つまり、新しいデータが出るたびに欠落したデータを補填したり、モデル化が異なれば、同じ期間でテストを実行しても、当然異なる結果が得られると思うのですが・・・。

なぜ、これが問題の原因ではないと考えるのですか?

パトリック

どのような新しい相場が履歴に入ってくるのですか?新しい相場は、直近の日数だけ更新されます。新しい相場は、古いデータにどのような影響を与えるのでしょうか?

もしこれが答えなら、再び疑問が生じます。"なぜ変化していない古いデータをモデル化しないのか、なぜそれを違うようにモデル化するのか"。

 
portlandPipper:
アラゴルン、このスレッドを全部読んだわ。 まず、あなたがこれに固執することに賛辞を贈りたい。 約1年前、私は起きている間中 アドバイザーの聖杯を見つけ出そうとしていました。 フィブレベル、ピボットポイント、ストキャスティクス、MAなどなど・・・。 2つの教訓 - a) 戦略テスターは完全に時間の無駄である b) デモ口座はライブ口座とは異なる機能を持つ。 バックテストでは約90%の精度で取引できるコードを思いつくことができた。 デモ口座では75%かそこらに下がり、ライブで試したときは50%以下でした(これは、適切な資金管理をすれば、まだ使えるはずです)。 私が言いたいのは、ストラテジーテスターやデモ口座に最適化しようとして自分を追い込まないことです。 あなたは良いものを手に入れたようですね。 私はあなたのアドバイザーを家に持ち帰って、この週末にコードを読み、私のライブ口座で0.01ロットを取引するようにセットアップするつもりです。 それがうまくいくかどうかを知る唯一の方法です。 あなたのコードを共有してくれてありがとう

何を見つけたんだ?

 
 

メタトレーダーでアカウントを削除する方法を教えてください。

[編集]をクリック

見つかりました。

ナビゲーター-アカウント-アカウントにマウスオーバー-右クリック-削除です。