Kodlama yardımı - sayfa 629

 
traderduke :

mladen & mrtools

İşlemlerle kendini patlatan bir EA'm var. Mevcut bir EA'ya eklenebilecek bir Void veya işlev oluşturmak için yardıma ihtiyacım var. Bu işlevin şunları ele alması gerekir:

giriş bool doBasketExit = true; // Sepet Çıkış koşullarını kontrol edin
giriş çift SepetTP = 250.0; // Basket Kar Al (Hesap Para Birimi) Grafik Çifti
giriş çift SepetSL = -100.0; // Sepet Stop Loss (Hesap Para Birimi) Grafik Çifti

H1'de agresif EA ile 9 çift/Grafik çalıştırıyorum ve 9 grafiğin her birinde çifte özel sepet ticareti istiyorum.
İşte başıma gelenler. 9 çizelge çalışıyor, 3 çizelge ticarette, elbette, her biri 15 işlem içeren 3 ayrı çift, evet 45 işlem açık, 2'si kârda ve biri kötü bir şekilde kaybediyor. 15'in her grubunu/çiftini ayrı ayrı toplamanın ve her grubu bir Basket SL & TP sınırlarına sürtmenin bir yolunu arıyorum. Bir sepet kurdum ama elbette iyileştirmeye ihtiyacı var. İşin püf noktası, aynı çifti Sipariş Kar Ticareti sütunundan toplamaktır. Belirli bir çiftle bir Grafikte yer alarak bir boşluk bulduğumu düşündüm ama bu biraz karmaşık. İşlev bir şekilde OrderProfit'i Çifte Göre okumalıdır???

Kodumu zayıf bir örnek olarak görün;

void closeTrades( CURRENCY* &currencies[] ) {
// Sepet Çıkışını Kontrol Et
if ( doBasketExit ) {
çift sepetProfit = getBasketProfit();
if ( ( ( BasketTP > 0.0 ) && ( basketProfit > BasketTP ) ) ||
( ( BasketSL < 0.0 ) && ( basketProfit < BasketSL ) ) ) {
hepsini kapat();
}
}
double getBasketProfit() {
çift sepetKar = 0.0;
for (int iOrder=OrdersTotal()-1; iOrder >= 0; iOrder--) {
if (OrderSelect(iOrder,SELECT_BY_POS,M ODE_TRADES)) {
if ( OrderMagicNumber() == MagicNumber ) {
if ( (OrderType() == OP_BUY) || (OrderType() == OP_SEL) ) {
basketProfit += OrderProfit() + OrderSwap() + OrderCommission();
}
}
}
}
dönüş(sepetKar);
}

void closeAll() {
çift yakınFiyat;
dize sembolüAd;
int sonuç;
for (int iOrder=OrdersTotal()-1; iOrder >= 0; iOrder--) {
if (OrderSelect(iOrder,SELECT_BY_POS,M ODE_TRADES)) {
if ( OrderMagicNumber() == MagicNumber ) {
if ( (OrderType() == OP_BUY) || (OrderType() == OP_SEL) ) {
sembolAdı = OrderSymbol();
closePrice = ( OrderType() == OP_BUY ) ? MarketInfo( symbolName, MODE_BID) : MarketInfo(symbolName, MODE_ASK);
sonuç = OrderCloseReliable(OrderTicket(), OrderLots(), closePrice, 50 );
}
}



Buna baktığın için gerçekten minnettarım

teşekkürler
Işın

Işın


Bir tür "ana EA"ya ihtiyacınız var - bu, diğer EA'lar tarafından kullanılan tüm sihirli sayıları bilecek ve ardından yapmanız gereken "grupta" işlemleri yapacaktır.

 
Bay MLADEN, lütfen gelen kutunuzu kontrol edin efendim
 
mladen :

Aşağıdakileri yapmayı deneyin:

Yerine

Teşekkürler Mladen, kodda bazı ayarlamalar yaptınız ve şimdi çalışıyor.
 
mladen :

Işın


Bir tür "ana EA"ya ihtiyacınız var - bu, diğer EA'lar tarafından kullanılan tüm sihirli sayıları bilecek ve ardından yapmanız gereken "grupta" işlemleri yapacaktır.

mladen

bu konudaki düşünceleriniz için teşekkürler. Yani HAYIR.

tekrar teşekkürler


Işın

 

Yeniden boyamayı önlemek için diğerinde sinyal mumunun kapanmasından sonra okun görünmesini sağlamaya çalıştım ama hepsi boşuna.lütfen bana yardım edin MR. TOOLS ve MLADEN, aşağıdaki koddur.

 //+------------------------------------------------------------------+
//|                                              signalindicator.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Yellow
#property indicator_color3 Aqua
#property indicator_color4 Red

extern int FastEMA = 5 ;
extern int SlowEMA = 6 ;
extern int RSIPeriod = 7 ;
extern bool Alerts = TRUE ;
double buffer_1[];
double buffer_2[];
double arrow_1[];
double arrow_2[];
int a = 0 ;
int b = 0 ;
double x = 0.0 ;
double y = 0.0 ;

int init() {
   SetIndexStyle ( 0 , DRAW_LINE );
   SetIndexBuffer ( 0 , buffer_1);
   SetIndexStyle ( 1 , DRAW_LINE );
   SetIndexBuffer ( 1 , buffer_2);
   SetIndexStyle ( 2 , DRAW_ARROW , 0 , 4 );
   SetIndexArrow ( 2 , 217 );
   SetIndexBuffer ( 2 , arrow_1);
   SetIndexEmptyValue ( 2 , 0.0 );
   SetIndexStyle ( 3 , DRAW_ARROW , 0 , 4 );
   SetIndexArrow ( 3 , 218 );
   SetIndexBuffer ( 3 , arrow_2);
   SetIndexEmptyValue ( 3 , 0.0 );
   return ( 0 );
}

int deinit() {
   return ( 0 );
}

int start() {
   int counted_bars = IndicatorCounted ();
   double irsi_1 = 0 ;
   bool c = FALSE ;
   double price_10 = 0 ;
   if (counted_bars < 0 ) return (- 1 );
   if (counted_bars > 0 ) counted_bars--;
   int li_0 = Bars - counted_bars;
   for ( int i = 0 ; i < li_0; i++) {
      buffer_1[i] = iMA ( NULL , 0 , FastEMA, 0 , MODE_EMA , PRICE_CLOSE , i);
      buffer_2[i] = iMA ( NULL , 0 , SlowEMA, 0 , MODE_EMA , PRICE_CLOSE , i);
      irsi_1 = iRSI ( NULL , 0 , RSIPeriod, PRICE_CLOSE , i);
      x = buffer_1[i] - buffer_2[i];
       if (x > 0.0 && irsi_1 > 50.0 ) a = 1 ;
       else
         if (x < 0.0 && irsi_1 < 50.0 ) a = 2 ;
       if (a == 1 && b == 2 ) {
         arrow_2[i - 1 ] = High [i - 1 ] - 5.0 * Point ;
         c= TRUE ;
         price_10 = Ask ;
      } else {
         if (a == 2 && b == 1 ) {
            arrow_1[i - 1 ] = Low [i - 1 ] - 5.0 * Point ;
            c = TRUE ;
            price_10 = Bid ;
         }
      }
      b = a;
      y = x;
   }
   if (Alerts && c) {
       PlaySound ( "alert.wav" );
       if (b == 2 ) Alert ( Symbol (), "  M" , Period (), "Buy at " + price_10 + "!!" , "Entry Point" , 0 );
       else
         if (b == 1 ) Alert ( Symbol (), "  M" , Period (), "Sell at " + price_10 + "!!" , "Entry Point" , 0 );
      c= FALSE ;
   }
   return ( 0 );
}
 
merhaba

merhaba mladen

ITM X-Gen Daily Scalper Indicator.mq4'e ihtiyacım var

bana yardım et

teşekkürler

 
alozard :

merhaba mladen

ITM X-Gen Daily Scalper Indicator.mq4'e ihtiyacım var

bana yardım et

teşekkürler

alozard

Bu gösterge, Ortalanmış TMA bantlarım göstergesi olarak yeniden adlandırıldı. Burada bulabilirsiniz: https://www.mql5.com/en/forum/181241

 
Bay mladen, lütfen bana yukarıdaki kodların versiyonunda yardım edin.
 

Bay Mladen, lütfen aşağıdaki kodlara bakın, ben zaman çerçevesini değiştirene kadar ok canlı görünmüyor.


 //+------------------------------------------------------------------+
//|                                              signalindicator.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Yellow
#property indicator_color3 Aqua
#property indicator_color4 Red

#property indicator_color4 Red

extern int FastEMA = 5 ;
extern int SlowEMA = 6 ;
extern int RSIPeriod = 7 ;
extern bool Alerts = TRUE ;
double buffer_1[];
double buffer_2[];
double arrow_1[];
double arrow_2[];
int a = 0 ;
int b = 0 ;
double x = 0.0 ;
double y = 0.0 ;
 double alertshow;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle ( 0 , DRAW_NONE );
   SetIndexBuffer ( 0 , buffer_1);
   SetIndexStyle ( 1 , DRAW_NONE );
   SetIndexBuffer ( 1 , buffer_2);
   SetIndexStyle ( 2 , DRAW_ARROW , 0 , 4 );
   SetIndexArrow ( 2 , 241 );
   SetIndexBuffer ( 2 , arrow_1);
   SetIndexEmptyValue ( 2 , 0.0 );
   SetIndexStyle ( 3 , DRAW_ARROW , 0 , 4 );
   SetIndexArrow ( 3 , 242 );
   SetIndexBuffer ( 3 , arrow_2);
   SetIndexEmptyValue ( 3 , 0.0 );

   return ( 0 );
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int OnCalculate ( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[])
  {
   int counted_bars = IndicatorCounted ();
   double irsi_1 = 0 ;
   int li_0;
   bool c = FALSE ;
   double price_10 = 0 ;
   if (counted_bars < 0 ) return (- 1 );
   if (counted_bars > 0 ) counted_bars--;
   if (counted_bars== 0 )
      li_0= MathMin ( Bars - 10 - 1 , Bars - MathMax (FastEMA,SlowEMA)- 1 );
   else
      li_0= Bars -counted_bars;
   for ( int i = 0 ; i < li_0; i++) {
      buffer_1[i] = iMA ( NULL , 0 , FastEMA, 0 , MODE_EMA , PRICE_CLOSE , i);
      buffer_2[i] = iMA ( NULL , 0 , SlowEMA, 0 , MODE_EMA , PRICE_CLOSE , i);
      irsi_1 = iRSI ( NULL , 0 , RSIPeriod, PRICE_CLOSE , i);
      x = buffer_1[i] - buffer_2[i];
       if (x > 0.0 && irsi_1 > 50.0 ) a = 1 ;
       else
         if (x < 0.0 && irsi_1 < 50.0 ) a = 2 ;
       if (a == 1 && b == 2 ) {
         arrow_2[i - 1 ] = High [i - 1 ] - 5.0 * Point ;
         c= TRUE ;
         price_10 = Ask ;
      } else {
         if (a == 2 && b == 1 ) {
            arrow_1[i - 1 ] = Low [i - 1 ] - 5.0 * Point ;
            c = TRUE ;
            price_10 = Bid ;
         }
      }
      b = a;
      y = x;
   }
   if (Alerts && c) {
       PlaySound ( "alert.wav" );
       if (b == 2 )  
      
         if (alertshow< Time [ 1 ] && counted_bars!= 0 )
           {
             PlaySound ( "news.wav" ); // buy wav
             Alert ( Symbol (), " buy signal" );
            alertshow= Time [ 1 ];
           }
       else
         if (b == 1 ) if (alertshow< Time [ 1 ] && counted_bars!= 0 )
           {
             PlaySound ( "news.wav" ); // buy wav
             Alert ( Symbol (), "  sell signal" );
            alertshow= Time [ 1 ];
           }
   }
//----
   return (prev_calculated);
  }
//+------------------------------------------------------------------+
 
kapoo :

Bay Mladen, lütfen aşağıdaki kodlara bakın, ben zaman çerçevesini değiştirene kadar ok canlı görünmüyor.


kapoo

Size defalarca söylediğim gibi: bu gösterge kötü bir yeniden boyayıcıdır ve bu yüzden yaptığı şeyi yapar. En iyi tavsiyem unut gitsin