int CSignalMA::LongCondition(void) { int result=0; int idx=StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); } //+------------------------------------------------------------------+ //| "Voting" that price will fall. | //+------------------------------------------------------------------+ int CSignalMA::ShortCondition(void) { int result=0; int idx =StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); } //+------------------------------------------------------------------+
int CSignalMA::LongCondition(void) { int result=0; int idx=StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); } //+------------------------------------------------------------------+ //| "Voting" that price will fall. | //+------------------------------------------------------------------+ int CSignalMA::ShortCondition(void) { int result=0; int idx =StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); } //+------------------------------------------------------------------+
int CSignalMA::LongCondition(void) { int result=0; int idx=StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); }
int CSignalMA::LongCondition(void) { int result=0; int idx=StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); }
//+------------------------------------------------------------------+ //| "Voting" that price will grow. | //+------------------------------------------------------------------+ int CSignalMA::LongCondition(void) { int result=0; int idx =StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0) { //--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards result=m_pattern_1; //--- consider that this is an unformed "piercing" and suggest to enter the market at the current price m_base_price=0.0; } } else { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; //--- if the indicator is directed upwards if(DiffMA(idx)>0.0) { if(DiffOpenMA(idx)<0.0) { //--- if the model 2 is used if(IS_PATTERN_USAGE(2)) { //--- the open price is below the indicator (i.e. there was an intersection) result=m_pattern_2; //--- suggest to enter the market at the "roll back" m_base_price=m_symbol.NormalizePrice(MA(idx)); } } else { //--- if the model 3 is used and the open price is above the indicator if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0) { //--- the low price is below the indicator result=m_pattern_3; //--- consider that this is a formed "piercing" and suggest to enter the market at the current price m_base_price=0.0; } } } } //--- return the result return(result); }
//+------------------------------------------------------------------+ //| "Voting" that price will grow. | //+------------------------------------------------------------------+ int CSignalMA::LongCondition(void) { int result=0; int idx =StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0) { //--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards result=m_pattern_1; //--- consider that this is an unformed "piercing" and suggest to enter the market at the current price m_base_price=0.0; } } else { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; //--- if the indicator is directed upwards if(DiffMA(idx)>0.0) { if(DiffOpenMA(idx)<0.0) { //--- if the model 2 is used if(IS_PATTERN_USAGE(2)) { //--- the open price is below the indicator (i.e. there was an intersection) result=m_pattern_2; //--- suggest to enter the market at the "roll back" m_base_price=m_symbol.NormalizePrice(MA(idx)); } } else { //--- if the model 3 is used and the open price is above the indicator if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0) { //--- the low price is below the indicator result=m_pattern_3; //--- consider that this is a formed "piercing" and suggest to enter the market at the current price m_base_price=0.0; } } } } //--- return the result return(result); }
ウラジミール、それを理解し、走らせることができた。ここで売り注文と 買い注文を入れ替えるにはどうしたらいいですか?
各シグナルモジュールには2つの機能があり、売買シグナルを発行するために使用されます。LongCondition "と "ShortCondition "である。
各シグナルモジュールには2つの機能があり、売買シグナルを発行するために使用されます。LongCondition "と "ShortCondition "である。
あなたのEAではこれらがそうだと理解しています。
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
//| "Voting" that price will fall. |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
と、ここでの線引きはどこに責任があるのでしょうか?また、このプロパティを変更するにはどうしたらよいですか?
あなたのEAではこうなんですね。
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
//| "Voting" that price will fall. |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
と、ここでの線引きはどこに責任があるのでしょうか?また、このプロパティを変更するにはどうしたらよいですか?
コードを正しく挿入してください:フォーラムでコードを正しく挿入 する
コードからではなく、SIGNALS MODULEから引用していますね。
私のモジュールには "Reverse "という設定があり、その値(trueまたはfalse)により、信号を直接反転させることができるので、信号の方向を変えるために何かを変更する必要はないのです。
LongCondition」の例で。
逆張り("m_reverse")が真で、終値から指標値を引いた値が0より 大きければ、「ロング」(買い、buy)のシグナルを 出します。
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
コードを正しく挿入してください:フォーラムでコードを正しく挿入 する
ADVISORのコードではなく、SIGNAL MODULEのコードを貼り付けていますね。
私のモジュールには「Reverse」という設定があるので、信号の方向を変えるために何かを変える必要はありません。この設定がどのような値(trueまたはfalse)であるかによって、信号を直接反転させることができます。
LongCondition」の例で。
m_reverse "が真で、終値から指標値を引いた値が0より 大きい場合-シグナルは "ロング"(買い、buy)です。
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
ウラジミール、新たな問題が発生した。Expert Advisorがコンパイルされましたが、チャートにドラッグして設定に同意しようとしたところ。右側にExpert Advisorが起動したことを示すアイコンが表示されていますね。そして、一気に消え去る。その理由は何でしょうか。この逆がいいんです。他のEAではどのように応用できるのか?
ウラジミール、新たな問題が発生した。あなたのEAはコンパイルされましたが、チャートにドラッグして設定に同意しようとすると。右隅にEAがしばらく稼働していますというアイコンが表示されています。そして、一気に消え去る。その理由は何でしょうか。この逆がいいんです。他のEAにどのように応用できるのか?
ターミナルの「ツールボックス」ウィンドウの「エキスパート」「ジャーナル」タブで、エラーメッセージを 探す...。
SignalMA.mqhファイルの「価格が上昇する」場合にポジションを建てる 役割を担っているセクションだと理解しているのですが?
//| "Voting" that price will grow. |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator
if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
{
//--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
result=m_pattern_1;
//--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
else
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
//--- if the indicator is directed upwards
if(DiffMA(idx)>0.0)
{
if(DiffOpenMA(idx)<0.0)
{
//--- if the model 2 is used
if(IS_PATTERN_USAGE(2))
{
//--- the open price is below the indicator (i.e. there was an intersection)
result=m_pattern_2;
//--- suggest to enter the market at the "roll back"
m_base_price=m_symbol.NormalizePrice(MA(idx));
}
}
else
{
//--- if the model 3 is used and the open price is above the indicator
if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
{
//--- the low price is below the indicator
result=m_pattern_3;
//--- consider that this is a formed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
}
}
//--- return the result
return(result);
}
これをあなたのモジュールのコードに置き換えたらどうでしょう、正しく動作するでしょうか。自分とは少し違う内容になっていることです。ここにさらにコードが......うーん。
SignalMA.mqhファイルの「価格が上昇する」場合にポジションを建てる 役割を担っているセクションだと理解しているのですが?
//| "Voting" that price will grow. |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator
if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
{
//--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
result=m_pattern_1;
//--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
else
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
//--- if the indicator is directed upwards
if(DiffMA(idx)>0.0)
{
if(DiffOpenMA(idx)<0.0)
{
//--- if the model 2 is used
if(IS_PATTERN_USAGE(2))
{
//--- the open price is below the indicator (i.e. there was an intersection)
result=m_pattern_2;
//--- suggest to enter the market at the "roll back"
m_base_price=m_symbol.NormalizePrice(MA(idx));
}
}
else
{
//--- if the model 3 is used and the open price is above the indicator
if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
{
//--- the low price is below the indicator
result=m_pattern_3;
//--- consider that this is a formed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
}
}
//--- return the result
return(result);
}
これをあなたのモジュールのコードに置き換えたらどうでしょう、正しく動作するでしょうか。自分とは少し違う内容になっていることです。ここにさらにコードが......うーん。
私のコードをそのままここに貼り付けても、うまくいきません。
私のコードをそのままここに貼り付けても、うまくいきません。
もし、私のコードをそのままここに貼り付けても、うまくいきません。
ウラジミール、逆はどこに貼り付ければいいんだ?
明らかに、ファイルのコピーを作成し、このinludeの名前を変更する必要があります。
標準信号モジュールで信号をリバースに変更したい場合。
//+------------------------------------------------------------------+
//| Description of the class |
//| Title=*** |
//| Type=SignalAdvanced |
//| Name=Moving Average |
標準信号モジュールで信号をリバースに変更したい場合。
//+------------------------------------------------------------------+
//| Description of the class |
//| Title=*** |
//| Type=SignalAdvanced |
//| Name=Moving Average |
ウラジミールさん、ありがとうございます。あとは、EAが出すテイクプロフィット 注文とストップロス注文をどう作るかです。制限をかけるにはどうしたらいいですか?