expert advisor - verschiedene Fragen

 

Hallo,

Ich versuche, 'else {}' Code zu verwenden, wenn der Markt geschlossen nur es spielen könnte.

Aber zwei Sounds gemischt, wo ist ein Problem, bitte?

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

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

Am besten.

(Englisch ist nicht meine Muttersprache)

 
timeout.wav ertönt bei jeder anderen Sparam als "SELL GROUP".
 

Danke für den Kommentar.

Ich habe versucht, wie unten, jetzt Markt geschlossen ist "timeout.wav" spielen. Aber ich bin mir nicht sicher, ob "ok.wav" für neue Aufträge abgespielt wird oder nicht?

Können Sie mir das bitte mitteilen?

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

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

Danke!

 

Ersetzen Sie sie durch die Druckfunktion und führen Sie sie im Prüfgerät aus.

Soweit ich das sehen kann, ist es korrekt.

Sie könnten -1 anstelle von <0 verwenden, aber das Ergebnis wäre ähnlich.

 

GUT! Ich danke Ihnen. Ich werde es am Montag versuchen.

//--- zweites Mal bearbeitet

Funktioniert gut.

 
Eigentlich möchte ich 'OrderLots' Funktion zu meinem Haupt TradePanel EA's hinzufügen, aber bevor ich es testen müssen.
Also versuche ich, wenn ich auf die Schaltfläche "-" klicken, dann wird Lot verringern, aber es funktioniert nicht für mich.

Sie können meine 'Test' EA's Codes sehen. Ich brauche eine Hilfe, bitte.

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;
}

Danke!

 

//---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

Dies ist nicht die OnChartEvent-Funktion

Dies ist die

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:

Dies ist nicht die OnChartEvent-Funktion

Dies ist

Ich brauche noch Hilfe zu#5

---

Aber warum habe ich es nicht geschrieben? Weil es mehr Platz braucht...

Wie auch immer, danke.

 

es scheint in Ordnung zu sein, aber stellen Sie sicher, dass lotstep selbst nicht unter 0,01 geht

 
Aber viel macht es nicht weniger, ich habe es nicht gesehen.
 
Max Enrik:
Aber das Los nimmt nicht ab, ich habe es nicht gesehen.

Wo erwarten Sie es zu sehen?

Print( "| Just You Clicked Button Lot Minues" );
Wird das gedruckt?