Einzelnen Beitrag anzeigen
  #11 (permalink)  
Alt 04.05.13
Martin Martin ist offline
Mitglied
 
Registriert seit: Mar 2013
Beiträge: 96
Martin befindet sich auf einem aufstrebenden Ast
Standard

hi feelfree

also erstmal vielen dank für deine hilfe aber irgendwie komm ich trotzdem nicht weiter

warum muss das alles so komplizirt sein

schau doch bitte nochmal über den code was da jetzt noch falch ist

(hoffe nerf dich nicht zu sehr )

PHP-Code:
#define SIGNAL_NONE 0
#define SIGNAL_BUY   1
#define SIGNAL_SELL  2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4

#property copyright "Expert Advisor Builder"
#property link      "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"

extern int MagicNumber 0;
extern bool SignalMail False;
extern bool EachTickMode True;
extern double Lots 0,01;
extern int Slippage 0,01;
extern bool UseStopLoss True;
extern int StopLoss 5;
extern bool UseTakeProfit True;
extern int TakeProfit 2;
extern bool UseTrailingStop True;
extern int TrailingStop 0;

int BarCount;
int Current;
bool TickCheck False;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init() {
   
BarCount Bars;

   if (
EachTickModeCurrent 0; else Current 1;

   return(
0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit() {
   return(
0);
}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start() {
   
int Order SIGNAL_NONE;
   
int TotalTicket;
   
double StopLossLevelTakeProfitLevel;



   if (
EachTickMode && Bars != BarCountTickCheck False;
   
Total OrdersTotal();
   
Order SIGNAL_NONE;

   
//+------------------------------------------------------------------+
   //| Variable Begin                                                   |
   //+------------------------------------------------------------------+


double Buy1_1 iCustom(NULL0"Trend"00Current 1);

double Sell1_1 iCustom(NULL0"Trend"11Current 1);



   
   
//+------------------------------------------------------------------+
   //| Variable End                                                     |
   //+------------------------------------------------------------------+

   //Check position
   
bool IsTrade False;

   for (
int i 0Total++) {
      
OrderSelect(iSELECT_BY_POSMODE_TRADES);
      if(
OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) {
         
IsTrade True;
         if(
OrderType() == OP_BUY) {
            
//Close

            //+------------------------------------------------------------------+
            //| Signal Begin(Exit Buy)                                           |
            //+------------------------------------------------------------------+

            

            //+------------------------------------------------------------------+
            //| Signal End(Exit Buy)                                             |
            //+------------------------------------------------------------------+

            
if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
               
OrderClose(OrderTicket(), OrderLots(), BidSlippageMediumSeaGreen);
               if (
SignalMailSendMail("[Signal Alert]""[" Symbol() + "] " DoubleToStr(BidDigits) + " Close Buy");
               if (!
EachTickModeBarCount Bars;
               
IsTrade False;
               continue;
            }
            
//Trailing stop
            
if(UseTrailingStop && TrailingStop 0) {                 
               if(
Bid OrderOpenPrice() > Point TrailingStop) {
                  if(
OrderStopLoss() < Bid Point TrailingStop) {
                     
OrderModify(OrderTicket(), OrderOpenPrice(), Bid Point TrailingStopOrderTakeProfit(), 0MediumSeaGreen);
                     if (!
EachTickModeBarCount Bars;
                     continue;
                  }
               }
            }
         } else {
            
//Close

            //+------------------------------------------------------------------+
            //| Signal Begin(Exit Sell)                                          |
            //+------------------------------------------------------------------+

            

            //+------------------------------------------------------------------+
            //| Signal End(Exit Sell)                                            |
            //+------------------------------------------------------------------+

            
if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
               
OrderClose(OrderTicket(), OrderLots(), AskSlippageDarkOrange);
               if (
SignalMailSendMail("[Signal Alert]""[" Symbol() + "] " DoubleToStr(AskDigits) + " Close Sell");
               if (!
EachTickModeBarCount Bars;
               
IsTrade False;
               continue;
            }
            
//Trailing stop
            
if(UseTrailingStop && TrailingStop 0) {                 
               if((
OrderOpenPrice() - Ask) > (Point TrailingStop)) {
                  if((
OrderStopLoss() > (Ask Point TrailingStop)) || (OrderStopLoss() == 0)) {
                     
OrderModify(OrderTicket(), OrderOpenPrice(), Ask Point TrailingStopOrderTakeProfit(), 0DarkOrange);
                     if (!
EachTickModeBarCount Bars;
                     continue;
                  }
               }
            }
         }
      }
   }

   
//+------------------------------------------------------------------+
   //| Signal Begin(Entry)                                              |
   //+------------------------------------------------------------------+

   
if (FalseOrder SIGNAL_BUY;

   if (
FalseOrder SIGNAL_SELL;


   
//+------------------------------------------------------------------+
   //| Signal End                                                       |
   //+------------------------------------------------------------------+

   //Buy
   
if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
      if(!
IsTrade) {
         
//Check free margin
         
if (AccountFreeMargin() < (1000 Lots)) {
            Print(
"We have no money. Free Margin = "AccountFreeMargin());
            return(
0);
         }

         if (
UseStopLossStopLossLevel Ask StopLoss Point; else StopLossLevel 0.0;
         if (
UseTakeProfitTakeProfitLevel Ask TakeProfit Point; else TakeProfitLevel 0.0;

         
Ticket OrderSend(Symbol(), OP_BUYLotsAskSlippageStopLossLevelTakeProfitLevel"Buy(#" MagicNumber ")"MagicNumber0DodgerBlue);
         if(
Ticket 0) {
            if (
OrderSelect(TicketSELECT_BY_TICKETMODE_TRADES)) {
                Print(
"BUY order opened : "OrderOpenPrice());
                if (
SignalMailSendMail("[Signal Alert]""[" Symbol() + "] " DoubleToStr(AskDigits) + " Open Buy");
            } else {
                Print(
"Error opening BUY order : "GetLastError());
            }
         }
         if (
EachTickModeTickCheck True;
         if (!
EachTickModeBarCount Bars;
         return(
0);
      }
   }

   
//Sell
   
if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
      if(!
IsTrade) {
         
//Check free margin
         
if (AccountFreeMargin() < (1000 Lots)) {
            Print(
"We have no money. Free Margin = "AccountFreeMargin());
            return(
0);
         }

         if (
UseStopLossStopLossLevel Bid StopLoss Point; else StopLossLevel 0.0;
         if (
UseTakeProfitTakeProfitLevel Bid TakeProfit Point; else TakeProfitLevel 0.0;

         
Ticket OrderSend(Symbol(), OP_SELLLotsBidSlippageStopLossLevelTakeProfitLevel"Sell(#" MagicNumber ")"MagicNumber0DeepPink);
         if(
Ticket 0) {
            if (
OrderSelect(TicketSELECT_BY_TICKETMODE_TRADES)) {
                Print(
"SELL order opened : "OrderOpenPrice());
                if (
SignalMailSendMail("[Signal Alert]""[" Symbol() + "] " DoubleToStr(BidDigits) + " Open Sell");
            } else {
                Print(
"Error opening SELL order : "GetLastError());
            }
         }
         if (
EachTickModeTickCheck True;
         if (!
EachTickModeBarCount Bars;
         return(
0);
      }
   }

   if (!
EachTickModeBarCount Bars;

   return(
0);
}
//+------------------------------------------------------------------+