初学者的问题 MQL5 MT5 MetaTrader 5 - 页 1275

 
Aleksandr Egorov:

已经读过了 )

我现在也查了一下。这篇文章是2011年的......但是,最重要的是,有一个关于在 "所有虱子 "模式下如何产生虱子的解释。而 "基于真实的蜱虫 "本身就说明了问题。这就是区别。

 
关于测试器的问题。

在可视化模式下,不显示打印件。应该是这样的,还是我做错了什么?
 
大家好!!!。新年快乐!!我在课堂上得到了我的编程曲线。在这里我有一个疑惑,我在#include/ChartObject文件夹里有一个类文件--ChartObjectsLines,它不仅包含一个趋势线的类,还包含其他带线的类和所有这些类的构造函数。 这里有一个问题,我没有找到答案,原来一个类里可以有很多类和这些类的构造函数?
 
还有一个问题))你如何从图形窗口的X/Y坐标中获得价格和日期?
 
Kira27:
还有一个问题)))我如何从图形窗口的X/Y坐标中获得价格和日期?

https://www.mql5.com/ru/docs/chart_operations/charttimepricetoxy

https://www.mql5.com/ru/docs/chart_operations/chartxytotimeprice

Документация по MQL5: Операции с графиками / ChartTimePriceToXY
Документация по MQL5: Операции с графиками / ChartTimePriceToXY
  • www.mql5.com
ChartTimePriceToXY - Операции с графиками - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
我还有一个问题))只是不要让我去读手册,我已经读了不止一遍,我仍然不明白类中的所有内容)有一个抛物线SAR的追踪止损类,位于Expert\Trailing\文件夹中,名为TrailingParabolicSAR.mqh 告诉我如何与它互动,如果这不难的话。我通过例子更好地理解它)))提前感谢那些回应的人)
//+------------------------------------------------------------------+
//|                                         TrailingParabolicSAR.mqh |
//|                   Copyright 2009-2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#include <Expert\ExpertTrailing.mqh>
// wizard description start
//+------------------------------------------------------------------+
//| Description of the class                                         |
//| Title=Trailing Stop based on Parabolic SAR                       |
//| Type=Trailing                                                    |
//| Name=ParabolicSAR                                                |
//| Class=CTrailingPSAR                                              |
//| Page=                                                            |
//| Parameter=Step,double,0.02,Speed increment                       |
//| Parameter=Maximum,double,0.2,Maximum rate                        |
//+------------------------------------------------------------------+
// wizard description end
//+------------------------------------------------------------------+
//| Class CTrailingPSAR.                                             |
//| Appointment: Class traling stops with Parabolic SAR.             |
//| Derives from class CExpertTrailing.                              |
//+------------------------------------------------------------------+
class CTrailingPSAR : public CExpertTrailing
  {
protected:
   CiSAR             m_sar;            // object-indicator
   //--- adjusted parameters
   double            m_step;           // the "speed increment" parameter of the indicator
   double            m_maximum;        // the "maximum rate" parameter of the indicator

public:
                     CTrailingPSAR(void);
                    ~CTrailingPSAR(void);
   //--- methods of setting adjustable parameters
   void              Step(double step)       { m_step=step;       }
   void              Maximum(double maximum) { m_maximum=maximum; }
   //--- method of creating the indicator and timeseries
   virtual bool      InitIndicators(CIndicators *indicators);
   //---
   virtual bool      CheckTrailingStopLong(CPositionInfo *position,double &sl,double &tp);
   virtual bool      CheckTrailingStopShort(CPositionInfo *position,double &sl,double &tp);
  };
//+------------------------------------------------------------------+
//| Constructor                                                      |
//+------------------------------------------------------------------+
void CTrailingPSAR::CTrailingPSAR(void) : m_step(0.02),
                                          m_maximum(0.2)

  {
  }
//+------------------------------------------------------------------+
//| Destructor                                                       |
//+------------------------------------------------------------------+
void CTrailingPSAR::~CTrailingPSAR(void)
  {
  }
//+------------------------------------------------------------------+
//| Create indicators.                                               |
//+------------------------------------------------------------------+
bool CTrailingPSAR::InitIndicators(CIndicators *indicators)
  {
//--- check pointer
   if(indicators==NULL)
      return(false);
//--- add object to collection
   if(!indicators.Add(GetPointer(m_sar)))
     {
      printf(__FUNCTION__+": error adding object");
      return(false);
     }
//--- initialize object
   if(!m_sar.Create(m_symbol.Name(),m_period,m_step,m_maximum))
     {
      printf(__FUNCTION__+": error initializing object");
      return(false);
     }
//--- ok
   return(true);
  }
//+------------------------------------------------------------------+
//| Checking trailing stop and/or profit for long position.          |
//+------------------------------------------------------------------+
bool CTrailingPSAR::CheckTrailingStopLong(CPositionInfo *position,double &sl,double &tp)
  {
//--- check
   if(position==NULL)
      return(false);
//---
   double level =NormalizeDouble(m_symbol.Bid()-m_symbol.StopsLevel()*m_symbol.Point(),m_symbol.Digits());
   double new_sl=NormalizeDouble(m_sar.Main(1),m_symbol.Digits());
   double pos_sl=position.StopLoss();
   double base  =(pos_sl==0.0) ? position.PriceOpen() : pos_sl;
//---
   sl=EMPTY_VALUE;
   tp=EMPTY_VALUE;
   if(new_sl>base && new_sl<level)
      sl=new_sl;
//---
   return(sl!=EMPTY_VALUE);
  }
//+------------------------------------------------------------------+
//| Checking trailing stop and/or profit for short position.         |
//+------------------------------------------------------------------+
bool CTrailingPSAR::CheckTrailingStopShort(CPositionInfo *position,double &sl,double &tp)
  {
//--- check
   if(position==NULL)
      return(false);
//---
   double level =NormalizeDouble(m_symbol.Ask()+m_symbol.StopsLevel()*m_symbol.Point(),m_symbol.Digits());
   double new_sl=NormalizeDouble(m_sar.Main(1)+m_symbol.Spread()*m_symbol.Point(),m_symbol.Digits());
   double pos_sl=position.StopLoss();
   double base  =(pos_sl==0.0) ? position.PriceOpen() : pos_sl;
//---
   sl=EMPTY_VALUE;
   tp=EMPTY_VALUE;
   if(new_sl<base && new_sl>level)
      sl=new_sl;
//---
   return(sl!=EMPTY_VALUE);
  }
//+------------------------------------------------------------------+
 
Kira27:
我还有一个问题))请不要让我去读说明书,我已经读了很多遍了,我还是不明白所有的类)有一个抛物线SAR的追踪止损类,位于Expert\Trailing\文件夹中,名为TrailingParabolicSAR.mqh请告诉我如何使用它。我通过例子更好地理解它)))提前感谢那些回应的人)

在[dta文件夹]\MQL5\Experts\Advisors\ExpertMAPSAR.mq5中给出了一个使用实例。

 
Vladimir Karputov:

在[dta文件夹]\MQL5\Experts\Advisors\ExpertMAPSAR.mq5中给出了一个使用实例。

谢谢你!!!。

 
User_mt5:
关于测试器的问题。在可视化模式下,不显示打印件。应该是这样的,还是我做错了什么?

我认为没有人知道。