コーディングのヘルプ - ページ 629

 
traderduke:

mladen & mrtools

私は取引で自己を爆発させるEAを持っています。私は、既存のEAに追加することができるVoidまたは関数を構築するために助けを必要としています。この関数は、対処する必要があります。

input bool doBasketExit = true; // バスケットエグジット条件をチェックする。
input double BasketTP = 250.0; // バスケットテイクプロフィット(口座通貨) チャートペア
input double BasketSL = -100.0; // バスケット・ストップロス(口座通貨) チャート・ペア

H1のアグレッシブEAで9つのペア/チャートを動かしていて、9つのチャートそれぞれでペアに応じたバスケット取引をしたいのです。
以下は私に起こったことです。9つのチャートが動いていて、3つのチャートはもちろん3つの別々のペアで取引中で、それぞれ15トレード、そう45トレードが開いていて、2つは利益が出ていて、1つはひどく負けている状態です。15の各グループ/ペアを別々に加算し、バスケットのSLとTPの境界線に対して各グループをこする方法を探しています。バスケットのセットアップを見つけましたが、もちろん改良が必要です。コツは、Order Profit Trade欄から同じペアを合算させることです。特定のペアを持つチャートにいることで、私は空白を思いついたと思ったが、そのような複雑なものです。この関数は何らかの方法でOrderProfit by Pairを読み込まなければならないのでしょうか?

例として、私のコードをご覧ください。

void closeTrades( CURRENCY* &currencies[] ) { // バスケット出口をチェックする。
// バスケットエグジットのチェック
if ( doBasketExit ) {
double basketProfit = getBasketProfit();
if ( ( BasketTP > 0.0 ) && ( basketProfit > BasketTP ) )||
( ( バスケットSL < 0.0 ) && ( バスケットProfit < バスケットSL ) ) ){
closeAll()を実行します。
}

double getBasketProfit() {
double basketProfit = 0.0;
for (int iOrder=OrdersTotal()-1; iOrder >= 0; iOrder--){
if (オーダーセレクト(iOrder,SELECT_BY_POS,MODE_TRADES)) { { {?
if ( OrderMagicNumber() == MagicNumber ) { (オーダーマジック番号)
if ( (OrderType() == OP_BUY) )|| (OrderType() == OP_SELL) ){
basketProfit += OrderProfit() + OrderSwap() + OrderCommission();
}
}
}
}
return(basketProfit);


void closeAll() {
ダブルclosePrice;
文字列 symbolName;
int result;
for (int iOrder=OrdersTotal()-1; iOrder >= 0; iOrder--){
if (オーダーセレクト(iOrder,SELECT_BY_POS,MODE_TRADES)) { { { if (オーダーマジックナンバー(OrderMagicNumber))
if ( OrderMagicNumber() == MagicNumber ) { (オーダーマジック番号)
if ( (OrderType() == OP_BUY) )|| (OrderType() == OP_SELL) ){
symbolName = OrderSymbol();
closePrice = ( OrderType() == OP_BUY ) ?MarketInfo( symbolName, MODE_BID ) : MarketInfo( symbolName, MODE_ASK );
result = OrderCloseReliable(OrderTicket(), OrderLots(), closePrice, 50 );
}
}



本当にこれを調べていただきありがとうございます

ありがとうございます。
レイ

レイ


他のEAが扱うマジックナンバーをすべて把握し、あなたが必要とする「グループ内」オペレーションを行う「マザーEA」のようなものが必要なのでしょう。

 
MLADENさん、受信箱を確認して ください。
 
mladen:

次のようにしてみてください。

の代わりに

ありがとうMladen、コードのいくつかの調整を行い、それが今働く。
 
mladen:

レイ


他のEAが扱うマジックナンバーをすべて把握し、あなたが必要とする「グループ上」の操作を行うような「マザーEA」のようなものが必要なのでしょう。

mladen

は、この件についてのご意見をありがとうございます。それでNOです。

ありがとうございます。


レイ

 

矢印が再描画を避けるために、他のシグナルキャンドルのクローズ後に表示されるようにしようとしましたが、すべて無駄に。TOOLSとMLADEN、以下はコードです。

//+------------------------------------------------------------------+
//|                                              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);
}
 
ハイ

こんにちは mladen

ITM X-Gen Daily Scalper Indicator.mq4が欲しいのですが。

助けてください

ありがとうございます

 
alozard:

こんにちは mladen

ITM X-Gen Daily Scalper Indicator.mq4が欲しいのですが。

助けてください

ありがとうございます。

アロザド

このインジケータは、私のCentered TMA bandsというインジケータを改名したものです。こちらでご覧いただけます :https://www.mql5.com/en/forum/181241

 
mladenさん、上記のコードのバージョンについて教えてください。
 

Mladenさん、以下のコードを見てください。


//+------------------------------------------------------------------+
//|                                              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:

Mladenさん、以下のコードを見てください。時間枠を切り替えるまで、ライブで矢印が出ません。


カポー

何度も言っているように、そのインジケータは悪いリペインターで、だからそのようなことをするのです。私の最善のアドバイスは、それを忘れることです。