Zum Inhalt springen
View in the app

A better way to browse. Learn more.

#T/N/X/T

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Skript Take Profit Abstand = Stop Loss Abstand

Geschrieben

Hallo,

ich bin auf der Suche nach einem Skript für Mt4, welches einen take profit - von einer pending oder einer schon ausgeführten order - so modifiziert, dass dieser genauso viele Pips von der Order entfernt ist, wie der gesetzte stop loss und somit ein Chance-Risiko-Verhältnis von 1:1 erzielt werden kann.

Ich habe ein "modify take profit" Skript gefunden, dessen Code so aussieht:

//+------------------------------------------------------------------+
//| 0-A-TP-2000                                                      |
//| Copyright 2012, File45.                                          |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, File45"
#property link      "http://codebase.mql4.com/en/author/file45"
#property show_inputs

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+

extern string _ = "Key in TP points below";
extern int Take_Profit = 0;

double itotal,pp;
     
int start()
{  
   itotal=OrdersTotal();
   for(int cnt=itotal-1;cnt>=0;cnt--) 
   {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      
      if (OrderSymbol()==Symbol() && OrderType()==OP_BUY)
      {
         if (Take_Profit == 0)
         {
             ModifyTakeProfit(0);
         }
         else
         {
             ModifyTakeProfit(OrderOpenPrice() + Take_Profit*Point);
         } 
      }
      
      if (OrderSymbol()==Symbol() && OrderType()==OP_SELL)
      {
         if (Take_Profit == 0)
         {
             ModifyTakeProfit(0);
         }       
         else
         {   
            ModifyTakeProfit(OrderOpenPrice() - Take_Profit*Point);
         }        
      }  
   }
   return(0);
}

void ModifyTakeProfit(double idTakeProfit) 
{
   bool fmTP;
   fmTP=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),idTakeProfit,0,CLR_NONE);
}


 


Leider weiß ich aufgrund mangelnder mql-Kenntnisse nicht, wie ich in dem Skript einstellen kann, dass der Takeprofit genauso weit von der Order weggesetzt wird, wie der stop loss.

Kann mir jemand konkret sagen, wie das Skript geändert werden müsste, damit ich mein oben beschriebenes Vorhaben realisieren kann (falls das mit diesem Skript überhaupt möglich ist)?


Vielen Dank im Voraus.

Viele Grüße.

Bearbeitet von rotu

Featured Replies

Geschrieben

1. Durchlaufen aller offenen Positionen mittels for Schleife

2. Auslesen des OrderOpenPrice und des Order StoppLoss

3. Berechnung der Differenz

4. Modifizierung der Order und Setzen des TakeProfit

 

1. und 4. ist bereits vorhanden. Was noch fehlt ist 2. und 3. wink.gif.

Die ModifyTakeProfit müssten bspw. geändert werden in: ModifyTakeProfit(2*OrderOpenPrice()-OrderStopLoss());

Der externe TakeProfit kann dann natürlich weg und die else Bedingung wird dadurch auch hinfällig.

Dein Kommentar

Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.

Gast
Auf dieses Thema antworten...

Account

Navigation

Suche

Suche

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.