[アーカイブ!】どんなルーキーの質問でも、フォーラムを散らかさないように。プロフェッショナルの皆さん、通り過ぎないでください。あなたなしではどこにも行けない - 2. - ページ 229

 
Sh.ProTrader:

みなさん、こんにちは。

この質問について、ご教授ください。

EURUSD通貨ペアのオープニング(Open[i])またはクロージング(Close[i])の正確な値をゼロ以降の5桁の値で取得しようとしていますが、応答では常に丸められた値が得られます!


値を表示するときは DoubleToStr(value,Digits) 関数を使用します。
 

こんにちは。

初心者なので質問させてください。

MQL4で現在の「利益」をオープンポジションと 合計で取得する方法、現在の残高に関するデータを取得する方法。

 

Documentationには アカウント情報の 項目があります。もし、どの注文情報にも対応する機能がなければ、すべての注文を調べて、正しい情報を取得しなければなりません。

 

ローソク足があるフィボナッチレベルの下で閉じたか、上で閉じたかを判断する方法を教えてください。

Close[i]は明確ですが、価格に対する水準はどのように把握すればよいのでしょうか。

 
alsu:
値を表示する場合は DoubleToStr(value, Digits) を使用する。

ありがとうございました。

私はすでにそれを理解し、フォーラム全体を検索し、このトピックで、しかし誰も明確に答えていない、それは実際には非常に簡単です。

DoubleToStr(value, Digits) を使わずにAlert()Comment()Print() で表示しようとしたときだけ、値が4桁に丸められることが判明したのです。

そして、プログラムは、あなたが丸めたい場合は、4番目の符号に丸めずに値を使用して計算するために、使用する必要があります。

NormalizeDouble( value,Dijist) です。

だから、もっと注意深くヘルプを読めば、すべてうまくいくはずです ;)

 
fury2006:

ローソク足があるフィボナッチファンレベルの下または上で閉じたかどうかを判断する方法を教えてください。

Close[i]は明確ですが、価格に対する水準はどのように把握すればよいのでしょうか。


レベルプライスはプログラムで要求する必要があります。このためには、あらかじめチャート上に "Fibo" オブジェクトを配置し、設定(すべてプログラムによる)しておく必要があります。これは一見すると簡単なようでいて、そうでもない。ただし、神々は食器を燃やさない。フィボレベルで勝負したこともありました。そして今、私はこのレベルの処理に取り組んでいます。一般的に、望めば、あなたはそれを理解することができます。

以下は、チャート上にFiboを作成するコードの例です。

if(Ind1>Ind2 && Ind2!=0){//индикатор прорисовался вверх, рисуем фибо вверх
      IndUp=true;IndDown=false;
      fff=ObjectFind("FiboLewels");
      if(fff==-1){
        if(!ObjectCreate("FiboLewels",OBJ_FIBO,0,Time[Maximum(Ind1)],Ind1,Time[Minimum(Ind2)],Ind2)){
          GeneralError();
        }
        if(!ObjectSet("FiboLewels",OBJPROP_COLOR,Red)||!ObjectSet("FiboLewels",OBJPROP_LEVELCOLOR,Blue)){
          GeneralError();
        }
        // ------ Устанавливаем количество уровней фибо ----------
                                if(!ObjectSet("FiboLewels",OBJPROP_FIBOLEVELS,22)){
                                        GeneralError();
                                }
                                // ------- Устанавливаем свойства фибоуровней ------------
                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+0,0)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 0,"0.0     %$")){GeneralError();}
   
                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+1,0.118)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 1,"11.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+2,0.236)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 2,"23.6     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+3,0.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 3,"38.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+4,0.5)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 4,"50.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+5,0.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 5,"61.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+6,0.764)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 6,"76.4     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+7,0.882)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 7,"88.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+8,1)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 8,"100.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+9,1.118)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 9,"111.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+10,1.236)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 10,"123.6     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+11,1.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 11,"138.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+12,1.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 12,"161.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+13,2)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 13,"200.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+14,2.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 14,"238.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+15,2.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 15,"261.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+16,3)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 16,"300.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+17,3.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 17,"338.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+18,3.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 18,"361.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+19,4)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 19,"400.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+20,4.236)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 20,"423.6     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+21,4.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 21,"461.8     %$")){GeneralError();}
      } 
    }

レベルの価格を要求するサブルーチンを作る必要がありました。ここにあります(お望みであれば、ご自分で考えてみてください)

// ------------- PriceSignLevelUp() -----------------------------------------------
// функция возвращает цену сигнального уровня при прорисовке индикатора вверх
//---------------------------------------------------------------------------------
double PriceSignLevelUp(double Level,double Ind1,double Ind2){
  double Fibo0=0,Fibo100=0,Rst=0;
  Fibo0=Ind2;
  Fibo100=Ind1;
  Rst=Ind1-Ind2;
  switch(Level){
    case 0:          Level=NormalizeDouble(Fibo0,digits); break;
    case 11.8:       Level=NormalizeDouble(Fibo0+Rst*0.118,digits); break;
    case 23.6:       Level=NormalizeDouble(Fibo0+Rst*0.236,digits); break;
    case 38.2:       Level=NormalizeDouble(Fibo0+Rst*0.382,digits); break;
    case 50:         Level=NormalizeDouble(Fibo0+Rst*0.5,digits); break;
    case 61.8:       Level=NormalizeDouble(Fibo0+Rst*0.618,digits); break;
    case 76.4:       Level=NormalizeDouble(Fibo0+Rst*0.764,digits); break;
    case 88.2:       Level=NormalizeDouble(Fibo0+Rst*0.882,digits); break;
    case 100:        Level=NormalizeDouble(Fibo100,digits); break;
    case 111.8:      Level=NormalizeDouble(Fibo0+Rst*1.118,digits); break;
    case 123.6:      Level=NormalizeDouble(Fibo0+Rst*1.236,digits); break;
    case 138.2:      Level=NormalizeDouble(Fibo0+Rst*1.382,digits); break;
    case 161.8:      Level=NormalizeDouble(Fibo0+Rst*1.618,digits); break;
    case 200:        Level=NormalizeDouble(Fibo0+Rst*2,digits); break;
    case 238.2:      Level=NormalizeDouble(Fibo0+Rst*2.382,digits); break;
    case 261.8:      Level=NormalizeDouble(Fibo0+Rst*2.618,digits); break;
    case 300:        Level=NormalizeDouble(Fibo0+Rst*3,digits); break;
    case 338.2:      Level=NormalizeDouble(Fibo0+Rst*3.382,digits); break;
    case 361.8:      Level=NormalizeDouble(Fibo0+Rst*3.618,digits); break;
    case 400:        Level=NormalizeDouble(Fibo0+Rst*4,digits); break;
    case 423.6:      Level=NormalizeDouble(Fibo0+Rst*4.236,digits); break;
    case 461.8:      Level=NormalizeDouble(Fibo0+Rst*4.618,digits); break;
  }         
  return(Level);
}
 

こんばんは!私自身は昨夜、「トレードの新次元」ウィリアムズ、昨日から30ページ、今日から50ページまで見直しました。

ロボットを作ったのですが、全く動作しません。テスターでは取引はできず、Alert("buy",GetLastError())では何も表示されません。

何か的確なアドバイスがあれば、ぜひお願いします。

//+------------------------------------------------------------------+
//| アリゲーター.mq4
//| 著作権 © 2011, MetaQuotes Software Corp.
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright"著作権 © 2011, MetaQuotes Software Corp.
#プロパティリンク "http://www.metaquotes.net"
extern int jaw_period=13,teeth_period=8,jaw_shift=8,tteeth_period=5,teeth_shift=5,lips_period=3,lips_shift=3;
extern double volume=0.1,stoploss=20,takeprofit=50。
//+------------------------------------------------------------------+
//| エキスパート初期化関数
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0)です。
}
//+------------------------------------------------------------------+
//| 専門家による初期化関数
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0)です。
}
//+------------------------------------------------------------------+
//| エキスパートスタート機能
//+------------------------------------------------------------------+
int tiketです。
int start()
{ダブルブルー、レッド、グリン。
//----
blu= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORJAW, 0) ... 。
red= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATOREETH, 0) ;
grin= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORLIPS, 0) ... 。
//----


double Fractalu,Fractall;Fractalu=iFractals( 0, 0, MODE_UPPER, 0) ;Fractall=iFractals( 0, 0,MODE_LOWER, 0) とする。


if (Fractalu>0&&Fractalu>blu&&Fractalu>red&&Fractalu>grin)
{ tiket= OrderSend( 0, OP_BUY, volume, Bid, Point*3, Bid- stoploss*Point, Bid+ takeprofit*Point, "Pose66", 1234567890, 0, Red);Alert("buy",GetLastError());}; { OP_BUY, volume, Bid, Point*Point, Bid+ takeprofit*Point, Pose66, 1234567890, 0, Red);Alert("buy",GetLastError())

if (Fractall>0&&Fractalu<blu&&Fractalu<red&&Fractalu<grin)です。


{ tiket= OrderSend( 0, OP_SELL, volume, Ask, Point*3, Ask+ stoploss*Point, Ask- takeprofit*Point, "Pose66", 1234567890, 0, Blue);Alert("sell",GetLastError());}; { OP_SELL, volume, Ask, Point*3, Ask- stoploss*Point, Ask- takeprofit*Point, "Pose66", 1234567890, 0, Blue)




return(0)です。
}
//+------------------------------------------------------------------+

 
Dimka-novitsek:

こんばんは!私自身は昨夜、「トレードの新次元」ウィリアムズ、昨日から30ページ、今日から50ページまで見直しました。

ロボットを作ったのですが、全く動作しません。テスターでは取引はできず、Alert("buy",GetLastError())では何も表示されません。

何か良いアドバイスがあれば、ぜひお願いします。

//+------------------------------------------------------------------+
//| アリゲーターニー.mq4 |。
//| 著作権 © 2011, MetaQuotes Software Corp.
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "著作権 © 2011, MetaQuotes Software Corp.
#プロパティリンク "http://www.metaquotes.net"
extern int jaw_period=13,teeth_period=8,jaw_shift=8,tteeth_period=5,teeth_shift=5,lips_period=3,lips_shift=3;
extern double volume=0.1,stoploss=20,takeprofit=50。
//+------------------------------------------------------------------+
//| エキスパート初期化関数
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0)です。
}
//+------------------------------------------------------------------+
//| 専門家による初期化関数
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0)です。
}
//+------------------------------------------------------------------+
//| エキスパートスタート機能
//+------------------------------------------------------------------+
int tiketです。
int start()
{ダブルブルー、レッド、グリン。
//----
blu= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORJAW, 0) ... 。
red= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATOREETH, 0) ;
grin= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORLIPS, 0) ... 。
//----


double Fractalu,Fractall;Fractalu=iFractals( 0, 0, MODE_UPPER, 0) ;Fractall=iFractals( 0, 0,MODE_LOWER, 0) とする。


if (Fractalu>0&&Fractalu>blu&&Fractalu>red&&Fractalu>grin)
{ tiket= OrderSend( 0, OP_BUY, volume, Bid, Point*3, Bid- stoploss*Point, Bid+ takeprofit*Point, "Pose66", 1234567890, 0, Red);Alert("buy",GetLastError());}; { OP_BUY, volume, Bid, Point*Point, Bid+ takeprofit*Point, Pose66, 1234567890, 0, Red);Alert("buy",GetLastError())

if (Fractall>0&&Fractalu<blu&&Fractalu<red&&Fractalu<grin)とする。


{ tiket= OrderSend( 0, OP_SELL, volume, Ask, Point*3, Ask+ stoploss*Point, Ask- takeprofit*Point, "Pose66", 1234567890, 0, Blue);Alert("sell",GetLastError());}; { OP_SELL, volume, Ask, Point*3, Ask- stoploss*Point, Ask- takeprofit*Point, "Pose66", 1234567890, 0, Blue)




return(0)です。
}
//+------------------------------------------------------------------+


"すべてはすでにあなたの前に盗まれている "だけでなく、"あなたの馬は静かに疾走している"・・・。:-)))

こちらを ご覧ください。

 

ありがとうございます!!!

でも、コーディングの勉強もしたかったので、何が悪いのか理解したかったんです。

 

エラー(価格違い)の原因は何でしょうか?