エキスパートアドバイザー - 雑多な質問

 

こんにちは。

マーケットが閉じた ときに'else {}' コードを使おうとすると、ちょうど再生できました。

しかし、2つの音が混在して いる、 どこに問題がある、してください?

// SELL
if( sparam == "SELL GROUP" )
{
    ObjectSetInteger ( 0, "SELL GROUP", OBJPROP_STATE, false );
    _ticket = Order  (    "SELL GROUP"                       );

    PlaySound ( "ok.wav" );
}
else
{
    PlaySound( "timeout.wav" );
}

最高です。

(英語は私の母国語ではありません)

 
SELL GROUP "以外のスパムの場合、timeout.wavが鳴ります。
 

コメントありがとうございます。

下記のように試してみたところ、マーケットがクローズして'timeout.wav'が再生されるようになりました。しかし、私は 'ok.wav' が新しい注文のために再生されるかどうかわからないのでしょうか?

教えてもらえますか?

int _ticket = 0;
if ( expression )
{
...  
}   //---if Close

if ( _ticket > 0 )
{
    PlaySound( "ok" );
}   //---if Close
//---
if ( _ticket < 0 )
{
    PlaySound( "timeout.wav" );
}   //---if Close

ありがとうございます。

 

プリント 機能に置き換えて、テスターで実行してみてください。

私が見たところ、これは正しいです。

<0 の代わりに -1 を使っても同じような結果になります。

 

OK!ありがとうございます。月曜日にやって みます。

//--- 2回目の編集

動作は良好です。

 
実は、私のメインのTradePanel EAに'OrderLots' 関数を 追加したいのですが、その前にテスト する必要があります。
そこで、'-'ボタンを クリックするとロットが減少するようにしようとしたのですが、うまくいきません。

私の「テスト」 EAのコードはこちらでご覧いただけます。私は、助けを必要とする、お願いします。

int             i                                                ,
                int_example         = 1                          ;
double          _lotStep            = 0.01                       ,
                _lot                = 0.09                       ;
string          _prefix             = "| TP -"                   ,
                _edtLot             = _prefix + " Lot"           ,
                _btnLotMinus        = _prefix + " Button Minus"  ;

//---init
_PanelDraw();

//---OnChartEvent
if ( sparam == _btnLotMinus )
{
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_STATE, false );
    _lot = _lot - _lotStep;
    if ( _lot <= 0 )
         _lot = _lotStep;

    Print( "| Just You Clicked Button Lot Minues" );
    return;
}   //---if Close

//---
void _PanelDraw()
{
//---Button
    ObjectCreate    ( 0, _btnLotMinus, OBJ_BUTTON         , 0, 0, 0   );
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_XDISTANCE  , 16        );
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_YDISTANCE  , 16        );
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_XSIZE      , 80        );
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_YSIZE      , 32        );
    ObjectSetString ( 0, _btnLotMinus, OBJPROP_TEXT       , "-"       );
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_FONTSIZE   , 20        );
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_STATE      , false     );
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_SELECTABLE , false     );
    Print( "I am Minus" );

//---Lot
    ObjectCreate    ( 0, _edtLot,      OBJ_EDIT           , 0, 0, 0   );
    ObjectSetInteger( 0, _edtLot,      OBJPROP_COLOR      , Red       );
    ObjectSetInteger( 0, _edtLot,      OBJPROP_XDISTANCE  , 16        );
    ObjectSetInteger( 0, _edtLot,      OBJPROP_YDISTANCE  , 56        );
    ObjectSetInteger( 0, _edtLot,      OBJPROP_XSIZE      , 80        );
    ObjectSetInteger( 0, _edtLot,      OBJPROP_YSIZE      , 32        );
    ObjectSetString ( 0, _edtLot,      OBJPROP_TEXT       , "Lot: " + DoubleToStr( _lot, 2 ) );
    ObjectSetInteger( 0, _edtLot,      OBJPROP_FONTSIZE   , 12        );
    ObjectSetInteger( 0, _edtLot,      OBJPROP_STATE      , true      );
    ObjectSetInteger( 0, _edtLot,      OBJPROP_READONLY   , true      );
    Print( "I am Minus" );
    //---
    return;
}

ありがとうございます。

 

//---OnChartEvent
if ( sparam == _btnLotMinus )
{
    ObjectSetInteger( 0, _btnLotMinus, OBJPROP_STATE, false );
    _lot = _lot - _lotStep;
    if ( _lot <= 0 )
         _lot = _lotStep;

    Print( "| Just You Clicked Button Lot Minues" );
    return;
}   //---if Close

これはOnChartEvent関数では ありません

これは

void OnChartEvent(const int id,         // Event ID
                  const long& lparam,   // Parameter of type long event
                  const double& dparam, // Parameter of type double event
                  const string& sparam  // Parameter of type string events
  );

   if(id==CHARTEVENT_OBJECT_CLICK)

     {

     //

     }


 

Keith Watford:

これはOnChartEvent関数ではありません

です。

5について まだ助けが 必要です

---

しかし、なぜ私はそれを書かなかったのですか?なぜなら、それはより多くのスペースを必要とするからです...

とにかくありがとうございます。

 

大丈夫そうですが、ロットステップ自体が0.01以下にならないように注意してください。

 
しかし、ロットは 私がそれを見なかったことを減少させる ことはありません。
 
Max Enrik:
しかし、ロットは 私がそれを見ていなかった減少 しません。

どこで見るんだ?

Print( "| Just You Clicked Button Lot Minues" );
これって印刷されるの?
理由: