Jump to content
Tom Next - Daytrading Community

EA Variablenbezeichnung als Kommentar ausgeben


Gunner_Duck

Recommended Posts

Hallo Zs,

 

ich hab bei einigen EA's gesehen, dass es möglich ist in den EA-Eigenschaften in dem Reiter "Eingaben" die Variablenbezeichnungen als Kommentar angezeigt werden und nicht als Variablenname.

 

Hoffe, ihr versteht was ich meine. Schaut mal dazu in den Screenshot. Z.b. die zweite Variable dort hat eigentlich den Namen "Timeframe", wird aber hier in der Eingabemaske als Kommentar "Time Frame in min(0-current..." angezeigt.

 

Kennt sich damit einer aus?

post-5230-0-22656300-1498506754_thumb.jpg

Edited by Gunner_Duck
Link to comment
Share on other sites

Wenn ich mich richtig erinnere geht das per // Kommentar direkt hinter der Variable in der gleiche Zeile welche als extern deklariert ist.

Zum Beispiel:

 

extern int Timeframe = 0; // Kommentar der den Variablennamen ersetzt
 

Gruß

 

ja, hast recht, so ist es zumindest auch in einem Beispielcode, den ich meine.

Also hab ich das jetzt bei mir auch so gemacht.

 

input int            MainTimeFrame        =     0;    // Time Frame in min(0-current,-1-each tick mode)

 

Und trotzdem sieht es aktuell immer noch so aus, wie im Screenshot.

Was aber auch auffällig ist, dass die Variable im Code ohne Leerzeilen ist. Aber in der Eingabemaske ist zw. "Main" und "TimeFrame" eine Leerzeile. Keine Ahnung woher das kommt.

 

Gibt es vielleicht noch etwas anderes, worauf man dafür achten sollte?

Link to comment
Share on other sites

Ich habe befürchtet, dass es daran liegt. Nein das hab ich ausgeschaltet, weil ich damit ein paar Fehler im Code bekomme :-/

 

Hehe - ja dieses Vorgehen kenne ich irgendwoher :wink:.

Es wird wahrscheinlich daran liegen - siehe hier:

https://docs.mql4.com/basis/variables/externvariables

 

Strict compilation mode with the output of the input parameters window is set in this script. Therefore, the values set in the string comments instead of ExtVar and InpVar variable names are displayed in Variable field.

Link to comment
Share on other sites

Ich stehe grade irgendwie voll auf dem Schlauch...

Könntet Ihr bitte vielleicht mal in einen Code-Abschnitt reinschauen.

double TrailingStopValue (bool Decision, int OrderTicketNum, int FTrailingStop) {
    //Select the appropriate order ticket
    OrderSelect(OrderTicketNum, SELECT_BY_TICKET, MODE_TRADES);
   
    //If the Order is a BUY order...
    if(OrderType() == OP_BUY) {
       //Check if the user wants to use teh Trailingstop function and did it correctly
       if(Decision && FTrailingStop > 0) {
         //Check to see that the profit threshold is met
          if(Bid - OrderOpenPrice() > Point * FTrailingStop) {
             //Return the value of the potential stoploss
             return(Bid - Point * FTrailingStop);
            }
         }
      }
    //If the Order is a SELL order...
    if(OrderType() == OP_SELL) {
       //Check if the user wants to use teh Trailingstop function and did it correctly
       if(Decision && FTrailingStop > 0) {
         //Check to see that the profit threshold is met
          if((OrderOpenPrice() - Ask) > (Point * FTrailingStop)) {
             //Return the value of the potential stoploss
             return(Ask + Point * FTrailingStop);
            }
         }
      }     
    //If the trade is not the right order type, give a stoploss of 0   
    if(OrderType() != OP_BUY || OrderType() != OP_SELL) return(0);
   }

Er gibt mir nämlich ständig einen Fehler in diesem Abschnitt raus, wenn ich im Strict-Modus bin.

post-5230-0-64139000-1498679822_thumb.jpg

Edited by Gunner_Duck
Link to comment
Share on other sites

Also ohne Zeilennummern und die entsprechenden Fehler ist es schwer zu helfen.

 

Sry. Die Zeilennummer wäre jetzt in dem Code einfach nur die Zeile, wo die letzte geschwungene Klammer ist. Und den Fehler sieht man in dem Screenshot.

 

Edit: Und der Code funktioniert auch, wenn "strict" ausschalte. Daher verstehe ich nicht was ihn daran stört.

 

Hier nochmal der Screenshot:

post-5230-0-37948600-1498680944_thumb.jpg

Edited by Gunner_Duck
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...