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)
-   -   EA für den Dax gesucht (http://www.expert-advisor.com/forum/showthread.php?t=5059)

Pit! 15.07.16 08:29

EA für den Dax gesucht
 
Liebe Experten,

Danke für jeden Hinweis!
Pit

henning234 27.07.16 00:33

Schreib doch mal deine Wünsche nieder, was der EA machen sollen?
Dann schau ich, ob ich was hinbekomme.

vg
henning

Kronenchakra 28.07.16 04:34

EA für den Dax gesucht
 
Na, was soll der EA wohl machen ?!:rolleyes:
@henning234: Wie willst du das denn, so mal auf die schnelle, hinkriegen?:D

Pit! 28.07.16 11:11

Liebe Experten,

für mich würde es ein Scalper tun. Moneymanagement muß er drin haben und eine Funktion "Close all Positions" à la:

Code:

//|$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//|              Close
//|  Last Updated 12-12-2006 10:00pm
//|$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#define    NL    "\n"

extern int    EquityTarget    = 25;            // closes all orders once Equity hits this $ amount
extern bool  CloseAllNow      = false;          // closes all orders now
extern bool  CloseProfitableTradesOnly = false; // closes only profitable trades
extern double ProftableTradeAmount      = 1;    // Only trades above this amount close out
extern bool  ClosePendingOnly = false;          // closes pending orders only
extern bool  UseAlerts        = false;

//+-------------+
//| Custom init |
//|-------------+
int init()
  {

  }

//+----------------+
//| Custom DE-init |
//+----------------+
int deinit()
  {

  }

//+------------------------------------------------------------------------+
//| Closes everything
//+------------------------------------------------------------------------+
void CloseAll()
{
  for(int i=OrdersTotal()-1;i>=0;i--)
 {
    OrderSelect(i, SELECT_BY_POS);
    bool result = false;
        if ( OrderType() == OP_BUY)  result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
        if ( OrderType() == OP_SELL)  result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
        if ( OrderType()== OP_BUYSTOP)  result = OrderDelete( OrderTicket() );
        if ( OrderType()== OP_SELLSTOP)  result = OrderDelete( OrderTicket() );
        if (UseAlerts) PlaySound("alert.wav");
 }
  return;
}
 
//+------------------------------------------------------------------------+
//| cancels all orders that are in profit
//+------------------------------------------------------------------------+
void CloseAllinProfit()
{
  for(int i=OrdersTotal()-1;i>=0;i--)
 {
    OrderSelect(i, SELECT_BY_POS);
    bool result = false;
        if ( OrderType() == OP_BUY && OrderProfit()+OrderSwap()>ProftableTradeAmount)  result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
        if ( OrderType() == OP_SELL && OrderProfit()+OrderSwap()>ProftableTradeAmount)  result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
        if (UseAlerts) PlaySound("alert.wav");
 }
  return;
}

//+------------------------------------------------------------------------+
//| cancels all pending orders
//+------------------------------------------------------------------------+
void ClosePendingOrdersOnly()
{
  for(int i=OrdersTotal()-1;i>=0;i--)
 {
    OrderSelect(i, SELECT_BY_POS);
    bool result = false;
        if ( OrderType()== OP_BUYSTOP)  result = OrderDelete( OrderTicket() );
        if ( OrderType()== OP_SELLSTOP)  result = OrderDelete( OrderTicket() );
  }
  return;
  }

//+-----------+
//| Main      |
//+-----------+
int start()
  {
  int      OrdersBUY;
  int      OrdersSELL;
  double  BuyLots, SellLots, BuyProfit, SellProfit;

//+------------------------------------------------------------------+
//  Determine last order price                                      |
//-------------------------------------------------------------------+
      for(int i=0;i<OrdersTotal();i++)
      {
        OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
          if(OrderType()==OP_BUY)  OrdersBUY++;
          if(OrderType()==OP_SELL) OrdersSELL++;
          if(OrderType()==OP_BUY)  BuyLots += OrderLots();
          if(OrderType()==OP_SELL) SellLots += OrderLots();
          if(OrderType() == OP_BUY)  BuyProfit += OrderProfit() + OrderCommission() + OrderSwap();
          if(OrderType() == OP_SELL)  SellProfit += OrderProfit() + OrderCommission() + OrderSwap();
      }             
 
    if(CloseAllNow) CloseAll();
   
    if(CloseProfitableTradesOnly) CloseAllinProfit();
   
    if(AccountEquity() >= EquityTarget) CloseAll();

    if(ClosePendingOnly) ClosePendingOrdersOnly();
     
 
  Comment("                            Comments Last Update 12-12-2006 10:00pm", NL,
          "                            Buys    ", OrdersBUY, NL,
          "                            BuyLots        ", BuyLots, NL,
          "                            Sells    ", OrdersSELL, NL,
          "                            SellLots        ", SellLots, NL,
          "                            Balance ", AccountBalance(), NL,
          "                            Equity        ", AccountEquity(), NL,
          "                            Margin              ", AccountMargin(), NL,
          "                            MarginPercent        ", MathRound((AccountEquity()/AccountMargin())*100), NL,
          "                            Current Time is  ",TimeHour(CurTime()),":",TimeMinute(CurTime()),".",TimeSeconds(CurTime()));
 } // start()

So etwa?
Pit

Pit! 28.07.16 11:19

Liste der Anhänge anzeigen (Anzahl: 1)
Sehr nett wäre auch eine Anzeige in etwa so, die den "Close all Positions"-Knopf interaktiv vorsieht nach einer noch weiter zu definierenden Beziehung zwischen Margin, gestatteten LOT-Anzahl und einigen Rumpfdaten.


Alle Zeitangaben in WEZ +2. Es ist jetzt 13:58 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