
新春特別企画! 爆益を生んだ最強の無料EAランキングTOP10
FX自動売買特別企画! 爆益を生んだ最強の無料EAランキングTOP10(ChatGPTで作ったMT4の無料EA11個まるごと公開)
前回の記事「お年玉企画!FX無料EA11選を大公開!」
前回の記事では、過去にnoteで配布したEAの無料ライセンス期間を2025年12月31日まで延長する形での無料配布となりましたが、
今回の記事はChatGPTで作ったEAを11個まるごと公開ということで、noteの記事にEAのソースコードをそのまま公開していますので、MQL4の知識がある方はカスタマイズしてご利用いただければと思います。
こちらの記事では2024年度に、最も勝てたEAをランキング形式で紹介します。
ランキングは1位から10位までのTOP10となりますが、番外編としてポンド円の15分足で動作する「Ichimoku Asasukya EA」という爆益のEAも紹介しますので、よろしくお願いします。
もちろん、今回紹介するEAのソースコードは、このページから無料でダウンロードできます。
前回の記事で紹介した11個の無料EAと、今回の11個、あわせて22個のEAがすべて無料でご利用いただける、大変太っ腹な企画となっておりますので、よろしくお願いします。
それではランキング10位からの発表です。
【10位】
2024年7月24日公開
Dow & Granville's
USDJPY 1M
PF 1.08(始値のみ)
全ティック 1.14
↓EAのコードはこちら↓
//10位
//2024年7月24日公開
//Dow & Granville's
//https://note.com/aimjey/n/nb9f5ae13c1cf
//USDJPY 1M
//PF 1.08(始値のみ)
//全ティック 1.14
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240610; // Magic number
extern double Lots = 0.1; // 1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0; // StopLoss 0.5=50pips 1.0=100pips 10=1000pips
extern double TakeProfitRequest = 5.0; // TakeProfit 0.5=50pips 1.0=100pips 10=1000pips
extern int MaxSpread = 50; // Max spread (50=5pips)
extern int MaxError = 100; // Continuous order count limit (Max=100)
extern string CommentPositions = "Dow & Granville's";
// ここから改変可能
extern int LongTermPeriod = 950; // 長期トレンドを判断する移動平均線の期間
extern int ShortTermPeriod = 30; // 短期トレンドを判断する移動平均線の期間
// ここまで改変可能
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage= 0;
// ティックが動くごとに処理
void OnTick()
{
if(Bars < 10)
{
return;
}
if(StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if(TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if(MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(),MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if(pos > 0)
{
Pips = 1.00; // ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}else if(Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}else if(Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}else if(Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}else if(Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}else if(Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}else if(Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}else if(Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}else if(Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
// ここから改変可能
double longTermMA = iMA(NULL, 0, LongTermPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);
double shortTermMA = iMA(NULL, 0, ShortTermPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);
double prevShortTermMA = iMA(NULL, 0, ShortTermPeriod, 0, MODE_SMA, PRICE_CLOSE, 2);
// ダウ理論に基づく長期トレンドの判断(tyou)
bool isLongTermUptrend = (Close[1] > longTermMA);
bool isLongTermDowntrend = (Close[1] < longTermMA);
// グランビルの法則による短期トレンドの判定
if(isLongTermUptrend && Close[1] > shortTermMA && Close[2] < prevShortTermMA)
{
LongSign = true;
ShortSign = false;
}
else if(isLongTermDowntrend && Close[1] < shortTermMA && Close[2] > prevShortTermMA)
{
ShortSign = true;
LongSign = false;
}
else
{
LongSign = false;
ShortSign = false;
}
// ここまで改変可能
if(MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Order\n";
}
else
{
spread_msg = "";
}
if(Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if(LongSign == true)
{
position_msg = "LongSign = true\n";
}
else if(ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else if(LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
// 売買指示
if(LongSign == true && Hour() >= 7 && Hour() <= 18)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenLong(); // 新規ロングオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseShortPosition(); // ショートポジションがある場合のみ決済ロング処理
}
}
if(ShortSign == true && Hour() >= 7 && Hour() <= 18)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenShort(); // 新規ショートオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseLongPosition(); // ロングポジションがある場合のみ決済ショート処理
}
}
tmpstr = StringConcatenate(error_msg, spread_msg, position_msg);
Comment(tmpstr);
}
// 保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys = 0;
int sells = 0;
int icount;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType() == OP_BUY)
{
buys++;
}
if(OrderType() == OP_SELL)
{
sells++;
}
}
}
if(buys > 0)
{
return (buys);
}
else
{
return (-sells);
}
}
// ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
// ショートポジションの場合⇒ロングエントリー
if(OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if(ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
// ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
// ロングポジションの場合⇒ショートエントリー
if(OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if(ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
// ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
// ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【9位】
2024年6月11日公開
Bollinger RSI Average
USDJPY 5M
PF 1.19(始値のみ)
全ティック 1.15
↓EAのコードはこちら↓
//9位
//2024年6月11日公開
//Bollinger RSI Average
//https://note.com/aimjey/n/nf099aba6cb63
//USDJPY 5M
//PF 1.19(始値のみ)
//全ティック 1.15
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240610; // Magic number
extern double Lots = 0.1; // 1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0; // StopLoss 0.5=50pips 1.0=100pips 10=1000pips
extern double TakeProfitRequest = 5.0; // TakeProfit 0.5=50pips 1.0=100pips 10=1000pips
extern int MaxSpread = 50; // Max spread (50=5pips)
extern int MaxError = 100; // Continuous order count limit (Max=100)
extern string CommentPositions = "Bollinger RSI Average";
//ここから改変可能
extern int ShortMovingPeriod = 50;
extern int LongMovingPeriod = 200;
extern int ConfirmBars = 3; // クロス確認のためのバー数
extern int Bands = 70; // ボリンジャーバンドの計算期間で範囲10~180で指定
extern int Deviation = 1; // ボリンジャーバンドの上方バンドと下方バンドの値で範囲1~3で指定
extern int RSI_highs = 70; // RSIの上限値を入力で範囲60~90で指定
extern int RSI_lows = 30; // RSIの下限値を入力で範囲10~40で指定
extern int RSI_Period = 14; // RSIの期間を入力で範囲6~14で指定
//ここまで改変可能
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage= 0;
// ティックが動くごとに処理
void OnTick()
{
if(Bars < LongMovingPeriod + ConfirmBars || Bars < Bands)
{
return;
}
if(StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if(TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if(MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(),MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if(pos > 0)
{
Pips = 1.00; // ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}else if(Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}else if(Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}else if(Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}else if(Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}else if(Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}else if(Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}else if(Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}else if(Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
//ここから改変可能
double upperBand = iBands(NULL, 0, Bands, Deviation, 0, PRICE_CLOSE, MODE_UPPER, 0);
double lowerBand = iBands(NULL, 0, Bands, Deviation, 0, PRICE_CLOSE, MODE_LOWER, 0);
double rsi = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, 0);
int currentHour = Hour();
if((currentHour >= 23 || currentHour < 5))
{
// 逆張りロジック
if(Close[1] > upperBand && rsi > RSI_highs)
{
ShortSign = true;
LongSign = false;
}
else if(Close[1] < lowerBand && rsi < RSI_lows)
{
LongSign = true;
ShortSign = false;
}
else
{
LongSign = false;
ShortSign = false;
}
}
else
{
// 順張りロジック
double shortMA = iMA(NULL, 0, ShortMovingPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
double longMA = iMA(NULL, 0, LongMovingPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
double prevShortMA = iMA(NULL, 0, ShortMovingPeriod, 0, MODE_SMA, PRICE_CLOSE, ConfirmBars);
double prevLongMA = iMA(NULL, 0, LongMovingPeriod, 0, MODE_SMA, PRICE_CLOSE, ConfirmBars);
if(prevShortMA <= prevLongMA && shortMA > longMA)
{
LongSign = true;
ShortSign = false;
}
else if(prevShortMA >= prevLongMA && shortMA < longMA)
{
ShortSign = true;
LongSign = false;
}
else
{
LongSign = false;
ShortSign = false;
}
}
//ここまで改変可能
if(MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Order\n";
}
else
{
spread_msg = "";
}
if(Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if(LongSign == true)
{
position_msg = "LongSign = true\n";
}
else if(ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else if(LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
//売買指示
if(LongSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenLong(); // 新規ロングオーダー処理を行う
e ++;
}
else
{
// ポジション保有している場合
CloseShortPosition(); // ショートポジションがある場合のみ決済ロング処理
}
}
if(ShortSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenShort(); // 新規ショートオーダー処理を行う
e ++;
}
else
{
// ポジション保有している場合
CloseLongPosition(); // ロングポジションがある場合のみ決済ショート処理
}
}
tmpstr = StringConcatenate(error_msg,spread_msg,position_msg);
Comment(tmpstr);
}
//保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys=0;
int sells=0;
int icount;
for(icount = 0 ; icount < OrdersTotal() ; icount++)
{
if(OrderSelect(icount,SELECT_BY_POS,MODE_TRADES) == false)
{
break;
}
if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType()==OP_BUY)
{
buys++;
}
if(OrderType()==OP_SELL)
{
sells++;
}
}
}
if(buys > 0)
{
return(buys);
}
else
{
return(-sells);
}
}
//ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ショートポジションの場合⇒ロングエントリー
if(OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if(ret == false)
{
Print("オーダークローズエラー:エラーコード=",GetLastError());
}
break;
}
}
}
//ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ロングポジションの場合⇒ショートエントリー
if(OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if(ret == false)
{
Print("オーダークローズエラー:エラーコード=",GetLastError());
}
break;
}
}
}
//ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots,2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
//ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots,2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【8位】
2024年6月20日公開
Spike EA Trade
ドル円15分足チャート
PF 1.15(始値のみ)
全ティック 1.16
↓EAのコードはこちら↓
//8位
//2024年6月20日公開
//Spike EA Trade
//https://note.com/aimjey/n/n9f5d0906c213
//ドル円15分足チャート
//PF 1.15(始値のみ)
//全ティック 1.16
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240610;// Magic number
extern double Lots = 0.1;//1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0;// StopLoss 0.5=50pips 1.0=100pips 10=1000pips
extern double TakeProfitRequest = 5.0;// TakeProfit 0.5=50pips 1.0=100pips 10=1000pips
extern int MaxSpread = 50;// Max spread (50=5pips)
extern int MaxError = 100;// Continuous order count limit (Max=100)
extern string CommentPositions = "Spike EA Trade";
//ここから改変可能
extern double SpikeThreshold = 0.5; // スパイクの閾値を設定 (例: 50ピップス)
extern int SpikeBar = 1; // 何本前のバーでスパイクをチェックするか (0 は最新のバー)
//ここまで改変可能
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage= 0;
// ティックが動くごとに処理
void OnTick()
{
if(Bars < 10)
{
return;
}
if(StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if(TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if(MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(),MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if(pos > 0)
{
Pips = 1.00;// ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}else if(Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}else if(Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}else if(Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}else if(Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}else if(Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}else if(Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}else if(Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}else if(Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
//ここから改変可能
double spikeHigh = High[SpikeBar];
double spikeLow = Low[SpikeBar];
double spikeRange = spikeHigh - spikeLow;
if(spikeRange >= SpikeThreshold * Pips)
{
if(Close[SpikeBar] > Open[SpikeBar])
{
LongSign = true;
ShortSign = false;
}
else
{
ShortSign = true;
LongSign = false;
}
}
//ここまで改変可能
if(MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Orber\n";
}
else
{
spread_msg = "";
}
if(Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if(LongSign == true)
{
position_msg = "LongSign = true\n";
}
else
if(ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else
if(LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
//売買指示
if(LongSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenLong();// 新規ロングオーダー処理を行う
e ++;
}
else
{
// ポジション保有している場合
CloseShortPosition();// ショートポジションがある場合のみ決済ロング処理
}
}
if(ShortSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenShort();// 新規ショートオーダー処理を行う
e ++;
}
else
{
// ポジション保有している場合
CloseLongPosition();// ロングポジションがある場合のみ決済ショート処理
}
}
tmpstr = StringConcatenate(error_msg,spread_msg,position_msg);
Comment(tmpstr);
}
//保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys=0;
int sells=0;
int icount;
for(icount = 0 ; icount < OrdersTotal() ; icount++)
{
if(OrderSelect(icount,SELECT_BY_POS,MODE_TRADES) == false)
{
break;
}
if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType()==OP_BUY)
{
buys++;
}
if(OrderType()==OP_SELL)
{
sells++;
}
}
}
if(buys > 0)
{
return(buys);
}
else
{
return(-sells);
}
}
//ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ショートポジションの場合⇒ロングエントリー
if(OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if(ret == false)
{
Print("オーダークローズエラー:エラーコード=",GetLastError());
}
break;
}
}
}
//ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ロングポジションの場合⇒ショートエントリー
if(OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if(ret == false)
{
Print("オーダークローズエラー:エラーコード=",GetLastError());
}
break;
}
}
}
//ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots,2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
//ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots,2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【7位】
2024年7月10日公開
MACD Signal Trade
GBPJPY 60M
PF 1.20(始値のみ)
全ティック 1.18
↓EAのコードはこちら↓
//7位
//2024年7月10日公開
//MACD Signal Trade
//https://note.com/aimjey/n/nf6c496c5a84f
//GBPJPY 60M
//PF 1.20(始値のみ)
//全ティック 1.18
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240610;// Magic number
extern double Lots = 0.1;//1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0;// StopLoss 0.5=50pips 1.0=100pips 10=1000pips
extern double TakeProfitRequest = 5.0;// TakeProfit 0.5=50pips 1.0=100pips 10=1000pips
extern int MaxSpread = 50;// Max spread (50=5pips)
extern int MaxError = 100;// Continuous order count limit (Max=100)
extern string CommentPositions = "MACD Signal Trade";
//ここから改変可能
extern int MACD_EMA1 = 9;// MACDの短期EMA
extern int MACD_EMA2 = 50;// MACDの長期EMA
extern int MACD_Signal = 9;// MACDのシグナル
extern int ShortSMA = 20;
extern int LongSMA = 75;
//ここまで改変可能
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage = 0;
// ティックが動くごとに処理
void OnTick()
{
if(Bars < 10)
{
return;
}
if(StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if(TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if(MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(), MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if (pos > 0)
{
Pips = 1.00;// ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}
else if (Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}
else if (Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}
else if (Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}
else if (Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}
else if (Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}
else if (Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}
else if (Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}
else if (Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
//ここから改変可能
double shortSMA = iMA(NULL, 0, ShortSMA, 0, MODE_SMA, PRICE_CLOSE, 0);
double longSMA = iMA(NULL, 0, LongSMA, 0, MODE_SMA, PRICE_CLOSE, 0);
double shortSMA_prev = iMA(NULL, 0, ShortSMA, 0, MODE_SMA, PRICE_CLOSE, 1);
double longSMA_prev = iMA(NULL, 0, LongSMA, 0, MODE_SMA, PRICE_CLOSE, 1);
double macdCurrent = iMACD(NULL, 0, MACD_EMA1, MACD_EMA2, MACD_Signal, PRICE_CLOSE, MODE_MAIN, 0);
double macdPrev = iMACD(NULL, 0, MACD_EMA1, MACD_EMA2, MACD_Signal, PRICE_CLOSE, MODE_MAIN, 1);
if(macdPrev >= 0 && (shortSMA - longSMA) > (shortSMA_prev - longSMA_prev))
{
LongSign = true;
ShortSign = false;
}
else if(macdPrev <= 0 && (longSMA - shortSMA) > (longSMA_prev - shortSMA_prev))
{
ShortSign = true;
LongSign = false;
}
//ここまで改変可能
if (MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Orber\n";
}
else
{
spread_msg = "";
}
if (Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if (LongSign == true)
{
position_msg = "LongSign = true\n";
}
else if (ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else if (LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
//売買指示
if (LongSign == true)
{
if (CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenLong();// 新規ロングオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseShortPosition();// ショートポジションがある場合のみ決済ロング処理
}
}
if (ShortSign == true)
{
if (CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenShort();// 新規ショートオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseLongPosition();// ロングポジションがある場合のみ決済ショート処理
}
}
tmpstr = StringConcatenate(error_msg, spread_msg, position_msg);
Comment(tmpstr);
}
//保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys = 0;
int sells = 0;
int icount;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if (OrderType() == OP_BUY)
{
buys++;
}
if (OrderType() == OP_SELL)
{
sells++;
}
}
}
if (buys > 0)
{
return (buys);
}
else
{
return (-sells);
}
}
//ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ショートポジションの場合⇒ロングエントリー
if (OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if (ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
//ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ロングポジションの場合⇒ショートエントリー
if (OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if (ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
//ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
//ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【6位】
2024年9月5日公開
Williams%R
USDJPY 1M
PF 1.17(始値のみ)
全ティック 1.19
↓EAのコードはこちら↓
//6位
//2024年9月5日公開
//Williams%R
//https://note.com/aimjey/n/n7acc5a9c5576
//USDJPY 1M
//PF 1.17(始値のみ)
//全ティック 1.19
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240905;// Magic number
extern double Lots = 0.1;//1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0;// StopLoss 0.5=50pips 10=1000pips
extern double TakeProfitRequest = 5.0;// TakeProfit 0.5=50pips 10=1000pips
extern int MaxSpread = 50;// Max spread (50=5pips)
extern int MaxError = 100;// Continuous order count limit (Max=100)
extern string CommentPositions = "WillsukyaEA";
extern bool OnlyWilliams = false; // Williams%Rだけで売買判定 true 他のテクニカル指標を追加して判定 false
extern double OverboughtLevel = -10.0; // Williams%R 買われすぎの閾値
extern double OversoldLevel = -70.0; // Williams%R 売られすぎの閾値
extern int WilliamsPeriod = 1000; // Williams%Rの期間(デフォルト1000)
// 移動平均線フィルタ
extern bool UseSMAFilter = true;
extern int ShortMAPeriod = 375;
extern int MiddleMAPeriod = 750;
extern int LongMAPeriod = 1200;
// MACDフィルタ
extern bool UseMACDFilter = true;
extern int MACDFastPeriod = 12;
extern int MACDSlowPeriod = 26;
extern int MACDSignalPeriod = 9;
// RSIフィルタ
extern bool UseRSIFilter = true;
extern int RSIPeriod = 14;
extern double RSIOverbought = 70.0;
extern double RSIOversold = 30.0;
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSignMh = false;
bool ShortSignMh = false;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage = 0;
// ティックが動くごとに処理
void OnTick()
{
if(Bars < 10)
{
return;
}
if(StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if(TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if(MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(), MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if(pos > 0)
{
Pips = 1.00;// ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}
else if(Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}
else if(Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}
else if(Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}
else if(Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}
else if(Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}
else if(Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}
else if(Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}
else if(Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
// フィルタの判定
LongSign = false;
ShortSign = false;
LongSignMh = false;
ShortSignMh = false;
double WilliamsR = iWPR(NULL, 0, WilliamsPeriod, 1); // Williams%Rの値を取得
if(WilliamsR > OverboughtLevel) // Williams%Rが-30以上の場合、ロングシグナル
{
LongSignMh = true;
}
else if(WilliamsR < OversoldLevel) // Williams%Rが-70以下の場合、ショートシグナル
{
ShortSignMh = true;
}
// SMAフィルタ
if(UseSMAFilter)
{
double shortMA = iMA(NULL, 0, ShortMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);
double middleMA = iMA(NULL, 0, MiddleMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);
double longMA = iMA(NULL, 0, LongMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1);
if(shortMA > middleMA && middleMA > longMA && LongSignMh == true) // ロングシグナル
{
LongSign = true;
ShortSign = false;
}
else if(shortMA < middleMA && middleMA < longMA && ShortSignMh == true) // ショートシグナル
{
ShortSign = true;
LongSign = false;
}
}
// MACDフィルタ
if(UseMACDFilter)
{
double macdMain = iMACD(NULL, 0, MACDFastPeriod, MACDSlowPeriod, MACDSignalPeriod, PRICE_CLOSE, MODE_MAIN, 0);
double macdSignal = iMACD(NULL, 0, MACDFastPeriod, MACDSlowPeriod, MACDSignalPeriod, PRICE_CLOSE, MODE_SIGNAL, 0);
if(macdMain > macdSignal && LongSignMh == true) // ロングシグナル
{
LongSign = true;
ShortSign = false;
}
else if(macdMain < macdSignal && ShortSignMh == true) // ショートシグナル
{
ShortSign = true;
LongSign = false;
}
}
// RSIフィルタ
if(UseRSIFilter)
{
double rsi = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, 0);
if(rsi > RSIOverbought && LongSignMh == true) // ロングシグナル
{
LongSign = true;
ShortSign = false;
}
else if(rsi < RSIOversold && ShortSignMh == true) // ショートシグナル
{
ShortSign = true;
LongSign = false;
}
}
if(OnlyWilliams == true){
LongSign = false;
ShortSign = false;
if(LongSignMh == true) // Williams%Rが-30以上の場合、ロングシグナル
{
LongSign = true;
}
else if(ShortSignMh == true) // Williams%Rが-70以下の場合、ショートシグナル
{
ShortSign = true;
}
}
// ここまでフィルタの判定
/*
//決済ロジックを追加する場合
if(CalculateCurrentOrders() == 1){// ロングポジション保有
if(ShortSignMh = true){//Williams%Rが-30以上の場合
CloseLongPosition();// ロングポジションを決済
}
} else if(CalculateCurrentOrders() == -1){// ショートポジション保有
if(LongSignMh = true){//Williams%Rが-70以下の場合
CloseShortPosition();// ショートポジションを決済
}
}
*/
if(MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread exceeded\n";
}
else
{
spread_msg = "";
}
if(Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if(LongSign == true)
{
position_msg = "LongSign = true\n";
}
else if(ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else
{
position_msg = "No Sign\n";
}
//売買指示
if(LongSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション無し
CheckForOpenLong(); // 新規ロングオーダー処理
e ++;
}
else
{
// ポジション保有中
CloseShortPosition(); // ショートポジションを決済
}
}
if(ShortSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション無し
CheckForOpenShort(); // 新規ショートオーダー処理
e ++;
}
else
{
// ポジション保有中
CloseLongPosition(); // ロングポジションを決済
}
}
tmpstr = StringConcatenate(error_msg,spread_msg,position_msg);
Comment(tmpstr);
}
//保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys=0;
int sells=0;
int icount;
for(icount = 0 ; icount < OrdersTotal() ; icount++)
{
if(OrderSelect(icount,SELECT_BY_POS,MODE_TRADES) == false)
{
break;
}
if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType() == OP_BUY)
{
buys++;
}
if(OrderType() == OP_SELL)
{
sells++;
}
}
}
if(buys > 0)
{
return(buys);
}
else
{
return(-sells);
}
}
//ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
if(OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if(ret == false)
{
Print("エラーコード=",GetLastError());
}
break;
}
}
}
//ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
if(OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if(ret == false)
{
Print("エラーコード=",GetLastError());
}
break;
}
}
}
//ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
//ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【5位】
2024年8月14日公開
CCI Ichimoku
USDJPY 5M
PF 1.69(始値のみ)
全ティック 1.22
↓EAのコードはこちら↓
//5位
//2024年8月14日公開
//CCI Ichimoku
//https://note.com/aimjey/n/nd1853fd131c5
//USDJPY 5M
//PF 1.69(始値のみ)
//全ティック 1.22
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240610;// Magic number
extern double Lots = 0.1;//1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0;// StopLoss 0.5=50pips 1.0=100pips 10=1000pips
extern double TakeProfitRequest = 5.0;// TakeProfit 0.5=50pips 1.0=100pips 10=1000pips
extern int MaxSpread = 50;// Max spread (50=5pips)
extern int MaxError = 100;// Continuous order count limit (Max=100)
extern string CommentPositions = "CCI Ichimoku Trade";
//ここから改変可能
extern int IchimokuTenkan = 9; // 転換線の期間
extern int IchimokuKijun = 36; // 基準線の期間
extern int IchimokuSenkou = 52; // 先行スパンの期間
extern int CCIPeriod1 = 14;
extern int CCIPeriod2 = 12;
extern double CCILong = -150;
extern double CCIShort = 150;
//ここまで改変可能
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage = 0;
// ティックが動くごとに処理
void OnTick()
{
if (Bars < 10)
{
return;
}
if (StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if (TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if (MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(), MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if (pos > 0)
{
Pips = 1.00;// ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}
else if (Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}
else if (Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}
else if (Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}
else if (Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}
else if (Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}
else if (Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}
else if (Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}
else if (Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
//ここから改変可能
bool ShortSignMh = false;
bool LongSignMh = false;
double SenkouSpanA = iIchimoku(NULL, 0, IchimokuTenkan, IchimokuKijun, IchimokuSenkou, MODE_SENKOUSPANA, 0);
double SenkouSpanB = iIchimoku(NULL, 0, IchimokuTenkan, IchimokuKijun, IchimokuSenkou, MODE_SENKOUSPANB, 0);
double ClosePrice = Close[0];
double CCI1 = iCCI(NULL, 0, CCIPeriod1, PRICE_CLOSE, 0);
double CCI2 = iCCI(NULL, 0, CCIPeriod2, PRICE_CLOSE, 0);
if (ClosePrice > SenkouSpanA && ClosePrice > SenkouSpanB)
{
LongSignMh = true;
ShortSignMh = false;
}
else if (ClosePrice < SenkouSpanA && ClosePrice < SenkouSpanB)
{
ShortSignMh = true;
LongSignMh = false;
}
else
{
LongSign = false;
ShortSign = false;
}
if (CCI1 < CCILong && CCI2 < CCILong && LongSignMh == true )
{
LongSign = true;
ShortSign = false;
}
else if (CCI1 > CCIShort && CCI2 > CCIShort && ShortSignMh == true)
{
ShortSign = true;
LongSign = false;
}
//ここまで改変可能
if (MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Orber\n";
}
else
{
spread_msg = "";
}
if (Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if (LongSign == true)
{
position_msg = "LongSign = true\n";
}
else if (ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else if (LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
//売買指示
if (LongSign == true)
{
if (CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenLong();// 新規ロングオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseShortPosition();// ショートポジションがある場合のみ決済ロング処理
}
}
if (ShortSign == true)
{
if (CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenShort();// 新規ショートオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseLongPosition();// ロングポジションがある場合のみ決済ショート処理
}
}
tmpstr = StringConcatenate(error_msg, spread_msg, position_msg);
Comment(tmpstr);
}
//保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys = 0;
int sells = 0;
int icount;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if (OrderType() == OP_BUY)
{
buys++;
}
if (OrderType() == OP_SELL)
{
sells++;
}
}
}
if (buys > 0)
{
return (buys);
}
else
{
return (-sells);
}
}
//ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ショートポジションの場合⇒ロングエントリー
if (OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if (ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
//ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ロングポジションの場合⇒ショートエントリー
if (OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if (ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
//ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
//ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【4位】
2024年8月28日公開
Fibonacci Retracement(ボリンジャーバンド+RSI)
USDJPY 1M
PF 1.31(始値のみ)
全ティック 1.24
↓EAのコードはこちら↓
//4位
//2024年8月28日公開
//Fibonacci Retracement(ボリンジャーバンド+RSI)
//https://note.com/aimjey/n/nba7220808550
//USDJPY 1M
//PF 1.31(始値のみ)
//全ティック 1.24
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240828;// Magic number
extern double Lots = 0.1;//1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 1.0;// StopLoss 0.1=10pips 0.5=50pips 1=100pips
extern double TakeProfitRequest = 1.0;// TakeProfit 0.1=10pips 0.5=50pips 1=100pips
extern int MaxSpread = 50;// Max spread (50=5pips)
extern int MaxError = 100;// Continuous order count limit (Max=100)
extern string CommentPositions = "Fibonacci Retracement";
//ここから改変可能
extern int RsiPeriod = 14; // RSIの期間
extern int BollingerBandsPeriod = 30; // ボリンジャーバンドの期間
extern int BollingerBandsDeviation = 2; // ボリンジャーバンドのシグマ値
extern int FibonacciLookBack = 500; // フィボナッチリトレースメント計算のための過去の期間500か1000
extern double FibonacciLevel = 0.5; // フィボナッチリトレースメントのレベル (例: 0.5 = 50%)
extern int SpikeLookBackPeriod = 5; // スパイクを確認する過去のバーの数(無効)
extern double SpikeThreshold = 0.006; // スパイクの閾値(パーセンテージ)(無効)
//ここまで改変可能
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage = 0;
// フィボナッチリトレースメントを計算する関数
double CalculateFibonacciLevel(double high, double low, double level)
{
return high - (high - low) * level;
}
// ティックが動くごとに処理
void OnTick()
{
if (Bars < FibonacciLookBack)
{
return;
}
if (StopLossRequest <= 0.01)
{
StopLossRequest = 0.01;
}
if (TakeProfitRequest <= 0.01)
{
TakeProfitRequest = 0.01;
}
if (MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(), MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if (pos > 0)
{
Pips = 1.00;// ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}
else if (Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}
else if (Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}
else if (Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}
else if (Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}
else if (Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}
else if (Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}
else if (Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}
else if (Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
// 過去の高値と安値を取得
double highestHigh = iHigh(NULL, 0, iHighest(NULL, 0, MODE_HIGH, FibonacciLookBack, 0));
double lowestLow = iLow(NULL, 0, iLowest(NULL, 0, MODE_LOW, FibonacciLookBack, 0));
// フィボナッチレベルを計算
double fibonacciLevel = CalculateFibonacciLevel(highestHigh, lowestLow, FibonacciLevel);
// RSIとボリンジャーバンドを計算
double rsi = iRSI(NULL, 0, RsiPeriod, PRICE_CLOSE, 1);
double upperBand = iBands(NULL, 0, BollingerBandsPeriod, BollingerBandsDeviation, 0, PRICE_CLOSE, MODE_UPPER, 1);
double lowerBand = iBands(NULL, 0, BollingerBandsPeriod, BollingerBandsDeviation, 0, PRICE_CLOSE, MODE_LOWER, 1);
double currentPrice = Close[0];
/*
// スパイクフィルターの追加
bool spikeDetected = false;
for (int i = 1; i <= SpikeLookBackPeriod; i++)
{
double priceChange = MathAbs((Close[i] - Open[i]) / Open[i]);
if (priceChange >= SpikeThreshold)
{
spikeDetected = true;
break;
}
}
*/
//if (!spikeDetected){
// ロングサインの条件
if (rsi <= 30 && currentPrice <= lowerBand && currentPrice >= fibonacciLevel)
{
LongSign = true;
ShortSign = false;
}
// ショートサインの条件
else if (rsi >= 70 && currentPrice >= upperBand && currentPrice <= fibonacciLevel)
{
ShortSign = true;
LongSign = false;
}
else
{
LongSign = false;
ShortSign = false;
}
//}
if (MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Orber\n";
}
else
{
spread_msg = "";
}
if (Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if (LongSign == true)
{
position_msg = "LongSign = true\n";
}
else if (ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else if (LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
// 売買指示
if (LongSign == true)
{
if (CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenLong();// 新規ロングオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseShortPosition();// ショートポジションがある場合のみ決済ロング処理
}
}
if (ShortSign == true)
{
if (CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenShort();// 新規ショートオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseLongPosition();// ロングポジションがある場合のみ決済ショート処理
}
}
tmpstr = StringConcatenate(error_msg, spread_msg, position_msg);
Comment(tmpstr);
}
// 保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys = 0;
int sells = 0;
int icount;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if (OrderType() == OP_BUY)
{
buys++;
}
if (OrderType() == OP_SELL)
{
sells++;
}
}
}
if (buys > 0)
{
return (buys);
}
else
{
return (-sells);
}
}
// ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
// ショートポジションの場合⇒ロングエントリー
if (OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if (ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
// ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
// ロングポジションの場合⇒ショートエントリー
if (OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if (ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
// ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
// ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【3位】
2024年9月24日公開
372 SAR Trade
USDJPY 15M
PF 1.17(始値のみ)
全ティック 1.25
↓EAのコードはこちら↓
//3位
//2024年9月24日公開
//372 SAR Trade
//https://note.com/aimjey/n/n71b67986a455
//USDJPY 15M
//PF 1.17(始値のみ)
//全ティック 1.25
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240924;// Magic number
extern double Lots = 0.1;//1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0;// StopLoss 0.5=50pips 10=1000pips
extern double TakeProfitRequest = 5.0;// TakeProfit 0.5=50pips 10=1000pips
extern int MaxSpread = 50;// Max spread (50=5pips)
extern int MaxError = 100;// Continuous order count limit (Max=100)
extern string CommentPositions = "372 SAR Trade";
extern double Step15m = 0.001; // パラボリックSARのステップ(15分足)
extern double Step1h = 0.01; // パラボリックSARのステップ(1時間足)
extern double Step4h = 0.035; // パラボリックSARのステップ(4時間足)
extern double Maximum = 0.2; // パラボリックSARの最大値
input bool Doten = true; // ドテン方式にする場合true、決済ロジックを追加する場合false
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage= 0;
// ティックが動くごとに処理
void OnTick()
{
if(Bars < 10)
{
return;
}
if(StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if(TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if(MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(),MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if(pos > 0)
{
Pips = 1.00;// ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}else if(Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}else if(Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}else if(Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}else if(Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}else if(Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}else if(Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}else if(Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}else if(Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
//ここから改変可能
double sarValue15m = iSAR(NULL, 0, Step15m, Maximum, 1);
double sarValue1h = iSAR(NULL, 0, Step1h, Maximum, 1);
double sarValue4h = iSAR(NULL, 0, Step4h, Maximum, 1);
double closePrice = Close[1];
if(closePrice > sarValue15m && closePrice > sarValue1h && closePrice > sarValue4h)
{
LongSign = true;
ShortSign = false;
}
else if(closePrice < sarValue15m && closePrice < sarValue1h && closePrice < sarValue4h)
{
ShortSign = true;
LongSign = false;
}
else
{
LongSign = false;
ShortSign = false;
}
//ここまで改変可能
/*ここに決済ロジックを挿入*/
if(Doten == false){
// 決済のロジックを有効にする場合(未完成)
if(CalculateCurrentOrders() == 1 && (Close[0] < sarValue15m && Close[0] < sarValue1h && Close[0] < sarValue4h))
{
CloseLongPosition();// ロングポジションを決済
}
else if(CalculateCurrentOrders() == -1 && (Close[0] > sarValue15m && Close[0] > sarValue1h && Close[0] > sarValue4h))
{
CloseShortPosition();// ショートポジションを決済
}
}
/*ここまで決済ロジックを挿入*/
if(MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Orber\n";
}
else
{
spread_msg = "";
}
if(Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if(LongSign == true)
{
position_msg = "LongSign = true\n";
}
else
if(ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else
if(LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
//売買指示
if(LongSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション無し
CheckForOpenLong();// 新規ロングオーダー処理
e ++;
}
else
{
// ポジション保有中
CloseShortPosition();// ショートポジションを決済
}
}
if(ShortSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション無し
CheckForOpenShort();// 新規ショートオーダー処理
e ++;
}
else
{
// ポジション保有中
CloseLongPosition();// ロングポジションを決済
}
}
tmpstr = StringConcatenate(error_msg,spread_msg,position_msg);
Comment(tmpstr);
}
//保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys=0;
int sells=0;
int icount;
for(icount = 0 ; icount < OrdersTotal() ; icount++)
{
if(OrderSelect(icount,SELECT_BY_POS,MODE_TRADES) == false)
{
break;
}
if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType()==OP_BUY)
{
buys++;
}
if(OrderType()==OP_SELL)
{
sells++;
}
}
}
if(buys > 0)
{
return(buys);
}
else
{
return(-sells);
}
}
//ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
if(OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if(ret == false)
{
Print("エラーコード=",GetLastError());
}
break;
}
}
}
//ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
if(OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if(ret == false)
{
Print("エラーコード=",GetLastError());
}
break;
}
}
}
//ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots,2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
//ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots,2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【2位】
2024年9月25日公開
ATR EA Trade
USDJPY 15M
PF 1.48(始値のみ)
全ティック 1.30
↓EAのコードはこちら↓
//2位
//2024年9月25日公開
//ATR EA Trade
//https://note.com/aimjey/n/n40770679d4bb
//USDJPY 15M
//PF 1.48(始値のみ)
//全ティック 1.30
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240925;// Magic number
extern double Lots = 0.1;//1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0;// StopLoss 0.5=50pips 10=1000pips
extern double TakeProfitRequest = 5.0;// TakeProfit 0.5=50pips 10=1000pips
extern int MaxSpread = 50;// Max spread (50=5pips)
extern int MaxError = 100;// Continuous order count limit (Max=100)
extern string CommentPositions = "ATR EA Trade";
extern int ATRPeriod = 14; // ATRの期間
extern double Multiplier = 1.0; // スーパートレンドの乗数
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage= 0;
// ティックが動くごとに処理
void OnTick()
{
if(Bars < 10)
{
return;
}
if(StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if(TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if(MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(),MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if(pos > 0)
{
Pips = 1.00;// ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}else if(Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}else if(Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}else if(Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}else if(Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}else if(Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}else if(Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}else if(Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}
//ここから改変可能
double atr = iATR(NULL, 0, ATRPeriod, 0); // ATRを取得
double superTrendUp = (High[1] + Low[1]) / 2 - Multiplier * atr; // スーパートレンドの上値ライン
double superTrendDown = (High[1] + Low[1]) / 2 + Multiplier * atr; // スーパートレンドの下値ライン
if(Close[1] > superTrendDown)
{
LongSign = true;
ShortSign = false;
}
else if(Close[1] < superTrendUp)
{
ShortSign = true;
LongSign = false;
}
else
{
LongSign = false;
ShortSign = false;
}
//ここまで改変可能
/*ここに決済ロジックを挿入*/
if(MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Orber\n";
}
else
{
spread_msg = "";
}
if(Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if(LongSign == true)
{
position_msg = "LongSign = true\n";
}
else
if(ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else
if(LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
//売買指示
if(LongSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション無し
CheckForOpenLong();// 新規ロングオーダー処理
e ++;
}
else
{
// ポジション保有中
CloseShortPosition();// ショートポジションを決済
}
}
if(ShortSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション無し
CheckForOpenShort();// 新規ショートオーダー処理
e ++;
}
else
{
// ポジション保有中
CloseLongPosition();// ロングポジションを決済
}
}
tmpstr = StringConcatenate(error_msg,spread_msg,position_msg);
Comment(tmpstr);
}
//保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys=0;
int sells=0;
int icount;
for(icount = 0 ; icount < OrdersTotal() ; icount++)
{
if(OrderSelect(icount,SELECT_BY_POS,MODE_TRADES) == false)
{
break;
}
if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType()==OP_BUY)
{
buys++;
}
if(OrderType()==OP_SELL)
{
sells++;
}
}
}
if(buys > 0)
{
return(buys);
}
else
{
return(-sells);
}
}
//ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
if(OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if(ret == false)
{
Print("エラーコード=",GetLastError());
}
break;
}
}
}
//ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
if(OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if(ret == false)
{
Print("エラーコード=",GetLastError());
}
break;
}
}
}
//ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots,2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
//ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots,2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【1位】
2024年6月25日公開
GMMA EA Trade
ドル円15分足チャート
PF 1.26(始値のみ)
全ティック 1.33
↓EAのコードはこちら↓
//1位
//2024年6月25日公開
//GMMA EA Trade
//https://note.com/aimjey/n/nd82c00b04def
//ドル円15分足チャート
//PF 1.26(始値のみ)
//全ティック 1.33
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240610;// Magic number
extern double Lots = 0.1;//1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0;// StopLoss 0.5=50pips 1.0=100pips 10=1000pips
extern double TakeProfitRequest = 5.0;// TakeProfit 0.5=50pips 1.0=100pips 10=1000pips
extern int MaxSpread = 50;// Max spread (50=5pips)
extern int MaxError = 100;// Continuous order count limit (Max=100)
extern string CommentPositions = "GMMA EA Trade";
//ここから改変可能
extern int ShortMovingPeriod1 = 10;
extern int ShortMovingPeriod2 = 15;
extern int ShortMovingPeriod3 = 20;
extern int ShortMovingPeriod4 = 25;
extern int ShortMovingPeriod5 = 30;
extern int ShortMovingPeriod6 = 40;
extern int LongMovingPeriod1 = 45;
extern int LongMovingPeriod2 = 45;
extern int LongMovingPeriod3 = 50;
extern int LongMovingPeriod4 = 55;
extern int LongMovingPeriod5 = 60;
extern int LongMovingPeriod6 = 95;
//ここまで改変可能
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage = 0;
// ティックが動くごとに処理
void OnTick()
{
if(Bars < 10)
{
return;
}
if(StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if(TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if(MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(), MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if(pos > 0)
{
Pips = 1.00;// ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}
else if(Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}
else if(Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}
else if(Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}
else if(Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}
else if(Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}
else if(Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}
else if(Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}
else if(Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
//ここから改変可能
double shortMAs[6];
shortMAs[0] = iMA(NULL, 0, ShortMovingPeriod1, 0, MODE_SMA, PRICE_CLOSE, 0);
shortMAs[1] = iMA(NULL, 0, ShortMovingPeriod2, 0, MODE_SMA, PRICE_CLOSE, 0);
shortMAs[2] = iMA(NULL, 0, ShortMovingPeriod3, 0, MODE_SMA, PRICE_CLOSE, 0);
shortMAs[3] = iMA(NULL, 0, ShortMovingPeriod4, 0, MODE_SMA, PRICE_CLOSE, 0);
shortMAs[4] = iMA(NULL, 0, ShortMovingPeriod5, 0, MODE_SMA, PRICE_CLOSE, 0);
shortMAs[5] = iMA(NULL, 0, ShortMovingPeriod6, 0, MODE_SMA, PRICE_CLOSE, 0);
double longMAs[6];
longMAs[0] = iMA(NULL, 0, LongMovingPeriod1, 0, MODE_SMA, PRICE_CLOSE, 0);
longMAs[1] = iMA(NULL, 0, LongMovingPeriod2, 0, MODE_SMA, PRICE_CLOSE, 0);
longMAs[2] = iMA(NULL, 0, LongMovingPeriod3, 0, MODE_SMA, PRICE_CLOSE, 0);
longMAs[3] = iMA(NULL, 0, LongMovingPeriod4, 0, MODE_SMA, PRICE_CLOSE, 0);
longMAs[4] = iMA(NULL, 0, LongMovingPeriod5, 0, MODE_SMA, PRICE_CLOSE, 0);
longMAs[5] = iMA(NULL, 0, LongMovingPeriod6, 0, MODE_SMA, PRICE_CLOSE, 0);
bool longCondition = true;
bool shortCondition = true;
for(int i = 0; i < 6; i++)
{
if(shortMAs[i] <= longMAs[i])
{
longCondition = false;
}
if(shortMAs[i] >= longMAs[i])
{
shortCondition = false;
}
}
if(longCondition)
{
LongSign = true;
ShortSign = false;
}
else if(shortCondition)
{
ShortSign = true;
LongSign = false;
}
else
{
LongSign = false;
ShortSign = false;
}
//ここまで改変可能
if(MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Orber\n";
}
else
{
spread_msg = "";
}
if(Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if(e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if(LongSign == true)
{
position_msg = "LongSign = true\n";
}
else if(ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else if(LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
//売買指示
if(LongSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenLong();// 新規ロングオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseShortPosition();// ショートポジションがある場合のみ決済ロング処理
}
}
if(ShortSign == true)
{
if(CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenShort();// 新規ショートオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseLongPosition();// ロングポジションがある場合のみ決済ショート処理
}
}
tmpstr = StringConcatenate(error_msg, spread_msg, position_msg);
Comment(tmpstr);
}
//保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys = 0;
int sells = 0;
int icount;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType() == OP_BUY)
{
buys++;
}
if(OrderType() == OP_SELL)
{
sells++;
}
}
}
if(buys > 0)
{
return(buys);
}
else
{
return(-sells);
}
}
//ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ショートポジションの場合⇒ロングエントリー
if(OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if(ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
//ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for(icount = 0; icount < OrdersTotal(); icount++)
{
if(OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if(OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
//ロングポジションの場合⇒ショートエントリー
if(OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if(ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
//ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
//ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
【番外編】
2024年6月27日公開
Ichimoku Asasukya EA
GBPJPY 15M
PF 1.17(始値のみ)
全ティック 1.53 トレード少ない
↓EAのコードはこちら↓
//番外編
//2024年6月27日公開
//Ichimoku Asasukya EA
//https://note.com/aimjey/n/nb5cb06a1f9d0
//GBPJPY 15M
//PF 1.17(始値のみ)
//全ティック 1.53 トレード少ない
//+------------------------------------------------------------------+
//| Masayan EA Generator_1.01.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Masayan."
#property version "1.01"
#property strict
#property description "https://fx.reform-network.net"
extern int Magic = 20240610;// Magic number
extern double Lots = 0.1;//1.0=100000 0.1=10000 0.01=1000
extern double StopLossRequest = 4.0;// StopLoss 0.5=50pips 1.0=100pips 10=1000pips
extern double TakeProfitRequest = 5.0;// TakeProfit 0.5=50pips 1.0=100pips 10=1000pips
extern int MaxSpread = 50;// Max spread (50=5pips)
extern int MaxError = 100;// Continuous order count limit (Max=100)
extern string CommentPositions = "Ichimoku Asasukya EA";
// ここから改変可能
extern int TenkanSenPeriod = 9;
extern int KijunSenPeriod = 26;
extern int SenkouSpanBPeriod = 52;
// ここまで改変可能
string tmpstr;
string error_msg;
string spread_msg;
string position_msg;
bool LongSign = false;
bool ShortSign = false;
double Pips = 0.01;
int e = 0;
int Adjusted_Slippage = 0;
// ティックが動くごとに処理
void OnTick()
{
if (Bars < 52)
{
return;
}
if (StopLossRequest <= 0.1)
{
StopLossRequest = 0.1;
}
if (TakeProfitRequest <= 0.1)
{
TakeProfitRequest = 0.1;
}
if (MaxError >= 100)
{
MaxError = 100;
}
double Info_Spread = MarketInfo(Symbol(), MODE_SPREAD);
string value = Symbol();
string target = "JPY";
int pos = StringFind(value, target);
double Symbol_RATE = Close[1];
if (pos > 0)
{
Pips = 1.00; // ドルストレートは0.010(100pips)、クロス円は1.0(100pips)で判定
}
else if (Symbol_RATE > 10 && Symbol_RATE <= 100)
{
Pips = 0.1;
}
else if (Symbol_RATE > 100 && Symbol_RATE <= 1000)
{
Pips = 1.0;
}
else if (Symbol_RATE > 1000 && Symbol_RATE <= 10000)
{
Pips = 10.0;
}
else if (Symbol_RATE > 10000 && Symbol_RATE <= 100000)
{
Pips = 100.0;
}
else if (Symbol_RATE > 100000 && Symbol_RATE <= 1000000)
{
Pips = 1000.0;
}
else if (Symbol_RATE > 1000000 && Symbol_RATE <= 10000000)
{
Pips = 10000.0;
}
else if (Symbol_RATE > 10000000 && Symbol_RATE <= 100000000)
{
Pips = 100000.0;
}
else if (Symbol_RATE > 100000000)
{
Pips = 1000000.0;
}
// ここから改変可能
double tenkan_sen = iIchimoku(NULL, 0, TenkanSenPeriod, KijunSenPeriod, SenkouSpanBPeriod, MODE_TENKANSEN, 1);
double kijun_sen = iIchimoku(NULL, 0, TenkanSenPeriod, KijunSenPeriod, SenkouSpanBPeriod, MODE_KIJUNSEN, 1);
double prev_tenkan_sen = iIchimoku(NULL, 0, TenkanSenPeriod, KijunSenPeriod, SenkouSpanBPeriod, MODE_TENKANSEN, 2);
double prev_kijun_sen = iIchimoku(NULL, 0, TenkanSenPeriod, KijunSenPeriod, SenkouSpanBPeriod, MODE_KIJUNSEN, 2);
double prev_close = Close[1];
double prev2_close = Close[2];
bool golden_cross = (prev_tenkan_sen <= prev_kijun_sen) && (tenkan_sen > kijun_sen) && (prev_close < Open[1]);
bool dead_cross = (prev_tenkan_sen >= prev_kijun_sen) && (tenkan_sen < kijun_sen) && (prev_close > Open[1]);
int current_hour = Hour();
if ((current_hour >= 21 || current_hour < 3))
{
if (golden_cross)
{
ShortSign = true;
LongSign = false;
}
else if (dead_cross)
{
LongSign = true;
ShortSign = false;
}
}
// ここまで改変可能
if (MaxSpread < Info_Spread)
{
LongSign = false;
ShortSign = false;
spread_msg = "Max spread Order\n";
}
else
{
spread_msg = "";
}
if (Hour() == 4 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (Hour() == 11 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (Hour() == 18 && Minute() == 0 && Seconds() < 6)
{
e = 0;
}
if (e > MaxError)
{
LongSign = false;
ShortSign = false;
error_msg = "Continuous order count limit\n";
}
else
{
error_msg = "";
}
if (LongSign == true)
{
position_msg = "LongSign = true\n";
}
else if (ShortSign == true)
{
position_msg = "ShortSign = true\n";
}
else if (LongSign == false && ShortSign == false)
{
position_msg = "No Sign\n";
}
// 売買指示
if (LongSign == true)
{
if (CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenLong(); // 新規ロングオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseShortPosition(); // ショートポジションがある場合のみ決済ロング処理
}
}
if (ShortSign == true)
{
if (CalculateCurrentOrders() == 0)
{
// ポジション保有していない場合
CheckForOpenShort(); // 新規ショートオーダー処理を行う
e++;
}
else
{
// ポジション保有している場合
CloseLongPosition(); // ロングポジションがある場合のみ決済ショート処理
}
}
tmpstr = StringConcatenate(error_msg, spread_msg, position_msg);
Comment(tmpstr);
}
// 保有中のポジションを計算
int CalculateCurrentOrders(void)
{
int buys = 0;
int sells = 0;
int icount;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if (OrderType() == OP_BUY)
{
buys++;
}
if (OrderType() == OP_SELL)
{
sells++;
}
}
}
if (buys > 0)
{
return (buys);
}
else
{
return (-sells);
}
}
// ショートポジション⇒ロングクローズ処理
void CloseShortPosition()
{
int icount;
bool ret;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
// ショートポジションの場合⇒ロングエントリー
if (OrderType() == OP_SELL)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Ask,
Adjusted_Slippage,
clrBlue);
if (ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
// ロングポジション⇒ショートクローズ処理
void CloseLongPosition()
{
int icount;
bool ret;
for (icount = 0; icount < OrdersTotal(); icount++)
{
if (OrderSelect(icount, SELECT_BY_POS, MODE_TRADES) == false)
{
break;
}
if (OrderMagicNumber() != Magic || OrderSymbol() != Symbol())
{
continue;
}
// ロングポジションの場合⇒ショートエントリー
if (OrderType() == OP_BUY)
{
ret = OrderClose(
OrderTicket(),
OrderLots(),
Bid,
Adjusted_Slippage,
clrRed);
if (ret == false)
{
Print("オーダークローズエラー:エラーコード=", GetLastError());
}
break;
}
}
}
// ロングオーダー処理
void CheckForOpenLong()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_BUY,
entrylot,
Ask,
Adjusted_Slippage,
Ask - (Pips * StopLossRequest),
Ask + (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrRed);
return;
}
// ショートオーダー処理
void CheckForOpenShort()
{
int res;
double entrylot;
entrylot = NormalizeDouble(Lots, 2);
res = OrderSend(
Symbol(),
OP_SELL,
entrylot,
Bid,
Adjusted_Slippage,
Bid + (Pips * StopLossRequest),
Bid - (Pips * TakeProfitRequest),
CommentPositions,
Magic,
0,
clrBlue);
return;
}
番外編のIchimoku Asasukya EAですが、プロフィットファクターは1.53とランキング1位になるのですが、トレード回数が少なく利益でいうとそれほど勝てるわけではないので番外編として紹介しました。
いかがでしたか?
2025年度も勝てるEAが何個もあるでしょうから、興味のある方は、ダウンロードしてご利用いただければと思います。
最後に、わたくしまさやんからの宣伝になります。
昨日1月7日にYouTubeのショート動画でアップしましたGrid RashとFibonacciの2024年12月13日~2025年1月6日までのサインインジケーターを使用した裁量トレードの動画で使用したインジケーターを、ゴゴジャンで販売しています。
https://www.youtube.com/shorts/mFXXn4_snEo
勝率は6割を超える逆張りカウンタートレンドのサインインジケーターとなりますので、わたしの活動を支援してくださる方は、ぜひ購入をご検討いただければと思います。
Grid Rash
Grid Rash_Arrow_Indicator
ユーロドル5分足チャートに対応したスキャル系のサインインジケーター。
https://www.gogojungle.co.jp/tools/indicators/55251
Fibonacci Trend Indicator
ボリンジャーバンドとRSIを使用したスキャルの手法に、フィボナッチリトレースメントの手法を融合させたドル円1分足チャートで動作するサインインジケーター。
https://www.gogojungle.co.jp/tools/indicators/54005
【免責事項】
・本EAインジケーターについて、正当性を保証するものではありません。
・本EAインジケーターを利用して損失を被った場合でも一切の責任を負いません。
・投資の決定は、自己判断 自己責任でお願いします。