[WARNUNG GESCHLOSSEN!] Alle Fragen von Neulingen, um das Forum nicht zu überladen. Fachleute, gehen Sie nicht vorbei. Ohne dich kann ich nirgendwo hingehen. - Seite 999

 
Hallo. Könnten Sie mir bitte sagen, was in den Code des EA einfügen, um die EMA-Periode zu optimieren?
 
gawrik:
Hallo. Könnten Sie mir bitte sagen, was in den Code des EA einfügen, um die EMA-Periode zu optimieren?
Was ist der EMA-Zeitraum?
 
gleitender durchschnitt exp. periode. kann ich ihn hier einwerfen, kann ihn jemand optimieren?
 



#property copyright "hasgkhlhjgg"
#property link "http://www.efefrWRF.com"

#define MIN_STOPLOSS_POINT 10
#define MIN_TAKEPROFIT_POINT 10
#define MAGIC 316995

externer String sNameExpert = "DGJJFYGJD";
extern int nAccount =0;
extern double dBuyStopLossPoint = 0;
extern double dSellStopLossPoint = 0;
extern double dBuyTakeProfitPoint = 0;
extern double dSellTakeProfitPoint = 0;
extern double dBuyTrailingStopPoint = 0;
extern double dSellTrailingStopPoint = 0;
extern double dLots = 0.03;
extern int nSlippage = 4;
extern bool lFlagUseHourTrade = False;
extern inttern nFromHourTrade = 0;
extern intNToHourTrade = 23;
extern bool lFlagUseSound = True;
externer String sSoundFileName = "alert.wav";
extern color colorOpenBuy = Blau;
extern colorCloseBuy = Aqua;
extern colorOpenSell = Red;
extern colorCloseSell = Aqua;


void deinit() {
Kommentar(");
}

//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
wenn (lFlagUseHourTrade){
if (!(Hour()>=nFromHourTrade && Hour()<=nToHourTrade)) {
Comment("Die Zeit für den Handel ist noch nicht gekommen!");
zurück(0);
}
}

if(Balken < 100){
Print("Balken kleiner als 100");
zurück(0);
}

if(nAccount > 0 && nAccount != AccountNumber()){
Comment("Handel auf Konto: "+Kontonummer()+" VERBOTEN!");
zurück(0);
}

if((dBuyStopLossPoint > 0 && dBuyStopLossPoint < MIN_STOPLOSS_POINT) ||
(dSellStopLossPoint > 0 && dSellStopLossPoint < MIN_STOPLOSS_POINT)){
Print("StopLoss kleiner als " + MIN_STOPLOSS_POINT);
zurück(0);
}
if((dBuyTakeProfitPoint > 0 && dBuyTakeProfitPoint < MIN_TAKEPROFIT_POINT) ||
(dSellTakeProfitPoint > 0 && dSellTakeProfitPoint < MIN_TAKEPROFIT_POINT)){
Print("TakeProfit kleiner als " + MIN_TAKEPROFIT_POINT);
zurück(0);
}

double diMA0=iMA(NULL,1,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA1=iMA(NULL,1,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA2=iMA(NULL,1,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA3=iMA(NULL,1,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA4=iMA(NULL,1,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA5=iMA(NULL,1,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA6=iMA(NULL,5,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA7=iMA(NULL,5,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA8=iMA(NULL,5,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA9=iMA(NULL,5,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA10=iMA(NULL,5,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA11=iMA(NULL,5,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA12=iMA(NULL,15,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA13=iMA(NULL,15,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA14=iMA(NULL,15,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA15=iMA(NULL,15,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA16=iMA(NULL,15,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA17=iMA(NULL,15,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA18=iMA(NULL,30,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA19=iMA(NULL,30,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA20=iMA(NULL,30,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA21=iMA(NULL,30,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA22=iMA(NULL,30,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA23=iMA(NULL,30,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA24=iMA(NULL,60,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA25=iMA(NULL,60,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA26=iMA(NULL,60,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA27=iMA(NULL,60,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA28=iMA(NULL,60,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA29=iMA(NULL,60,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA30=iMA(NULL,60,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA31=iMA(NULL,60,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA32=iMA(NULL,1,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA33=iMA(NULL,1,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA34=iMA(NULL,1,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA35=iMA(NULL,1,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA36=iMA(NULL,1,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA37=iMA(NULL,1,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA38=iMA(NULL,5,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA39=iMA(NULL,5,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA40=iMA(NULL,5,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA41=iMA(NULL,5,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA42=iMA(NULL,5,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA43=iMA(NULL,5,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA44=iMA(NULL,15,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA45=iMA(NULL,15,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA46=iMA(NULL,15,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA47=iMA(NULL,15,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA48=iMA(NULL,15,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA49=iMA(NULL,15,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA50=iMA(NULL,30,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA51=iMA(NULL,30,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA52=iMA(NULL,30,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA53=iMA(NULL,30,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA54=iMA(NULL,30,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA55=iMA(NULL,30,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA56=iMA(NULL,60,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA57=iMA(NULL,60,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA58=iMA(NULL,60,29,0,MODE_EMA,PRICE_CLOSE,0);
double diMA59=iMA(NULL,60,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA60=iMA(NULL,60,50,0,MODE_EMA,PRICE_CLOSE,0);
double diMA61=iMA(NULL,60,100,0,MODE_EMA,PRICE_CLOSE,0);
double diMA62=iMA(NULL,60,15,0,MODE_EMA,PRICE_CLOSE,0);
double diMA63=iMA(NULL,60,29,0,MODE_EMA,PRICE_CLOSE,0);


if(AccountFreeMargin() < (1000*dLots)){
Print("Wir haben kein Geld. Freie Marge = " + AccountFreeMargin());
zurück(0);
}

bool lFlagBuyOpen = false, lFlagSellOpen = false, lFlagBuyClose = false, lFlagSellClose = false;

lFlagBuyOpen = (diMA0>diMA1 && diMA2>diMA3 && diMA4>diMA5 && diMA6>diMA7 && diMA8>diMA9 && diMA10>diMA11 && diMA12>diMA13 && diMA14>diMA15 && diMA16>diMA17 && diMA18>diMA19 && diMA20>diMA21 && diMA22>diMA23 && diMA24>diMA25 && diMA26>diMA27 && diMA28>diMA29);
lFlagSellOpen = (diMA32<diMA33 && diMA34<diMA35 && diMA36<diMA37 && diMA38<diMA39 && diMA40<diMA41 && diMA42<diMA43 && diMA44<diMA45 && diMA46<diMA47 && diMA46<diMA47; und diMA46<diMA47 && diMA48<diMA49 && diMA50<diMA51 && diMA52<diMA53 && diMA54<diMA55 && diMA56<diMA57 && diMA58<diMA59 && diMA60<diMA61);
lFlagBuyClose = (diMA30<diMA31);
lFlagSellClose = (diMA62>diMA63);

if (!ExistPositions()){

wenn (lFlagBuyOpen){
OpenBuy();
{ return(0);
}

wenn (lFlagSellOpen){
OpenSell();
zurück(0);
}
}
if(ExistPositions()){
if(OrderType()==OP_BUY){
if(lFlagBuyClose){
bool flagCloseBuy = OrderClose(OrderTicket(), OrderLots(), Bid, nSlippage, colorCloseBuy);
wenn (flagCloseBuy && lFlagUseSound)
PlaySound(sSoundFileName);
zurück(0);
}
}
if(OrderType()==OP_SELL){
if(lFlagSellClose){
bool flagCloseSell = OrderClose(OrderTicket(), OrderLots(), Ask, nSlippage, colorCloseSell);
if (flagCloseSell && lFlagUseSound)
PlaySound(sSoundFileName);
zurück(0);
}
}
}

wenn (dBuyTrailingStopPoint > 0 || dSellTrailingStopPoint > 0){

for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
bool lMagic = true;
if (MAGIC > 0 && OrderMagicNumber() != MAGIC)
lMagic = false;

if (OrderSymbol()==Symbol() && lMagic) {
if (OrderType()==OP_BUY && dBuyTrailingStopPoint > 0) {
if (Bid-OrderOpenPrice() > dBuyTrailingStopPoint*Point) {
wenn (OrderStopLoss()<Bid-dBuyTrailingStopPoint*Point)
ModifyStopLoss(Bid-dBuyTrailingStopPoint*Point);
}
}
if (OrderType()==OP_SELL) {
if (OrderOpenPrice()-Ask>dSellTrailingStopPoint*Point) {
wenn (OrderStopLoss()>Ask+dSellTrailingStopPoint*Point || OrderStopLoss()==0)
ModifyStopLoss(Ask+dSellTrailingStopPoint*Point);
}
}
}
}
}
}
zurück (0);
}

bool ExistPositions() {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
bool lMagic = true;

if (MAGIC > 0 && OrderMagicNumber() != MAGIC)
lMagic = false;

if (OrderSymbol()==Symbol() && lMagic) {
return(True);
}
}
}
return(false);
}

void ModifyStopLoss(double ldStopLoss) {
bool lFlagModify = OrderModify(OrderTicket(), OrderOpenPrice(), ldStopLoss, OrderTakeProfit(), 0, CLR_NONE);
if (lFlagModify && lFlagUseSound)
PlaySound(sSoundFileName);
}

void OpenBuy() {
double dStopLoss = 0, dTakeProfit = 0;

wenn (dBuyStopLossPoint > 0)
dStopLoss = Bid-dBuyStopLossPoint*Point;

wenn (dBuyTakeProfitPoint > 0)
dTakeProfit = Bid + dBuyTakeProfitPoint * Point;

int numorder = OrderSend(Symbol(), OP_BUY, dLots, Ask, nSlippage, dStopLoss, dTakeProfit, sNameExpert, MAGIC, 0, colorOpenBuy);

if (numorder > -1 && lFlagUseSound)
PlaySound(sSoundFileName);
}

void OpenSell() {
double dStopLoss = 0, dTakeProfit = 0;

wenn (dSellStopLossPoint > 0)
dStopLoss = Ask+ dSellStopLossPoint*Point;

wenn (dSellTakeProfitPoint > 0)
dTakeProfit = Ask-dSellTakeProfitPoint*Point;

int numorder = OrderSend(Symbol(),OP_SELL, dLots, Bid, nSlippage, dStopLoss, dTakeProfit, sNameExpert, MAGIC, 0, colorOpenSell);

if (numorder > -1 && lFlagUseSound)
PlaySound(sSoundFileName);
}

Ich möchte es nur für verschiedene Paare verwenden, aber es ist für EURUSD konzipiert, so dass ich es nicht manuell anpassen kann, weder moralisch noch physisch

 
sowohl das Öffnen als auch das Schließen beim Schieben
 
Kann jemand helfen?
 

Guten Morgen!

Können Sie mir bitte sagen, wie ich zwei berechnete Parameter aus einer Funktionsberechnung ausgeben kann? Wenn ich es richtig verstehe, gibt die Funktion return() nur einen Parameter zurück, der in den Klammern angegeben ist.

double РасчётТЛвверх(int a, double Цена1 Син)
        {
          double МА23 = iMA(NULL,0,23,0,MODE_EMA,PRICE_CLOSE,a),
                 
                 MМА23[17];
                 
                 MМА23[0]=МА23-603*Point;
                 MМА23[1]=МА23-377*Point;
                 MМА23[2]=МА23-233*Point;
                 MМА23[3]=МА23-144*Point;
                 MМА23[4]=МА23-89*Point;
                 MМА23[5]=МА23-55*Point;
                 MМА23[6]=МА23-34*Point;
                 MМА23[7]=МА23-21*Point;
                 MМА23[8]=МА23;
                 MМА23[9]=МА23+21*Point;
                 MМА23[10]=МА23+34*Point;
                 MМА23[11]=МА23+55*Point;
                 MМА23[12]=МА23+89*Point;
                 MМА23[13]=МА23+144*Point;
                 MМА23[14]=МА23+233*Point;
                 MМА23[15]=МА23+377*Point;
                 MМА23[16]=МА23+603*Point;
  
          for(int i=0;i<=16;i++)
            {
              if(NormalizeDouble(Цена1 Син+8*Point,Digits)<=NormalizeDouble(MМА23[i],Digits))
                {
                  double ТЛвверх=MМА23[i+5];
                  double БезУбMМА23 вверх = MМА23[i+4];
                  break;
                    
                      
                }
            }
         
          
                
         return(ТЛвверх);
        }
//--------------------------------------------------------------------

Ich kann nur TLvup ausgeben. Und ich möchte auch BezubMMA23up verwenden. Aber wenn ich so schreibe - return(TLup, BezUbMMA23up) oder return(TLup; BezUbMMA23up), bekomme ich einen Fehler. Die Funktion wird als double TL-up=CalculateTL-up(a,Price1Cin) aufgerufen;

Wie ruft man an, um sowohl TLup als auch BezUbMMA23up zu verwenden? Oder sollte ich für die Berechnung des Parameters WithoutMMA23up den angegebenen Code noch einmal separat schreiben und return( WithoutMMA23up) ausgeben?

 
Erstellen Sie zum Beispiel eine globale Variable und fügen Sie dort das Ergebnis der Funktion ein...
 
Sie müssen also noch zwei Ergebnisse der Berechnung ausgeben. Der beigefügte Code gibt nur einen aus. Wie kann ich zwei ausgeben?
 
Danke an alle, ich habe die Antwort hier gefunden - https://www.mql5.com/ru/articles/1496
Grund der Beschwerde: