アドバイザーを無料でお書きします - ページ 112

 
皆さん、お元気ですか?フォーラムで、チャートに存在する通常の指標から色付きの線に基づいてフクロウを作ることは可能か、という私の質問に対するフィードバックから判断すると、それは可能であることが明らかになったのです。例えば、緑が青と交差する、青が赤と交差する、など。そして、これらの条件が重なると、適切な方向に注文が出される。なぜ、具体的に線引きで?なぜなら、このようなExpert Advisorは、多くの実験を行い、数多くの理論を確認する初級トレーダーにとって 大きな助けとなり、本当に貴重な時間と神経を節約するExpert Advisorとなるからです。なぜ私のメッセージは、無料EAのセクションにあるのですか?すべての人にとまではいかなくても、多くの人に必ず役立つはずだからです。わかりやすいようにスクリーンショットを同封します。
ファイル:
o9b4dq-1.jpg  73 kb
 
こんにちは。フォレックス・アカデミー・スナイパーXのストラテジーを自動化する方法はありますか?
 
こんにちは、皆さん、これに似たものを提案していただけないでしょうか。 e-CloseByProfit- EAは、あらかじめ定義された合計利益または損失レベルに達したときにすべてのポジションを閉じます --- MT5上でのみありがとうございます。
 

こんにちは。質問ですが、2つの指標のシグナルごとに注文を出すEAが必要なのですが(ある組み合わせでシグナルを出す)、一言で言えば、指標のシグナルに応じてそれぞれ複数の買い注文、売り注文が 市場に存在する必要があります。しかし、マーケットに1つしか注文がなく、それが閉じるまで次の注文が開かないのですが・・・。 注文数の問題なのでしょうか?ヒントをください。必要ならコードを送ります。

ありがとうございました。

 
danil77783:

こんにちは。あなたは時間がある場合、あなたは私を助けることができる 質問はこれです、私は2つの指標の各信号に注文を開くEAを必要とする、(彼らは特定の組み合わせであるときに信号を与える)一言で言えば、市場で購入 または売却するいくつかの順序が あるはず、それに応じて、指標の信号に応じて。しかし、マーケットに1つしか注文がなく、それが閉じるまで次の注文が開かないのですが・・・。 注文のカウントの問題なのでしょうか?ヒントをください。必要であれば、コードをお送りします。

ありがとうございました。

まあ、プログラミングを理解するところから始めないと、コードがないとEAを修正することはできないのですが。ほとんどの場合、あなたのEAは市場に1つの注文でテンプレートに書かれており、複数の注文と異なる基準で作業することは非常に異なっているため、実際には修正することは非常に困難です。

 
Pawel Egoshin:
必要なのはEAで、通常のマーチンにピッチを上げたものです。

アイランは一択じゃないのか?実は、オープンソースの右側には、そのようなプルームが非常に多く存在するのですが、おそらく大皿で紹介される必要があるのでしょう......。

 
Sergey Martynov:

もちろん、多くの時間が経過していますが、コードにざっと目を通すと、戦略に基づいてもう一度ボットを書かなければならないようです。なぜなら、インジケータを何度も呼び出しても意味がないからです。

 
yuriy kovalchuk:
こんにちは、これに似たものを提案できますか --e-CloseByProfit- EAは、あらかじめ定義された合計損益に達したときにすべてのポジションを閉じます --- MT5のみ です。ありがとうございます。

そんな感じです。必要なのは、残高と利益額を入力することだけです。

//+------------------------------------------------------------------+
//|                                                  CloseEquity.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

//+------------------------------------------------------------------+
//|                                          Close all if a loss.mq5 |
//|                              Copyright © 2020, Vladimir Karputov |
//|                     https://www.mql5.com/ru/market/product/43516 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2020, Vladimir Karputov"
#property link      "https://www.mql5.com/ru/market/product/43516"
#property version   "1.000"
/*
   barabashkakvn Trading engine 3.112
*/
#include <Trade\Trade.mqh>
#include <Trade\AccountInfo.mqh>
//---
CPositionInfo  m_position;                   // object of CPositionInfo class
CTrade         m_trade;                      // object of CTrade class
CAccountInfo   m_account;                    // object of CAccountInfo class
//--- input parameters
input double   InpProfit            = 150000;      // Profit Equity, in money
input bool     InpPrintLog          = false;       // Print log
input ulong    InpMagic             = 42967428;    // Magic number
//---
bool     m_stop                     = false;
int      ticks_to_close             = 1;           // количество тиков до снятия эксперта
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   m_trade.SetExpertMagicNumber(InpMagic);
   m_trade.SetMarginMode();
   m_trade.SetTypeFillingBySymbol(Symbol());
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(AccountInfoDouble(ACCOUNT_EQUITY)>InpProfit)
     {
      if(IsPositionExists())
        {
         CloseAllPositions();
         return;
        }
      else
        {
         Alert("It is necessary to restart the adviser");
         ExpertRemoves();
         m_stop=true;
        }
     }
   if(m_stop)
      return;
//---
  }
//+------------------------------------------------------------------+
//| Is position exists                                               |
//+------------------------------------------------------------------+
bool IsPositionExists(void)
  {
   for(int i=PositionsTotal()-1; i>=0; i--)
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         return(true);
//---
   return(false);
  }
//+------------------------------------------------------------------+
//| Close all positions                                              |
//+------------------------------------------------------------------+
void CloseAllPositions(void)
  {
   for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positions
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         if(!m_trade.PositionClose(m_position.Ticket())) // close a position by the specified m_symbol
            if(InpPrintLog)
               Print(__FILE__," ",__FUNCTION__,", ERROR: ","CTrade.PositionClose ",m_position.Ticket());
  }
//+------------------------------------------------------------------+
//| start function                                                   |
//+------------------------------------------------------------------+
void ExpertRemoves(void)
  {
   static int tick_counter=0;
//---
   tick_counter++;
   Comment("\nДо выгрузки эксперта ",__FILE__," осталось ",
           (ticks_to_close-tick_counter)," тиков ");
//--- до
   if(tick_counter>=ticks_to_close)
     {
      ExpertRemove();
      Print(TimeCurrent(),": ",__FUNCTION__," эксперт будет выгружен");
     }
   Print("tick_counter = ",tick_counter);
//---
  }
//+------------------------------------------------------------------+
ファイル:
CloseEquity.mq5  10 kb
 
Alexsandr San:

そんな感じです。バランスシート+作りたいものを入れればいいんです。


いや、その方が信頼できる。

//+------------------------------------------------------------------+
//|                                                  CloseEquity.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

//+------------------------------------------------------------------+
//|                                          Close all if a loss.mq5 |
//|                              Copyright © 2020, Vladimir Karputov |
//|                     https://www.mql5.com/ru/market/product/43516 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2020, Vladimir Karputov"
#property link      "https://www.mql5.com/ru/market/product/43516"
#property version   "1.000"
/*
   barabashkakvn Trading engine 3.112
*/
#include <Trade\Trade.mqh>
#include <Trade\AccountInfo.mqh>
//---
CPositionInfo  m_position;                   // object of CPositionInfo class
CTrade         m_trade;                      // object of CTrade class
CAccountInfo   m_account;                    // object of CAccountInfo class
//--- input parameters
input string   Template             = "ADX";       // Имя шаблона(without '.tpl')
input double   InpProfit            = 150000;      // Profit Equity, in money
input bool     InpPrintLog          = false;       // Print log
input ulong    InpMagic             = 42967428;    // Magic number
//---
bool     m_stop                     = false;
int      ticks_to_close             = 1;           // количество тиков до снятия эксперта
uint     SLEEPTIME                  = 1;           // Время паузы между повторами в секундах
ENUM_TIMEFRAMES TimeFrame;                         // Change TimeFrame - Current = dont changed
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   m_trade.SetExpertMagicNumber(InpMagic);
   m_trade.SetMarginMode();
   m_trade.SetTypeFillingBySymbol(Symbol());
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(AccountInfoDouble(ACCOUNT_EQUITY)>InpProfit)
     {
      if(IsPositionExists())
        {
         CloseAllPositions();
         Sleep(SLEEPTIME*1000);
         CloseAllPositions();
         return;
        }
      else
        {
         Alert("It is necessary to restart the adviser");
         ExpertRemoves();
         DeleteChart();
         m_stop=true;
        }
     }
   if(m_stop)
      return;
//---
  }
//+------------------------------------------------------------------+
//| Is position exists                                               |
//+------------------------------------------------------------------+
bool IsPositionExists(void)
  {
   for(int i=PositionsTotal()-1; i>=0; i--)
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         return(true);
//---
   return(false);
  }
//+------------------------------------------------------------------+
//| Close all positions                                              |
//+------------------------------------------------------------------+
void CloseAllPositions(void)
  {
   for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positions
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         if(!m_trade.PositionClose(m_position.Ticket())) // close a position by the specified m_symbol
            if(InpPrintLog)
               Print(__FILE__," ",__FUNCTION__,", ERROR: ","CTrade.PositionClose ",m_position.Ticket());
  }
//+------------------------------------------------------------------+
//| start function                                                   |
//+------------------------------------------------------------------+
void ExpertRemoves(void)
  {
   static int tick_counter=0;
//---
   tick_counter++;
   Comment("\nДо выгрузки эксперта ",__FILE__," осталось ",
           (ticks_to_close-tick_counter)," тиков ");
//--- до
   if(tick_counter>=ticks_to_close)
     {
      ExpertRemove();
      Print(TimeCurrent(),": ",__FUNCTION__," эксперт будет выгружен");
     }
   Print("tick_counter = ",tick_counter);
//---
  }
//+------------------------------------------------------------------+
//| start function                                                   |
//+------------------------------------------------------------------+
void DeleteChart(void)
  {
   long currChart,prevChart=ChartFirst();
   int i=0,limit=100;
   bool errTemplate;
   while(i<limit)
     {
      currChart=ChartNext(prevChart);
      if(TimeFrame!=PERIOD_CURRENT)
        {
         ChartSetSymbolPeriod(prevChart,ChartSymbol(prevChart),TimeFrame);
        }
      errTemplate=ChartApplyTemplate(prevChart,Template+".tpl");
      if(!errTemplate)
        {
         Print("Error ",ChartSymbol(prevChart),"-> ",GetLastError());
        }
      if(currChart<0)
         break;
      Print(i,ChartSymbol(currChart)," ID =",currChart);
      prevChart=currChart;
      i++;
     }
  }
//+------------------------------------------------------------------+
ファイル:
 

いや、その方が信頼できる。


ありがとうございました

理由: