Jump to content
Tom Next - Daytrading Community

Linienbeschriftung


rotu

Recommended Posts

Hallo,

ich benutze gerne diesen Pivot Indikator, da er auch die "halben" Pivots anzeigt: Daily Pivot Points - MT4 Indikatoren [ MQ4 & EX4 ] - FOREX-INDIKATOREN.com

Ich finde den Indikator jedoch leider unübersichtlich auf dem Chart. Die Pivot Linien sind nicht beschriftet und man kann nur alle Support bzw. Resistance Linien alle auf einmal farblich und von der Linienart ändern.

Könnte jemand diesen Indikator so umprogrammieren oder erklären wie man es macht, dass zumindest die einzelnen Pivot Linien auf dem Chart beschriftet werden (also Support 0.5, Support 1, Support 1.5 etc.)?

Optimal wäre es, wenn auch die einzelnen Linien farblich und von der Linienart und Dicke geändert werden könnten. Wäre das auch möglich?

Danke im Voraus,

Viele Grüße.

  • Upvote 1
Link to comment
Share on other sites

Hallo , ich habe (im Moment) die Coderei völlig zur Seite gestellt und kümmere mich um Traden . Bitte um Verständnis, dass ich daher

 

erklären wie man es macht

 

und ich hoffe, dass Du coden kannst ? Sonst ist mein Post für Dich keine Hilfe .

 

Jedenfalls ...

 

nehme am besten das Beispiel des Fibbo im MT4 . In dem fertig programmierten Indikator gibt es die Möglichkeit die Linien zu beschriften . Dazu habe ich Dir diesen Screenshot beigefügt :

 

Rotu.png

 

Du kannst also sowohl Text als auch Preislevel anzeigen lassen ( 23,6 = %$ ) . Nun gilt für den Metatrader , dass alles was sich manuell im Terminal einstellen läßt ( also wie im Screenshot) , sich auch immer coden läßt . => "Es geht also" .

 

Wie ? Hier tippe ich auf Objekte . Und ich würde es nun so machen, dass ich Beispiel-Code im WWW scannen würde . Du benötigst ja nur solchen Code, der Dir "egal welche" Informationen in das Chart schreibt . Oft habe ich Beispiel-Charts zusammen mit Code gesehen . Es gibt jede Menge Freeware in den MT4 Foren .

 

Hoffe etwas weiter geholfen zu haben .

KB

  • Upvote 2
Link to comment
Share on other sites

...

 

Optimal wäre es, wenn auch die einzelnen Linien farblich und von der Linienart und Dicke geändert werden könnten. Wäre das auch möglich?

...

 

Für jede Linie gibt es diese 4 Zeilen im Code:

   ObjectCreate(MPrefix + "Pivot_Line", OBJ_HLINE, 0, 0, P);
   ObjectSet(MPrefix + "Pivot_Line", OBJPROP_COLOR, Yellow);
   ObjectSet(MPrefix + "Pivot_Line", OBJPROP_STYLE, STYLE_SOLID);
   ObjectSetText(MPrefix + "Pivot_Line","Pivot "+DoubleToStr(P,Digits));

In der 2. Zeile kannst du die Farbe einstellen, in der Dritten die Linienart und in der Vierten die Beschriftung.

Wenn du noch die Breite ändern willst, dann fügst du eine zusätzliche "ObjectSet"-Zeile mit der Property "OBJPROP_WIDTH" ein und gibts einen Wert von 1-15 an.

 

Sollte also alles recht einfach zu ändern sein.

  • Upvote 3
Link to comment
Share on other sites

Danke für die schnellen Antworten!

 

 

Für jede Linie gibt es diese 4 Zeilen im Code:

   ObjectCreate(MPrefix + "Pivot_Line", OBJ_HLINE, 0, 0, P);
   ObjectSet(MPrefix + "Pivot_Line", OBJPROP_COLOR, Yellow);
   ObjectSet(MPrefix + "Pivot_Line", OBJPROP_STYLE, STYLE_SOLID);
   ObjectSetText(MPrefix + "Pivot_Line","Pivot "+DoubleToStr(P,Digits));

In der 2. Zeile kannst du die Farbe einstellen, in der Dritten die Linienart und in der Vierten die Beschriftung.

Wenn du noch die Breite ändern willst, dann fügst du eine zusätzliche "ObjectSet"-Zeile mit der Property "OBJPROP_WIDTH" ein und gibts einen Wert von 1-15 an.

 

Sollte also alles recht einfach zu ändern sein.

Habe es deiner Beschreibung nach ausprobiert WOGO und es hat alles einwandfrei funktioniert wie ich es haben wollte. Vielen Dank!

Link to comment
Share on other sites

Ich hätte noch eine Frage zum Umschreiben. Es geht um dieses Skript hier: http://www.pointzero-trading.com/FreeMetatraderDownloads/view/19

 

Es schließt einen Trade zur Hälfte. Funktioniert soweit auch alles wie es soll. Das einzige was mich stört ist, dass bevor das Skript ausgeführt wird ein Bestätigungsfenster auftaucht, in dem man immer nochmal auf "Yes" klicken muss. Kann mir jemand sagen, wie ich das Skript umschreiben bzw. was ich aus dem Skript löschen muss, damit dieses Fenster nicht mehr auftaucht und das Skript direkt ohne Bestätigung ausgeführt wird?

 

Danke : )

Link to comment
Share on other sites

Das ist der Code:



   //+------------------------------------------------------------------+
//| PZ_PartialClosing.mq4
//| Closes half of the trade if profits > initial risk.
//+------------------------------------------------------------------+
#property copyright "http://www.pointzero-trading.com"
#property link      "http://www.pointzero-trading.com"

//---- Dependencies
#import "stdlib.ex4"
   string ErrorDescription(int e);
#import
#include <stdlib.mqh>
#include <WinUser32.mqh>

//-- Don't change me
#define  ShortName            "PZ Partial Closing"

//-- Internal
double   DecimalPip;

//+------------------------------------------------------------------+
//| Custom Script start function                           
//+------------------------------------------------------------------+
int start()
{
   // Lotstep
   double l_lotstep = MarketInfo(Symbol(), MODE_LOTSTEP);
   int vp = 0; if(l_lotstep == 0.01) vp = 2; else vp = 1;
   double l_type, l_profit;
   for(int cnt=0; cnt < OrdersTotal(); cnt++)
   {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); l_type = OrderType();
      if((l_type == OP_BUY || l_type == OP_SELL) && OrderSymbol() == Symbol())
      {
         l_profit = OrderProfit();
         if(l_profit > 0)
         {
            // Confirm
            if(MessageBox(ShortName +" - Do you really want to partial close the trade "+ OrderTicket() +"?",
                 "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) continue;
            
            // Pips gained for now
            double PipProfit, PipStopLoss;
         
            // Calculate pips for stoploss
            if(l_type == OP_BUY)
            {
               // If this trade is losing or free
               if(Bid < OrderOpenPrice()) continue;
               if(Bid > OrderStopLoss()) continue;
            
               // Profit and so forth
               PipProfit = Bid - OrderOpenPrice();
               PipStopLoss = OrderOpenPrice() - OrderStopLoss();
            
            } else if(l_type == OP_SELL) {
         
               // If this trade is losing
               if(Ask > OrderOpenPrice()) continue;
               if(Ask < OrderStopLoss()) continue;
         
               // Profit and so forth
               PipProfit = OrderOpenPrice() - Ask;
               PipStopLoss = OrderStopLoss() - OrderOpenPrice();
            }
         
            // Read comment from trade
            string Com = OrderComment();
            double LOTS = OrderLots();
       
            // Partial close
            if(PipProfit > PipStopLoss &&
               StringFind(Com, "from #", 0) == -1)
            {
               // Close
               double halflots = NormalizeDouble(LOTS * 0.5, vp);
            
               // Close half position
               if(halflots >= MarketInfo(Symbol(), MODE_MINLOT))
               {
                  if(!OrderClose(OrderTicket(), halflots, OrderClosePrice(), 6, Gold))
                     Print(ShortName +" (OrderModify Error) "+ ErrorDescription(GetLastError()));
               }
            }
         }
      }
   }
 
   // Hi there!
   Comment("Copyright © http://www.pointzero-trading.com");
   
   // Bye
   return(0);
}



Link to comment
Share on other sites

Mache mal aus dem ...

 

// Confirm
if(MessageBox(ShortName +" - Do you really want to partial close the trade "+ OrderTicket() +"?", "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) continue;
            

 

ein ...

// Confirm
// if(MessageBox(ShortName +" - Do you really want to partial close the trade "+ OrderTicket() +"?", "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) continue;
            

 

Also vor das if einfach ein // setzen. Dann sollte das Fenster nicht mehr kommen. Kannst die Zeile auch löschen.

  • Upvote 1
Link to comment
Share on other sites

Mache mal aus dem ...

 

// Confirm
if(MessageBox(ShortName +" - Do you really want to partial close the trade "+ OrderTicket() +"?", "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) continue;
            

 

ein ...

// Confirm
// if(MessageBox(ShortName +" - Do you really want to partial close the trade "+ OrderTicket() +"?", "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) continue;
            

 

Also vor das if einfach ein // setzen. Dann sollte das Fenster nicht mehr kommen. Kannst die Zeile auch löschen.

 

Habe die Zeile gelöscht und jetzt kommt die Nachricht nicht mehr. Danke!

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