コーディングの方法は? - ページ 106 1...99100101102103104105106107108109110111112113...347 新しいコメント luxinterior 2008.06.30 03:28 #1051 それは、価格には有効だ。彼はイディケーターの最高値と最安値を見つけたいのです。 ラックス Erman Ardianto 2008.06.30 04:05 #1052 こんにちは。 あなたはこれを試すことができます。 .... int highest=0, lowest=0, bar=WindowBarsPerChart(); for(int shift=0;shift<bar;shift++) { double indie=iCustom(.........,shift); if(highest<indie) highest=indie; if(lowest==0) lowest=indie; if(lowest>indie) lowest=indie; } ..... 注:このコードは、現在のオープンローソクも計算し、あなたが閉じたローソクだけを計算したい場合は、shift = 1を使用してください。 これが役立つことを願っています。 Ardie IN10TION 2008.06.30 07:31 #1053 :: iBarShiftは、その日/時間に始まるバー...またはその日/時間の終了バー...を探します。(高値/安値を見つけるために開始したい時間枠やチャートに依存します)。int iBarShift( string symbol, int timeframe, datetime time, bool exact=false) 次に... :: iHighestとiLowestの結果を見つけるために、これらのバーポジションを使用します。 int iHighest( 文字列 symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0) int iLowest( 文字列シンボル, int timeframe, int type, int count=WHOLE_ARRAY, int start=0) :: 結果と完了 、この中でループを使わないでください! アスク! Ask! [ARCHIVE!] Any rookie question, Erman Ardianto 2008.06.30 11:40 #1054 プログラムによるリペイントインジケータの更新 こんにちは。 リペイントインディケータをX分毎に更新する方法を探しています。 現在、リフレッシュする唯一の方法は、チャート上のインジケータをクリックし、"ok "をクリックすることです。MQL4コードで自動化できないでしょうか? codersguruのサイトで、Programmatically Refresh your charts | www.metatrader.info というのを見つけたのですが、私には使えないようです。それとも、どなたかこれを試して、違う結果(動作)を得た方はいらっしゃいますか? ありがとうございます。 IngvarDagmar 2008.07.01 21:28 #1055 私の英語で申し訳ありません。 条件が成立した回数を1つのバーに1回だけカウントしたいのですが。 コンピュータは、バーごとに何回も追加されます。 私は何を間違っていますか? luxinterior 2008.07.01 22:25 #1056 IngvarDagmar: 条件が成立した回数をバーごとに1回だけカウントしたいのですが。 コンピュータは、バーごとに何回も追加します。 私は何を間違っていますか? このような関数を 使用します... bool NewBar() { static datetime LastTime = 0; if (Time[0] != LastTime) { LastTime = Time[0]; return (true); } else return (false); } [/php] Then put an if statement round your main code, like... [php] if(NewBar() == true){ // do the main processing here } お役に立てれば幸いです。 ラックス How to code? Ask! Programming question using Close[] TheRumpledOne 2008.07.01 22:55 #1057 ラックスさん、よかったですね。 こんなのを見つけました。 各バーを一度だけ処理する - MQL4 forum Automated 2008.01.15 18:54 新しいバーの最初のティック(つまり、前のバーが閉じた直後)でコードを実行することができます。 以下は、新しいバーが形成されたときに TRUE を返す関数です。 // この関数は、新しいバーの最初のティック、すなわち前のバーが閉じた直後に TRUE を返します。 bool NewBar() { if(PreviousBarTime<Time[0]) { PreviousBarTime = Time[0]; return(true)とする。 } return(false); // if - else文が実行されない場合 EAの冒頭でPreviousBarTimeという日時を宣言する必要があります。 そして、あなたのコードでは、次のように使用することができます。 if ( NewBar() ) { ......ここでバーが閉じた後に実行される必要があるコード......。 ありがとうございました。 automatedfx@gmail.com --------------------------------------------------- STATICを使ってるんですね...。私はそれを調べた...STATICを使用することの利点は、グローバル変数と比較して何ですか? How to code? 非常にシンプルなEAを作成するためのヘルプが必要 どんな新人の質問でも、フォーラムを乱雑にしないように。プロフェッショナルは、通り過ぎないでください。Nowhere without you - mich21 2008.07.02 23:13 #1058 マルチエントリーEA 私は次の入力パラメータでEAを作成するために見つけるか、または助けを必要としたいと思います。4つの別々のトレードエントリは、ロット数、ストップロス、トレーリングストップ、ブレークイーブン、および利益目標を持っています。 ありがとうございます 削除済み 2008.07.03 10:52 #1059 トレーリングストップオプションのヘルプが必要です MQL4フォーラムでこのEAを見つけたのですが、なかなか面白いEAですね。 どなたか、トレーリングストップのオプションを追加するのを手伝っていただけませんか? themastermind2.mq4 ファイル: themastermind2.mq4 33 kb 削除済み 2008.07.03 14:09 #1060 皆さん、こんにちは。 MACDが「n」の形になると売りのポストをオープンし、「u」の形になると買いのポストをオープンします。 問題は、EAがポストを開かないことです。 ここにコードがあります... extern double TakeProfit = 20; extern double Lots = 0.1; extern double StopLoss = 20; extern double MagicNumber = 17384; extern int FastEMA=12; extern int SlowEMA=26; extern int SignalSMA=9; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ double MacdBuffer1[]; double MacdBuffer2[]; double MacdBuffer3[]; double MacdBuffer4[]; double MacdBuffer5[]; double MacdBuffer6[]; double MacdBuffer7[]; double MacdBuffer8[]; int init() { //---- //SetIndexBuffer(0, lag1_buffer); //SetIndexBuffer(1, lag2_buffer); //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- macd counted in the 1-st buffer for(int i=0; i<limit; i++) MacdBuffer1=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i); MacdBuffer2=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i-1)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i-1); MacdBuffer3=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i+1)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i+1); MacdBuffer4=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i-2)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i-2); MacdBuffer5=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i+2)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i+2); MacdBuffer6=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i-3)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i-3); MacdBuffer7=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i+3)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i+3); /*Alert( "MacdBuffer7 =",MacdBuffer7); Alert( "MacdBuffer5 =",MacdBuffer5); Alert( "MacdBuffer3 =",MacdBuffer3); Alert( "MacdBuffer1 =",MacdBuffer1); Alert( "MacdBuffer2 =",MacdBuffer2); Alert( "MacdBuffer4 =",MacdBuffer4); Alert( "MacdBuffer6 =",MacdBuffer6);*/ //---- int ticket_buy, ticket_sell, total; total=OrdersTotal(); //MACD become 'u' shape if (MacdBuffer7>MacdBuffer5&&MacdBuffer5>MacdBuffer3&&MacdBuffer3>MacdBuffer1 &&MacdBuffer1<MacdBuffer2&&MacdBuffer2<MacdBuffer4&&MacdBuffer4<MacdBuffer6) { if (total < 1) { ticket_buy=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"scalp 1 min - buy",MagicNumber,0,Green); if(ticket_buy>0) { if(OrderSelect(ticket_buy,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice()); } else Print("Error opening BUY order : ",GetLastError()); return(0); } else { } } //MACD become 'n' shape if(MacdBuffer7<MacdBuffer5&&MacdBuffer5<MacdBuffer3&&MacdBuffer3<MacdBuffer1 &&MacdBuffer1>MacdBuffer2&&MacdBuffer2>MacdBuffer4&&MacdBuffer4>MacdBuffer6) { if (total < 1) { ticket_sell=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"scalp 1 min - sell",MagicNumber,0,Red); if(ticket_sell>0) { if(OrderSelect(ticket_sell,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice()); } else Print("Error opening SELL order : ",GetLastError()); return(0); } else { } } //---- return(0); } //+------------------------------------------------------------------+ 誰かがこの問題を解決するのを助けてくれることを願っています。 How to code? EAが複数のペアで実行されない、助けが必要 [警告は閉鎖されました!】フォーラムを乱雑にしないために、どんな初心者の質問でも。プロフェッショナルは、通り過ぎないでください。あなたなしでは、どこにも行けない。 1...99100101102103104105106107108109110111112113...347 新しいコメント 取引の機会を逃しています。 無料取引アプリ 8千を超えるシグナルをコピー 金融ニュースで金融マーケットを探索 新規登録 ログイン スペースを含まないラテン文字 このメールにパスワードが送信されます エラーが発生しました Googleでログイン WebサイトポリシーおよびMQL5.COM利用規約に同意します。 新規登録 MQL5.com WebサイトへのログインにCookieの使用を許可します。 ログインするには、ブラウザで必要な設定を有効にしてください。 ログイン/パスワードをお忘れですか? Googleでログイン
それは、価格には有効だ。彼はイディケーターの最高値と最安値を見つけたいのです。
ラックス
こんにちは。
あなたはこれを試すことができます。
....
int highest=0, lowest=0, bar=WindowBarsPerChart();
for(int shift=0;shift<bar;shift++)
{
double indie=iCustom(.........,shift);
if(highest<indie) highest=indie;
if(lowest==0) lowest=indie;
if(lowest>indie) lowest=indie;
}
.....
注:このコードは、現在のオープンローソクも計算し、あなたが閉じたローソクだけを計算したい場合は、shift = 1を使用してください。
これが役立つことを願っています。
Ardie
プログラムによるリペイントインジケータの更新
こんにちは。
リペイントインディケータをX分毎に更新する方法を探しています。
現在、リフレッシュする唯一の方法は、チャート上のインジケータをクリックし、"ok "をクリックすることです。MQL4コードで自動化できないでしょうか?
codersguruのサイトで、Programmatically Refresh your charts | www.metatrader.info というのを見つけたのですが、私には使えないようです。それとも、どなたかこれを試して、違う結果(動作)を得た方はいらっしゃいますか?
ありがとうございます。
私の英語で申し訳ありません。
条件が成立した回数を1つのバーに1回だけカウントしたいのですが。 コンピュータは、バーごとに何回も追加されます。 私は何を間違っていますか?
条件が成立した回数をバーごとに1回だけカウントしたいのですが。 コンピュータは、バーごとに何回も追加します。 私は何を間違っていますか?
このような関数を 使用します...
bool NewBar() {
static datetime LastTime = 0;
if (Time[0] != LastTime) {
LastTime = Time[0];
return (true);
} else
return (false);
}
[/php]
Then put an if statement round your main code, like...
[php]
if(NewBar() == true){
// do the main processing here
}
お役に立てれば幸いです。
ラックス
ラックスさん、よかったですね。
こんなのを見つけました。
各バーを一度だけ処理する - MQL4 forum
Automated 2008.01.15 18:54 新しいバーの最初のティック(つまり、前のバーが閉じた直後)でコードを実行することができます。
以下は、新しいバーが形成されたときに TRUE を返す関数です。
// この関数は、新しいバーの最初のティック、すなわち前のバーが閉じた直後に TRUE を返します。
bool NewBar()
{
if(PreviousBarTime<Time[0])
{
PreviousBarTime = Time[0];
return(true)とする。
}
return(false); // if - else文が実行されない場合
EAの冒頭でPreviousBarTimeという日時を宣言する必要があります。
そして、あなたのコードでは、次のように使用することができます。
if ( NewBar() )
{
......ここでバーが閉じた後に実行される必要があるコード......。
ありがとうございました。
automatedfx@gmail.com
---------------------------------------------------
STATICを使ってるんですね...。私はそれを調べた...STATICを使用することの利点は、グローバル変数と比較して何ですか?
マルチエントリーEA
私は次の入力パラメータでEAを作成するために見つけるか、または助けを必要としたいと思います。4つの別々のトレードエントリは、ロット数、ストップロス、トレーリングストップ、ブレークイーブン、および利益目標を持っています。
ありがとうございます
トレーリングストップオプションのヘルプが必要です
MQL4フォーラムでこのEAを見つけたのですが、なかなか面白いEAですね。
どなたか、トレーリングストップのオプションを追加するのを手伝っていただけませんか?
themastermind2.mq4
皆さん、こんにちは。
MACDが「n」の形になると売りのポストをオープンし、「u」の形になると買いのポストをオープンします。
問題は、EAがポストを開かないことです。
ここにコードがあります...
extern double TakeProfit = 20;
extern double Lots = 0.1;
extern double StopLoss = 20;
extern double MagicNumber = 17384;
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
double MacdBuffer1[];
double MacdBuffer2[];
double MacdBuffer3[];
double MacdBuffer4[];
double MacdBuffer5[];
double MacdBuffer6[];
double MacdBuffer7[];
double MacdBuffer8[];
int init()
{
//----
//SetIndexBuffer(0, lag1_buffer);
//SetIndexBuffer(1, lag2_buffer);
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=0; i<limit; i++)
MacdBuffer1=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
MacdBuffer2=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i-1)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i-1);
MacdBuffer3=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i+1)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i+1);
MacdBuffer4=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i-2)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i-2);
MacdBuffer5=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i+2)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i+2);
MacdBuffer6=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i-3)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i-3);
MacdBuffer7=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i+3)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i+3);
/*Alert( "MacdBuffer7 =",MacdBuffer7);
Alert( "MacdBuffer5 =",MacdBuffer5);
Alert( "MacdBuffer3 =",MacdBuffer3);
Alert( "MacdBuffer1 =",MacdBuffer1);
Alert( "MacdBuffer2 =",MacdBuffer2);
Alert( "MacdBuffer4 =",MacdBuffer4);
Alert( "MacdBuffer6 =",MacdBuffer6);*/
//----
int ticket_buy, ticket_sell, total;
total=OrdersTotal();
//MACD become 'u' shape
if (MacdBuffer7>MacdBuffer5&&MacdBuffer5>MacdBuffer3&&MacdBuffer3>MacdBuffer1
&&MacdBuffer1<MacdBuffer2&&MacdBuffer2<MacdBuffer4&&MacdBuffer4<MacdBuffer6)
{
if (total < 1) {
ticket_buy=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"scalp 1 min - buy",MagicNumber,0,Green);
if(ticket_buy>0)
{
if(OrderSelect(ticket_buy,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
} else {
}
}
//MACD become 'n' shape
if(MacdBuffer7<MacdBuffer5&&MacdBuffer5<MacdBuffer3&&MacdBuffer3<MacdBuffer1
&&MacdBuffer1>MacdBuffer2&&MacdBuffer2>MacdBuffer4&&MacdBuffer4>MacdBuffer6)
{
if (total < 1) {
ticket_sell=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"scalp 1 min - sell",MagicNumber,0,Red);
if(ticket_sell>0)
{
if(OrderSelect(ticket_sell,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
} else {
}
}
//----
return(0);
}
//+------------------------------------------------------------------+誰かがこの問題を解決するのを助けてくれることを願っています。