input bool isOnlyOnceTrade = true;
input int MA_period_1_1_1 = 100; //計算期間(短期)
input int MA_method_1_1_1 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_1_1_2 = 200; //計算期間(長期)
input int MA_method_1_1_2 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_1_2_1 = 100; //計算期間(短期)
input int MA_method_1_2_1 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_1_2_2 = 200; //計算期間(長期)
input int MA_method_1_2_2 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_2_1_1 = 100; //計算期間(短期)
input int MA_method_2_1_1 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_2_1_2 = 200; //計算期間(長期)
input int MA_method_2_1_2 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_2_2_1 = 100; //計算期間(短期)
input int MA_method_2_2_1 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_2_2_2 = 200; //計算期間(長期)
input int MA_method_2_2_2 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
bool Trade = true;
datetime lastAlertTime;
color ArrowColor[2] = {clrBlue, clrRed};
int magic_array[2];
int bars1;
int bars2;
//--------------------------------------------------------------------------------------------------------+
//初期化処理
//--------------------------------------------------------------------------------------------------------+
int OnInit()
{
if(IsTradeAllowed() == false) {
Alert(“Enable the setting ‘Allow live trading’ in the Expert Properties!”);
}
MAクロスで買い、売りのプログラムです
#property copyright “”
#property link “”
#property strict
#define RETRY_COUNT 3
enum timeframe {
CURRENT = 0, // チャートの時間足
M1 = 1,
M5 = 5,
M15 = 15,
M30 = 30,
H1 = 60,
H4 = 240,
D1 = 1440,
W1 = 10080,
MN1 = 43200
};
input int Magic1 = 1;
input int Magic2 = 2;
input double Lots = 0.1;
input double StopLoss = 0;
input double TakeProfit = 0;
input int Slippage = 1;
input string comment = “”;
input bool isOnlyOnceTrade = true;
input int MA_period_1_1_1 = 100; //計算期間(短期)
input int MA_method_1_1_1 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_1_1_2 = 200; //計算期間(長期)
input int MA_method_1_1_2 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_1_2_1 = 100; //計算期間(短期)
input int MA_method_1_2_1 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_1_2_2 = 200; //計算期間(長期)
input int MA_method_1_2_2 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_2_1_1 = 100; //計算期間(短期)
input int MA_method_2_1_1 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_2_1_2 = 200; //計算期間(長期)
input int MA_method_2_1_2 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_2_2_1 = 100; //計算期間(短期)
input int MA_method_2_2_1 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
input int MA_period_2_2_2 = 200; //計算期間(長期)
input int MA_method_2_2_2 = 0; //0=SMA,1=EMA,2=SMMA,3=LWMA
bool Trade = true;
datetime lastAlertTime;
color ArrowColor[2] = {clrBlue, clrRed};
int magic_array[2];
int bars1;
int bars2;
//--------------------------------------------------------------------------------------------------------+
//初期化処理
//--------------------------------------------------------------------------------------------------------+
int OnInit()
{
if(IsTradeAllowed() == false) {
Alert(“Enable the setting ‘Allow live trading’ in the Expert Properties!”);
}
magic_array[0] = Magic1;
magic_array[1] = Magic2;
bars1 = getBars(Magic1);
bars2 = getBars(Magic2);
return(INIT_SUCCEEDED);
}
//--------------------------------------------------------------------------------------------------------+
//メイン処理
//--------------------------------------------------------------------------------------------------------+
void OnTick()
{
int signal = 0;
double lots = Lots;
Trade = true;
if(Trade == false) return;
signal = 0;
if(iMA(Symbol(), 0, MA_period_1_1_1, 0, MA_method_1_1_1, PRICE_CLOSE, 2)+PipsToPrice(0) < iMA(Symbol(), 0, MA_period_1_1_2, 0, MA_method_1_1_2, PRICE_CLOSE, 2)+PipsToPrice(0)
&& iMA(Symbol(), 0, MA_period_1_2_1, 0, MA_method_1_2_1, PRICE_CLOSE, 1)+PipsToPrice(0) > iMA(Symbol(), 0, MA_period_1_2_2, 0, MA_method_1_2_2, PRICE_CLOSE, 1)+PipsToPrice(0)) signal = 1;
if(bars1 == Bars) signal = 0;
if(signal != 0 && getOpenLots(Magic1) == 0) {
}
signal = 0;
if(iMA(Symbol(), 0, MA_period_2_1_1, 0, MA_method_2_1_1, PRICE_CLOSE, 2)+PipsToPrice(0) > iMA(Symbol(), 0, MA_period_2_1_2, 0, MA_method_2_1_2, PRICE_CLOSE, 2)+PipsToPrice(0)
&& iMA(Symbol(), 0, MA_period_2_2_1, 0, MA_method_2_2_1, PRICE_CLOSE, 1)+PipsToPrice(0) < iMA(Symbol(), 0, MA_period_2_2_2, 0, MA_method_2_2_2, PRICE_CLOSE, 1)+PipsToPrice(0)) signal = -1;
if(bars2 == Bars) signal = 0;
if(signal != 0 && getOpenLots(Magic2) == 0) {
}
}
恐れ入りますが一括で変更する方法がなく、1つずつ手入力する必要がございます。
いくつかのパラメーターの組み合わせをご利用の場合は
セットファイル(上記画像にある「保存」「読み込み」を利用する機能)を
利用することで設定したパラメーターを保存、再読み込みが可能でございます。
ご参考いただけますと幸いです。何卒よろしくお願い申し上げます。