专家顾问 - 杂项问题

 

你好。

我尝试使用'else {}' 代码,当市场关闭 时,它可以播放。

但两个声音混合在一起, 请问哪里有问题?

// 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 "之外,任何/每一个SPARAM都会发出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

谢谢。

 

打印功能 取代,并在测试器中运行。

从我所看到的来看,它是正确的。

你可以用-1来代替<0,但结果是相似的。

 

好的!谢谢。我将在周一 尝试。

//----第二次编辑

运行良好。

 
事实上,我想在我的主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

---

但为什么我没有写呢?因为它需要更多的空间...

总之,谢谢。

 

它似乎可以,但要确保lotstep本身不低于0.01。

 
并不能减少 我没有看到它。
 
Max Enrik:
很多地方 并没有减少,我没有看到它。

你希望在哪里看到它?

Print( "| Just You Clicked Button Lot Minues" );
这东西能打印吗?