PDA

Zobacz pełną wersję : Potrzebuję pomocy, aby moje narzędzie MoneyMaker EA działało szybciej



sakipkg
03-12-2007 13:30, 13:30
Hej, mam pytanie do naprawdę dobrych programistów metatrader. W moim EA przełączam się między ramami czasowymi w zależności od funkcji. Jeśli EA określi, że powinienem używać 15-minutowych ram czasowych, to wywoła RangePrefetch () zaraz po uruchomieniu (). Jeśli powinienem używać wykresów 1-godzinnych, EA wywołuje funkcję TrendPrefetch () zaraz po uruchomieniu (). Zarówno RangePrefetch (), jak i TrendPrefetch () są dokładnie takie same, z wyjątkiem okresu, i są zdefiniowane i zaraz po init ().

Problem polega na tym, że przełączanie się pomiędzy ramami czasowymi zajmuje znacznie więcej czasu, aby go przetestować i zoptymalizować. Zastanawiam się więc, czy istnieje sposób na reorganizację kodu lub po prostu kodowanie go w bardziej efektywny sposób, więc wszystko przebiega znacznie szybciej. wielkie dzięki.

Wstawiony kod zewnętrzny podwójne JumpWidth_Percen = 0,25; string trend, kupuj, sprzedawaj, TradeComm; double Close1, Close2, Close3, Close4, Close5, Close6, Open1, Open2, Open3, Open4, Open5, Open6, Fast1, Fast2, Fast3, Fast4, Fast5, Fast6, Slow1, Slow2, Slow3, Slow4, Slow5, Slow6, Average , FastW, Currency_momentumA, Currency_momentumB, Currency_momentumC, Trend_momentumFastA, Trend_momentumFastB, Trend_momentumFastC, Trend_momentumFastD, Trend_momentumSlowA, Trend_momentumSlowB, Width1, szerokość2, Width3, Width4, width5, Width6, WidthW1, WidthW2, WidthW3, WidthW4, WidthW5, WidthW6, FastTrend, SlowTrend; int Trendd, MaxpipfromEMA, Ranging, RangesS, TFTime; void TrendPreFetch () {Średnia = iMA (NULL, PERIOD_H1,3,0, MODE_EMA, PRICE_CLOSE, 1); FastW = iMA (NULL, PERIOD_H1, fastma * 3,8,0, MODE_EMA, PRICE_CLOSE, 1); Currency_momentumA = iCustom (NULL, PERIOD_H1, OSMAMA, 4,6, currency_momentum, 1, currency_momentum, 0,1); Currency_momentumB = iCustom (NULL, PERIOD_H1, OSMAMA, 4,6, currency_momentum, 1, currency_momentum, 1,1); Currency_momentumC = iCustom (NULL, PERIOD_H1, OSMAMA, 4,6, currency_momentum, 1, currency_momentum, 0,5); Trend_momentumFastA = iCustom (NULL, PERIOD_H1, OSMAMA, 4,6, trend_momentum, 1, trend_momentum, 0,1); Trend_momentumFastB = iCustom (NULL, PERIOD_H1, OSMAMA, 4,6, trend_momentum, 1, trend_momentum, 0,2); Trend_momentumFastC = iCustom (NULL, PERIOD_H1, OSMAMA, 4,6, trend_momentum, 1, trend_momentum, 0,3); Trend_momentumFastD = iCustom (NULL, PERIOD_H1, OSMAMA, 4,6, trend_momentum, 1, trend_momentum, 1,1); Trend_momentumSlowA = iCustom (NULL, PERIOD_H1, OSMAMA, 6,8, slowma * 3, currency_momentum * 3, currency_momentum * 3,0,1); Trend_momentumSlowB = iCustom (NULL, PERIOD_H1, OSMAMA, 6,8, slowma * 3, currency_momentum * 3, currency_momentum * 3,0,5); } void RangePreFetch () {Average = iMA (NULL, PERIOD_M15,3,0, MODE_EMA, PRICE_CLOSE, 1); FastW = iMA (NULL, PERIOD_M15, fastma * 3,8,0, MODE_EMA, PRICE_CLOSE, 1); Currency_momentumA = iCustom (NULL, PERIOD_M15, OSMAMA, 4,6, currency_momentum, 1, currency_momentum, 0,1); Currency_momentumB = iCustom (NULL, PERIOD_M15, OSMAMA, 4,6, currency_momentum, 1, currency_momentum, 1,1); Currency_momentumC = iCustom (NULL, PERIOD_M15, OSMAMA, 4,6, currency_momentum, 1, currency_momentum, 0,5); Trend_momentumFastA = iCustom (NULL, PERIOD_M15, OSMAMA, 4,6, trend_momentum, 1, trend_momentum, 0,1); Trend_momentumFastB = iCustom (NULL, PERIOD_M15, OSMAMA, 4,6, trend_momentum, 1, trend_momentum, 0,2); Trend_momentumFastC = iCustom (NULL, PERIOD_M15, OSMAMA, 4,6, trend_momentum, 1, trend_momentum, 0,3); Trend_momentumFastD = iCustom (NULL, PERIOD_M15, OSMAMA, 4,6, trend_momentum, 1, trend_momentum, 1,1); Trend_momentumSlowA = iCustom (NULL, PERIOD_M15, OSMAMA, 6,8, slowma * 3, currency_momentum * 3, currency_momentum * 3,0,1); Trend_momentumSlowB = iCustom (NULL, PERIOD_M15, OSMAMA, 6,8, slowma * 3, currency_momentum * 3, currency_momentum * 3,0,5);} int start () {double Averagepips, Opentime, Stopip; int i, open, Spike, SpikeW, Buyjump, Selljump, BuyjumpR, SelljumpR, Ticket, Cnt, Can; double SlowTrend = iMA (NULL, PERIOD_H1, slowma, 0, MODE_EMA, PRICE_CLOSE, 1); double FastTrend = iMA (NULL, PERIOD_H1, fastma, 0, MODE_EMA, PRICE_CLOSE, 1); if ((MathAbs (FastTrend-SlowTrend) gt; RangePoint * Point)) {RangingS = 2; } else {RangingS = 1; } if ((TFTime! = iTime (Symbol (), PERIOD_M15,1)) (RangesS == 1)) {RangePreFetch (); MaxpipfromEMA = MaxpipfromEMAM; Ranging = 1; TFTime = iTime (Symbol (), PERIOD_M15,1); } if ((TFTime! = iTime (Symbol (), PERIOD_H1,1)) (RangesS == 2)) {TrendPreFetch (); MaxpipfromEMA = MaxpipfromEMAH; Ranging = 0; TFTime = iTime (Symbol (), PERIOD_H1,1); }

iresepgycho
10-21-2021 15:32, 15:32
Nawet przy optymalizacji funkcja iCustom spowolni twój EA. Powiedział, że mam kilka zaleceń: Oblicz te osoby w ostatniej chwili. Zamiast tych instrukcji if wywołaj RangePreFetch i TrendPreFetch, ustaw je dla zmiennej PERIOD_H1 lub PERIOD_M15. Następnie, w razie potrzeby, kalkuj pobliskich, używając okresu var do indie ram czasowych. Zamiast obliczać każdy indior dla każdego tiknięcia, prawdopodobnie odkryjesz, że obliczasz tylko dwa lub więcej w przypadku większości kleszczy. Zoptymalizuj osoby we wnętrzu. Zwykle istnieje wiele możliwości optymalizacji w niestandardowych lokalizacjach. Jeśli masz źródło, przekaż to raz za razem.