Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools
Zurück   Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools > Metatrader 4 > Programmierung MQL4

Programmierung MQL4 Hier gehts rund ums Programmieren in MQL4.

Login
Benutzername:
Kennwort:


Statistik
Themen: 4973
Beiträge: 43251
Benutzer: 7.221
Aktive Benutzer: 81
Links: 84
Wir begrüßen unseren neuesten Benutzer: Thomas75
Mit 2.475 Benutzern waren die meisten Benutzer gleichzeitig online (16.01.20 um 22:38).
Neue Benutzer:
vor einer Stunde
- Thomas75
vor 15 Stunden
- JosephTK
vor 2 Tagen
- Hopfen&Mal...
vor 3 Tagen
- frankmicha...
vor einer Woche
- DFeck

Onlineuser
'Wer ist online' anzeigen Benutzer: 0
Gäste: 560
Gesamt: 560
Team: 0
Team:  
Benutzer:  
Freunde anzeigen

Empfehlungen

Thema geschlossen
 
Themen-Optionen Thema durchsuchen Ansicht
  #1 (permalink)  
Alt 01.06.15
Premium Mitglied
 
Registriert seit: Apr 2015
Beiträge: 422
Raul0 befindet sich auf einem aufstrebenden Ast
Smile Verständnis gesucht: BreakEvenTrigger, TrailingStopTrigger, TrailingStopPips

Hallo,

ich versuche ein Verständniss zu finden im Zusammenspiel von diesen 3 EA Eingabeparametern.

Was ein TrailingStop ist weiss ich, jedoch gibt es ein Zusammenspiel von diesen 3 Werten.
Nach vielen versuchen finde ich keine Logik, von den Zahlen, die ich eingeben kann.

Zwar zieht es den Stop nach, jedoch welche Zahl ist wofür verantwortlich?

Gruss, Raul
  #2 (permalink)  
Alt 01.06.15
Elite Mitglied
 
Registriert seit: Apr 2011
Beiträge: 2.733
traderdoc befindet sich auf einem aufstrebenden Ast
Standard

Ein klassischer Fall von Minderinformation!
Woher sollen wir denn den Zusammenhang zwischen den drei Variablen wissen.
Ich betone w i s s e n! Nicht vermuten!

Ok, ich vermute jetzt mal:
BreakEvenTrigger - Kurs muß mit dieser Pipzahl im Gewinn sein, um den SL auf BreakEven zu legen
TrailingStopTrigger - Kurs muß mit dieser Pipzahl im Gewinn sein, um das Trailing zu aktivieren
TrailingStopPips - ab der Stelle der Trailingaktivierung wird der TrailingSL je nach OrderType unter oder über den Trigger gelegt

Da fehlt aber eigentlich noch eine Variable:
TrailingStep - Schrittweite des Nachziehens der TrailingStops

Aber wie gesagt, alles nur Vermutungen.

traderdoc
__________________
Ich erfülle Euch gern Eure EA-, Indikator- und Script-Programmierungswünsche auf Honorarbasis.
  #3 (permalink)  
Alt 01.06.15
Premium Mitglied
 
Registriert seit: Apr 2015
Beiträge: 422
Raul0 befindet sich auf einem aufstrebenden Ast
Standard

Dann ist der BreakEvenTrigger defekt, da kommt keine Änderung bei verschiedenen Werten.

Vermutlich unvollständig der EA in dem Bereich.

Trotzdem vielen Dank!
  #4 (permalink)  
Alt 01.06.15
Elite Mitglied
 
Registriert seit: Apr 2011
Beiträge: 2.733
traderdoc befindet sich auf einem aufstrebenden Ast
Standard

Ja dann hilft nur noch, den Code hier reinzustellen.
__________________
Ich erfülle Euch gern Eure EA-, Indikator- und Script-Programmierungswünsche auf Honorarbasis.
  #5 (permalink)  
Alt 01.06.15
Premium Mitglied
 
Registriert seit: Apr 2015
Beiträge: 422
Raul0 befindet sich auf einem aufstrebenden Ast
Standard

Ok, der ist recht Umfangreich. Ein paar einfache Klammerfehler habe ich gefunden. Jedoch noch nicht weiter.


PHP-Code:
//+------------------------------------------------------------------+
//|                                                          Cyclops |
//|                                 (Original version 1.5.)  Kalenzo |
//|                                                                          |
//+------------------------------------------------------------------+
#property copyright "modify"
#property link      ""
//M15, TP 2, SL 40 oder 
//M15, SL 40, TrailingStopTrigger 5, TrailingStopPips 5 <--besser
#include <stdlib.mqh>

extern string Einstellungen_Order "...................................................................";
extern int        Magic                         7001;
extern double     BaseLot                       0.02;
extern double     MaxLotSize                    0.25
extern double     MinLotSize                    0.01;
extern bool       UseMoneyManagement            false;
extern bool       IsMicroAcc                    true;
extern double     EquityPRC                     2;
extern int        MaxTrades                     1;

extern string Einstellungen_Exit "...................................................................";
extern double     TakeProfit                    0.0;//Pips
extern int        StopLoss                      40;//Pips

extern bool       UseExitSignal                 true;

extern bool       UseTimeRestriction            false;
extern int        DayEnd                        5;
extern int        HourEnd                       12

extern double     BreakEvenTrigger              0.0;//if 0 then is not used

extern double     TrailingStopTrigger           0.0;//if 0 then is not used //Dieser und TrailingStopPips arbeiten zusammen. Setzt SL nach und Triggert. 
extern int        TrailingStopPips              0;                          // --||--

extern string Einstellungen_Meldungen "...................................................................";
extern bool       EmailOn                       false;
extern bool       AlertOn                       false;
extern bool       ScreenshotOn                  false;

extern string Einstellungen_Indicator_Cycleidentifier "...................................................................";
extern string     _n                            "INDICATOR";
extern int        shiftKauf                     0//0 current bar, 1 closed
extern int        shiftClose                    0//0 current bar, 1 closed
extern int        PriceActionFilter             2;// Original 1
extern int        Length                        3;
extern int        MajorCycleStrength            5;// Original 4
extern bool       UseCycleFilter                false;
extern int        UseFilterSMAorRSI             1;// Original 1
extern int        FilterStrengthSMA             12;
extern int        FilterStrengthRSI             21;// Original 21

extern string Einstellungen_EA "...................................................................";
extern int        MajorTime                     0//PERIOD_M1, PERIOD_M5, PERIOD_M15, PERIOD_M30, PERIOD_H1, PERIOD_H4, PERIOD_D1
extern int        MinorTime                     0// 0 für Current

//intVars
string Version;
int bm;
int barCheck 0;
//Variablen außerhalb einer Funktion deklariert, bleiben gesetzt,leben länger
bool SpreadtoHighOrderstopFreigabeSellFreigabeBuy
int LongzeitsavShortzeitsavgekauftverkauft

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
Version "v1";
   
bm 1;
   if(
MarketInfo(Symbol(),MODE_DIGITS) == ||  MarketInfo(Symbol(),MODE_DIGITS) == 3)       bm 10;
   if(
TakeProfit>0)                 TakeProfit                 =  TakeProfit                 bm;//auskommentiert, weil sonst TP und SL mal Faktor 10
   
if(TrailingStopTrigger>0)        TrailingStopTrigger        =  TrailingStopTrigger        bm;
   if(
TrailingStopPips>0)           TrailingStopPips           =  TrailingStopPips           bm;
   if(
StopLoss>0)                   StopLoss                   =  StopLoss                   bm;
   
//----------------------- Spreadcalc Begin ---------------------
   //--- set variables type
   
double Spread;
   
//--- detect spread
   
Spread=MarketInfo(Symbol(),MODE_SPREAD);
   
//---
   
if(Digits==|| Digits==5) {
   
Spread=Spread/10;
   
Comment("Spread: ",Spread," Pips"); //Comment("Spread: ",Spread," Pips \nPip Zeilenumbruch");
   
}
   
   if(
Digits==2) {
   
Spread=Spread;
   
double Punkte Spread/100;
   
Comment("Spread: ",Spread," Pips oder Spot: ",Punkte," Punkt/e");
   }

   if( 
TakeProfit && Spread >= TakeProfit ) {
   
SpreadtoHigh True;
   Print(
"Achtung! Spread größer als TakeProfit");
   
Comment("Spread: ",Spread," Pips\n\n\nAchtung! Spread größer als TakeProfit");
   }else{
   
SpreadtoHigh false;
   }   
//----------------------- Spreadcalc Ende ---------------------

   
return(0);
  }

//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
//----
   
return(0);
  }

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----

   
bool timeCheck true;
   if(
UseTimeRestriction
   {
      
timeCheck TimeDayOfWeek(TimeCurrent()) < DayEnd;
      if(
timeCheck)
      {
         if(
TimeDayOfWeek(TimeCurrent()) == DayEnd)
         
timeCheck TimeHour(TimeCurrent())<=HourEnd;
      }         
   }
   
double tp 0;      
   
double sl 0;     
   
   
   
int orders orderCount(-1);
   if(
orders != 0)
   {
       
      if(
timeCheck)
      {
         for(
int pos=0;pos<OrdersTotal();pos++)
         {
            
            if(
OrderSelect(pos,SELECT_BY_POS)==false) continue;
            if(
OrderMagicNumber()!=getMagic())continue;
             
            
//EXIT 
            
if(UseExitSignal && getExitSignal(OrderType()) && profitCount()>0)
            {
               
closeAllPoisitions(OrderType());
               break;
            } 
            
            
//REVERSAL
            
if(OrderType() == OP_SELL && getSignal(OP_BUY)) 
            {
               
closeAllPoisitions(OP_SELL);
               break;
            }
            else if(
OrderType() == OP_BUY && getSignal(OP_SELL)) 
            {
               
closeAllPoisitions(OP_BUY);
               break;
            } 
            
            
//BreakEven
            
if(BreakEvenTrigger>0)
            {
               if(
OrderType() == OP_BUY)
               {            
                  if(
OrderStopLoss() < NormalizeDouble(OrderOpenPrice()+(1*bm*Point),Digits) && Ask > ((OrderOpenPrice()+(1*bm*Point))+BreakEvenTrigger*Point))
                  {
                      if(
NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(OrderOpenPrice()+(1*bm*Point),Digits))
                      
moveSL(OrderTicket(),OrderOpenPrice()+(1*bm*Point));  
                  }
               }
               else if(
OrderType() == OP_SELL)
               {
                  if(
OrderStopLoss() > NormalizeDouble(OrderOpenPrice()-(1*bm*Point),Digits) && Bid < ((OrderOpenPrice()-(1*bm*Point))-BreakEvenTrigger*Point))
                  {
                      if(
NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(OrderOpenPrice()-(1*bm*Point),Digits))
                      
moveSL(OrderTicket(),OrderOpenPrice()-(1*bm*Point));  
                  }
               } 
            }
            
            
            
//TRAILING
            
if(TrailingStopTrigger 0)
            {
               if(
OrderType() == OP_BUY)
               {            
                  if(
OrderStopLoss() <   Ask - (TrailingStopPips*Point)&& Ask > (OrderOpenPrice()+TrailingStopTrigger*Point))
                  {
                     if(
NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(Ask - (TrailingStopPips*Point),Digits))
                     
moveSL(OrderTicket(),NormalizeDouble(Ask - (TrailingStopPips*Point),Digits));  
                  } 
               }
               else if(
OrderType() == OP_SELL)
               {
                  if(
OrderStopLoss() >  Bid + (TrailingStopPips*Point) && Bid < (OrderOpenPrice()-TrailingStopTrigger*Point))
                  {
                     if(
NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(Bid + (TrailingStopPips*Point),Digits))
                     
moveSL(OrderTicket(),NormalizeDouble(Bid + (TrailingStopPips*Point),Digits));
                  }     
               }
            }
                       
         }
      }  
   }      
   
   
//OPEN Order
   
if( OrdersTotal() >= MaxTrades ) { Orderstop True; }else{ Orderstop false; } //Anzahl der Orders
   
   
if(timeCheck && isOrderAllowed()/*one order per bar*/ )
   {  
      if( !
Orderstop && !SpreadtoHigh && getSignal(OP_BUY)) 
      {
         if(
TakeProfit>0tp =  Ask TakeProfit Point;
         
         if(
StopLoss>0)
         {
            
sl Ask StopLoss*Point;
         }
         
         
openOrder(LotSize(OP_BUY),OP_BUYsltp,"START"); // Orig: openOrder(LotSize(OP_BUY),OP_BUY, sl,tp,"START");
         
if(EmailOnSendMail("Message from "+Version,"LONG TRADE TAKEN AT "+Symbol()+" PRICE "+Ask);
         if(
AlertOnAlert("LONG TRADE TAKEN AT "+Symbol()+" PRICE "+Ask);
      }
      
      if( !
Orderstop && !SpreadtoHigh && getSignal(OP_SELL)) 
      {
         if(
TakeProfit>0tp =  Bid TakeProfit Point;
         
         if(
StopLoss>0)
         {
            
sl Bid StopLoss Point;
         }
         
         
openOrder(LotSize(OP_SELL),OP_SELLsltp,"START"); // openOrder(LotSize(OP_SELL),OP_SELL, sl,tp,"START");
         
if(EmailOnSendMail("Message from "+Version,"SHORT TRADE TAKEN AT "+Symbol()+" PRICE "+Bid);
         if(
AlertOnAlert("SHORT TRADE TAKEN AT "+Symbol()+" PRICE "+Ask); 
      }            
   }      

//----
   
return(0);
  }
//+------------------------------------------------------------------+
bool getSignal(int mode)
{     
      
double _1 0,_2 0;
      
double stocc0 iStochastic(NULL,0,9,3,3,MODE_SMA,0,MODE_MAIN,0); 
      
double stocc0s iStochastic(NULL,0,9,3,3,MODE_SMA,0,MODE_SIGNAL,0);   
      
      if(
mode == OP_BUY)
      {
         
_1 iCustom(Symbol(),MinorTime,"CycleIdentifier",PriceActionFilter,Length,MajorCycleStrength,UseCycleFilter,UseFilterSMAorRSI,FilterStrengthSMA,FilterStrengthRSI,1,shiftKauf+1);  
         if( 
_1 == -&& stocc0 20 && stocc0 stocc0s && iADX(NULL,0,28,PRICE_CLOSE,MODE_MAIN,0) < 39 && iLow(NULL01) < iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,0) && iClose(NULL00) > iHigh(NULL01) ) return(true); //&& iClose(NULL, 0, 0) > (iHigh(NULL, 0, 1) * 0.0002 )
      
}
      else if(
mode == OP_SELL)
      {
         
_2 iCustom(Symbol(),MinorTime,"CycleIdentifier",PriceActionFilter,Length,MajorCycleStrength,UseCycleFilter,UseFilterSMAorRSI,FilterStrengthSMA,FilterStrengthRSI,2,shiftKauf+1); 
         if( 
_2 == && stocc0 80 && stocc0 stocc0s && iADX(NULL,0,28,PRICE_CLOSE,MODE_MAIN,0) < 39 && iHigh(NULL01) > iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,0) && iClose(NULL00) < iLow(NULL01) ) return(true); //&& iClose(NULL, 0, 0) < (iLow(NULL, 0, 1) * 0.0002 )
      
}  
   return(
false); 
}
//----
bool getExitSignal(int mode)
{

   
double _1 0,_2 0;
   
double _1L 0,_2L 0;
   if(
mode == OP_SELL)
   {
      
_1 iCustom(Symbol(),MinorTime,"CycleIdentifier",PriceActionFilter,Length,MajorCycleStrength,UseCycleFilter,UseFilterSMAorRSI,FilterStrengthSMA,FilterStrengthRSI,3,shiftClose+1);
      
_1L iCustom(Symbol(),MinorTime,"CycleIdentifier",PriceActionFilter,Length,MajorCycleStrength,UseCycleFilter,UseFilterSMAorRSI,FilterStrengthSMA,FilterStrengthRSI,1,shiftClose+1);  
      
          
      if(
_1==-&& _1L!=-1) return(true);
      else return(
false);   
   }
   
   if(
mode == OP_BUY)
   {
      
_2 iCustom(Symbol(),MinorTime,"CycleIdentifier",PriceActionFilter,Length,MajorCycleStrength,UseCycleFilter,UseFilterSMAorRSI,FilterStrengthSMA,FilterStrengthRSI,4,shiftClose+1);  
      
_2L iCustom(Symbol(),MinorTime,"CycleIdentifier",PriceActionFilter,Length,MajorCycleStrength,UseCycleFilter,UseFilterSMAorRSI,FilterStrengthSMA,FilterStrengthRSI,2,shiftClose+1);  
           
      if(
_2 == && _2L != 1) return(true);
      else return(
false);   
   }  
      
   return(
false); 
}
//----
bool moveSL(int ticket,double StopLoss)
{
   
   if(!
IsTradeAllowed())
   return (
false);
   
   if(
MathAbs(Ask-StopLoss)/Point MarketInfo(Symbol(),MODE_STOPLEVEL)) 
   {
      Print(
"STOP LOSS too close ",Bid," SL ",StopLoss);
      return(
false);
   }
   
   
int error;
   
   
int MAXRETRIES 5;
   
int retries 0;
   while(!
OrderModify(ticket,OrderOpenPrice(), StopLossOrderTakeProfit(), 0,CLR_NONE))
   {
      
error GetLastError();
      
      if(
error>1)   
      Print(
"MoveSL failed with error #",ErrorDescription(error)," CurrentSL ",OrderStopLoss()," NewSL ",StopLoss);
       
      
Sleep(1000);
            
      
RefreshRates();
            
      if(
retries >= MAXRETRIES
      return(
false);
      else
      
retries++;
   }
   

//----
int orderCount(int type)
{
    
int total OrdersTotal();
    
int oc 0;
    for(
int cnt ;cnt<=total;cnt++)
    {
      
OrderSelect(cntSELECT_BY_POSMODE_TRADES);

      if(
OrderMagicNumber() == getMagic() && (OrderType() == type || type == -1)) 
      
oc+=1;
    } 
    return(
oc);
}
//----
double LotSize(int type)
{
   if(!
UseMoneyManagement) return(BaseLot);

   
double lots BaseLot;
   
   if(
IsMicroAcc)
      
lots NormalizeDouble(BaseLot*(orderCount(type)+1),2);
   else
      
lots NormalizeDouble(BaseLot*(orderCount(type)+1),1);

   return(
MaxMinLot(lots));
}

double MaxMinLot (double lots)
{
   if(
lots>MaxLotSize)
   
lots MaxLotSize;
    
   if(
lots<MinLotSize)
   
lots MinLotSize;
   
   return(
lots);
}
//----
int getMagic()
{  
   return(
Magic);
}
//----
bool isOrderAllowed()
{
    
int totalH OrdersHistoryTotal();
    
    for(
int cntH cntH<=totalHcntH++)
    {
        
OrderSelect(cntHSELECT_BY_POSMODE_HISTORY);
      if((
OrderMagicNumber() == getMagic())   ) 
        {
            
int orderOShiftH iBarShift(Symbol(),0,OrderOpenTime(),false);
             
            if(
orderOShiftH == 
            return(
false);    
        }    
    }
    
    
    
int total  OrdersTotal();
    
    for(
int cnt cnt <= totalcnt++)
    {
        
OrderSelect(cntSELECT_BY_POSMODE_TRADES);
        
      if((
OrderMagicNumber() == getMagic())  ) 
        {
            
int orderOShift iBarShift(Symbol(),0,OrderOpenTime(),false);
             
            if(
orderOShift == 
            return(
false);    
        }    
    }
    
    
    return(
true);
}
//----
bool openOrder(double LTS,int typedouble sl,double tpstring description "" )
{
   if(!
IsTradeAllowed())
    {
        return (-
1);
    }
   
    
int error 0;
    
int ticket 0;
  
   
       
    if( 
type == OP_SELL )
    {
        while(
true)
        {
           
RefreshRates();
            
             
ticket OrderSend(Symbol(),OP_SELL,LTS,MarketInfo(Symbol(),MODE_BID),0,0,0,StringConcatenate(Version," ",description),getMagic(),0,Pink);
         
            if(
ticket<=0)
            {
                
error=GetLastError();
            Print(
"SELL ORDER ERROR:"ErrorDescription(error));
            
            if(!
ErrorBlock(error,LTS)) break;
            
            }
            else
            {
               if(
sl>|| tp>0)
               {
                  
OrderSelect(ticket,SELECT_BY_TICKET);
               
OrderModify(OrderTicket(),OrderOpenPrice(),sl,tp,0,Green);
            }
            if(
ScreenshotOn)doScreenshot();
                
OrderPrint(); 
               break;
            }
        }     
   }
   else if( 
type == OP_BUY )
   {
        
        while(
true)
        {
           
RefreshRates();
           
            
ticket OrderSend(Symbol(),OP_BUY,LTS,MarketInfo(Symbol(),MODE_ASK),0,0,0,StringConcatenate(Version," ",description),getMagic(),0,Lime);
         
            if(
ticket<=0)
            {
                
error=GetLastError();
            Print(
"BUY ORDER ERROR:"ErrorDescription(error));
            
            if(!
ErrorBlock(error,LTS)) break;
            
            }
            else
            {
               if(
sl>|| tp>0)
               {
                  
OrderSelect(ticket,SELECT_BY_TICKET);
               
OrderModify(OrderTicket(),OrderOpenPrice(),sl,tp,0,Green);
               }
               if(
ScreenshotOn)doScreenshot();
               
OrderPrint(); 
               break;
            }
            
        }
   }
    
   return (
0);
}
//+------------------------------------------------------------------+
bool ErrorBlock(int error 0,double lot 0)
{
   
   switch(
error)
   {
       case 
0
       {
         
//no error - exit from loop
         
Print("NO ERROR");
         return(
false);
       }
       case 
2:
       {
           Print(
"System failure. Reboot the computer/check the server");
           return(
false);  
       }
       case 
3:
       {
           Print(
"Error of the logic of the EA");
           return(
false);  
       }
       case 
4:
       {
           Print(
"Trading server is busy. Wait for 2 minutes.");
           
Sleep(120000);
           return(
true);   
       }
       case 
6:
       { 
           
bool connect false;
           
int iteration 0;
           Print(
"Disconnect ");
           while((!
connect) || (iteration 60))
           {
               
Sleep(10000);
               Print(
"Connection not restored"iteration*10,"  seconds passed");
               
connect IsConnected();
               if(
connect)
               {
                   Print(
"Connection restored");
               }
               
iteration++;
           }
           Print(
"Connection problems");
           return(
false);  
       }
       case 
8:
       {
           Print(
"Frequent requests");
           return(
false);  
       }
       case 
64:
       {
           Print(
"Account is blocked!");
           return(
false);  
       }
       case 
65:
       {
           Print(
"Wrong account number???");
           return(
false);  
       }
       case 
128:
       {
//????
           
Print("Waiting of transaction timed out");
           
Sleep(10000);//10 seconds
           
RefreshRates();
           return(
false);  
       }
       case 
129:
       {
           Print(
"Wrong price");
           
RefreshRates();
           return(
false);  
       }
       case 
130:
       {
           Print(
"Wrong stop SLEVEL"+MarketInfo(Symbol(),MODE_STOPLEVEL)+" FZLVL "+MarketInfo(Symbol(),MODE_FREEZELEVEL)+" FZLVL "+MarketInfo(Symbol(),MODE_SPREAD));
           
RefreshRates();
           return(
false);   
       }
       case 
131:
       {
           Print(
"Wrong calculation of trade volume");
           return(
false);  
       }
       case 
132:
       {
           Print(
"Market closed");
           return(
false);  
       }
       case 
134:
       {
//NOT ENOUGH CASH?
           
Print("Lack of margin for performing operation, margin: "+AccountFreeMargin());
           
           return(
false);  
       }
       case 
135:
         {
           Print(
"Prices changed");
           
RefreshRates();
           return(
true);  
         }
       case 
136:
         {
           Print(
"No price!");
           return(
false);  
         }
       case 
138:
         {
           Print(
"Requote again!");
           
RefreshRates();
           return(
true);  
         }
       case 
139:
         {
           Print(
"The order is in process. Program glitch");
           
Sleep(10000);//10 seconds
           
return(true);  
         }
       case 
141:
         {
           Print(
"Too many requests");
           
Sleep(10000);//10 seconds 
           
return(true);  
         }
       case 
148:
         {
           Print(
"Transaction volume too large");
           return(
false);  
         }                                          
         default:
         {  
            Print(
"Unhandeled exception code:",error," stoplevel ",MarketInfoSymbol(), MODE_STOPLEVEL) ," spread ",MarketInfoSymbol(), MODE_SPREAD)+" LOTS:"lot);
            return(
false);
         }
     }
   
  }
  
void doScreenshot()
  {
      
string dateMarker TimeYear(TimeCurrent())+"_"+TimeMonth(TimeCurrent())+"_"+TimeDay(TimeCurrent())+"___"+TimeHour(TimeCurrent())+"_"+TimeMinute(TimeCurrent())+"_"+TimeSeconds(TimeCurrent());
      
WindowScreenShot(getMagic()+" "+Version+" "+dateMarker+".gif"800600010);
  }
void closeAllPoisitions(int type)
{
   
//close all
   
int oc orderCount(type);
   while(
oc 0)
   {
      
int total OrdersTotal();
      
RefreshRates();
      for(
int cnt ;cnt<=total;cnt++)
      {
        
OrderSelect(cntSELECT_BY_POSMODE_TRADES);
        if(
OrderMagicNumber() == getMagic()) 
        {
            if(
OrderType() == OP_BUY && type == OP_BUY)
            {
               
OrderClose(OrderTicket(),OrderLots(), Bid0Yellow);
            }
            else if(
OrderType() == OP_SELL && type == OP_SELL)
            {
               
OrderClose(OrderTicket(),OrderLots(), Ask0Yellow);
            }
                            
        } 
      }
      
oc orderCount(type); 
   }
}
double profitCount()
{
    
double  oc 0;
    for(
int cnt ;cnt<OrdersTotal();cnt++)
    {
      
OrderSelect(cntSELECT_BY_POSMODE_TRADES);

      if(
OrderMagicNumber() == getMagic()) 
      {
         
oc+= OrderProfit()+OrderSwap()+OrderCommission();
      }
    } 
    return(
oc);

  #6 (permalink)  
Alt 02.06.15
Gesperrter Benutzer
 
Registriert seit: Jan 2015
Beiträge: 477
BlackPearl befindet sich auf einem aufstrebenden Ast
Standard

TrailingStopPips scheinen die vermissten PipSteps zu sein ?!
  #7 (permalink)  
Alt 02.06.15
Elite Mitglied
 
Registriert seit: Apr 2011
Beiträge: 2.733
traderdoc befindet sich auf einem aufstrebenden Ast
Standard

Wie bereits vermutet:

Ask > ((OrderOpenPrice()+(1*bm*Point))+BreakEvenTrigger* Point)

d.h. wenn bei einer BuyOrder der SL noch nicht nachgezogen wurde und der AskKurs größer ist als die Summe aus OpenPrice + 1 Pip + BreakEvenTrigger, dann wird der SL 1 Pip über den OpenPreis gelegt.

Genauso beim TrailingStopTrigger. Ab da wird getrailt, vom Askkurs TrailingStopPips abgezogen und der SL neu gelegt und pipgenau nachgezogen. Deshalb erübrigt sich ein TrailingStep.

traderdoc
__________________
Ich erfülle Euch gern Eure EA-, Indikator- und Script-Programmierungswünsche auf Honorarbasis.
  #8 (permalink)  
Alt 04.06.15
Premium Mitglied
 
Registriert seit: Apr 2015
Beiträge: 422
Raul0 befindet sich auf einem aufstrebenden Ast
Standard

ok, Danke

Raul0
  #9 (permalink)  
Alt 08.06.15
Premium Mitglied
 
Registriert seit: Apr 2015
Beiträge: 422
Raul0 befindet sich auf einem aufstrebenden Ast
Standard

Hallo,

kann mir jemand noch einmal helfen zu dem Thema, ich möchte nicht, dass der Trailing nach jedem Pip die Order modifiziert. Ich finde das belastet unnötig.

Ich würde gerne eine Variable einsetzen, wo größere Schritte möglich sind, als pipgenaues nachziehen. Z.B. aller 4 Pips.

Ich hatte verschiedene Sachen probiert, aber alles viel zu kompliziert geworden.
Schleifenzählung und Addition.
Gibt es eine einfache Veränderung, welche ich noch nicht weiss, die zum Ergebniss führt?

Gruss, Raul
Thema geschlossen

Lesezeichen

Stichworte
breakeventrigger, mql4, programmierung, programmierung metatrader, trailingstoppips, trailingstoptrigger

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus




Alle Zeitangaben in WEZ +1. Es ist jetzt 13:17 Uhr.





Suchmaschine - Reisen - Wavesnode - Facebook Forum - Spam Firewall
-----------------------------------------------------------------------------------------------------------------------------
Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
SEO by vBSEO 3.6.1
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum
MetaTrader bzw. MetaTrader 4 und MetaTrader 5 sind eingetragene Marken der MetaQuotes Software Corp.
-----------------------------------------------------------------------------------------------------------------------------