Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL4 (http://www.expert-advisor.com/forum/forumdisplay.php?f=220)
-   -   Automatischer Stop (http://www.expert-advisor.com/forum/showthread.php?t=4617)

tommystock 04.12.15 10:04

Automatischer Stop
 
Hallo,

wie kann ich in MT4 programmieren, dass automatisch ein Stop von z.b. 15 Punkten beim Kauf gesetzt wird ?

Beispiel:

Ich klick selber auf "Buy" z.b. bei 1000 und MT4 setzt dann automatisch den Stop auf 985. Dasselbe sollte natürlich auch bei "Sell" funktionieren.

Danke für Eure Hilfe.

GoS 04.12.15 21:12

Ganz auf die schnelle:

PHP-Code:

for(OrdersTotal() - 1>= 0i--)
    if(
OrderSelect(iSELECT_BY_POSMODE_TRADES)) {
        if(
OrderType() == OP_BUYd_sl OrderOpenPrice() - Point 15;
        if(
OrderType() == OP_SELLd_sl OrderOpenPrice() + Point 15;
        if(
OrderStopLoss() == 0.OrderModify(OrderTicket(), OrderOpenPrice(), d_slOrderTakeProfit(), 0); } 



Alle Zeitangaben in WEZ +2. Es ist jetzt 10:37 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum