こんにちは、私は何人かの本当に良いメタトレーダープログラマーのために質問があります。私のEAでは、機能に応じてタイムフレームを切り替えます。 EAが15分の時間枠を使うべきだと判断した場合、start()の直後にRangePrefetch()を呼び出します。 1時間チャートを使用する必要がある場合、EAはstart()の直後にTrendPrefetch()を呼び出します。 RangePrefetch()とTrendPrefetch()はどちらもピリオドを除いてまったく同じで、init()の直後に定義されています。
問題は、タイムフレーム間でこのように切り替わるため、テストと最適化にかなり時間がかかることです。だから私はコードを並べ替えるか、単にもっと効率的な方法でコーディングする方法があるのではないかと思います。どうもありがとう。
挿入されたコードextern double JumpWidth_Percen = 0.25; string Trend、買う、売る、TradeComm;ダブルClose1、Close2、Close3、Close4、Close5、Close6、Open1、Open2、Open3、Open4、Open5、Open6、Fast1、Fast2、Fast3、Fast4、Fast5、Fast6、スロー1、スロー2、スロー3、スロー4、スロー5、スロー6 、FastW、Currency_momentumA、Currency_momentumB、Currency_momentumC、Trend_momentumFastA、Trend_momentumFastB、Trend_momentumFastC、Trend_momentumFastD、Trend_momentumSlowA、Trend_momentumSlowB、WIDTH1、幅2、Width3、Width4、Width5、Width6、幅W1、WidthW2、WidthW3、WidthW4、WidthW5、WidthW6、FastTrend、SlowTrend。 int Trendd、MaxpipfromEMA、Ranging、RangingS、TFTime; void TrendPreFetch(){平均= 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、開く、Spike、SpikeW、Buyjump、Selljump、BuyjumpR、SelljumpR、チケット、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))(RangingS == 1)){RangePreFetch();} MaxpipfromEMA = MaxpipfromEMAM;レンジング= 1。 TFTime = iTime(Symbol()、PERIOD_M15,1); if((TFTime!= iTime(Symbol()、PERIOD_H1,1))(RangingS == 2)){TrendPreFetch();} MaxpipfromEMA = MaxpipfromEMAH;レンジング= 0。 TFTime = iTime(Symbol()、PERIOD_H1,1); }