Gunner_Duck Posted June 26, 2017 Report Share Posted June 26, 2017 (edited) 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? Edited June 26, 2017 by Gunner_Duck Quote Link to comment Share on other sites More sharing options...
Forex1+ Posted June 26, 2017 Report Share Posted June 26, 2017 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ß Quote Link to comment Share on other sites More sharing options...
Gunner_Duck Posted June 27, 2017 Author Report Share Posted June 27, 2017 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? Quote Link to comment Share on other sites More sharing options...
conglom-o Posted June 27, 2017 Report Share Posted June 27, 2017 Hast Du denn #property strict angeschaltet? Quote Link to comment Share on other sites More sharing options...
Gunner_Duck Posted June 27, 2017 Author Report Share Posted June 27, 2017 Hast Du denn #property strict angeschaltet? Ich habe befürchtet, dass es daran liegt. Nein das hab ich ausgeschaltet, weil ich damit ein paar Fehler im Code bekomme :-/Muss die Fehler erstmal beseitigen. Aber vielen dank, für den Tipp. Werde ihn ausprobieren, sobald ich soweit bin Quote Link to comment Share on other sites More sharing options...
conglom-o Posted June 27, 2017 Report Share Posted June 27, 2017 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 .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. Quote Link to comment Share on other sites More sharing options...
Gunner_Duck Posted June 28, 2017 Author Report Share Posted June 28, 2017 (edited) 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. Edited June 28, 2017 by Gunner_Duck Quote Link to comment Share on other sites More sharing options...
conglom-o Posted June 28, 2017 Report Share Posted June 28, 2017 Also ohne Zeilennummern und die entsprechenden Fehler ist es schwer zu helfen. Quote Link to comment Share on other sites More sharing options...
Gunner_Duck Posted June 28, 2017 Author Report Share Posted June 28, 2017 (edited) 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: Edited June 28, 2017 by Gunner_Duck Quote Link to comment Share on other sites More sharing options...
conglom-o Posted June 29, 2017 Report Share Posted June 29, 2017 Das Problem bei Fehlern mit Klammern ist, dass die Ursache ganz woanders im Quelltext liegen kann. Kann bei den gegebenen Informationen leider nicht helfen. Sorry. Quote Link to comment Share on other sites More sharing options...
Mythos Posted June 30, 2017 Report Share Posted June 30, 2017 Das Problem ist das du nicht alle fälle abdeckst, bzw. der Compiler das denkt.Schreib am Ende ein allgemeines return(0); dann sollte es passen. bzw. was soll zB passieren im Fall OP_BUY && !Decision ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.