I looked it up now too. The article is from 2011... But, most importantly, there is an explanation of how ticks are generated in "all ticks" mode. And "Based on real ticks" speaks for itself. That's the difference.
Hi all!!! And Happy New Year!!! I got my programming curve in classes. And here I have a puzzlement. I have in the folder #include/ChartObject a class file -- ChartObjectsLines and it contains not only a class of trendlines, but also other classes with lines and constructors for all these classes. And here is the question, the answer to which I have not found, that in one class can be many classes and constructors for these classes?
I have another question)) Do not send me to read the manual, I have read it more than once, I still do not understand everything in the classes) There is a class Trailing Stop for Parabolic SAR, located in the folder Expert\Trailing\ named TrailingParabolicSAR.mqh Please tell me how to interact with it, if it is not difficult. I understand it better through examples))) Thanks in advance to those who respond)
//+------------------------------------------------------------------+//| 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 parametersdouble m_step; // the "speed increment" parameter of the indicatordouble m_maximum; // the "maximum rate" parameter of the indicatorpublic:
CTrailingPSAR(void);
~CTrailingPSAR(void);
//--- methods of setting adjustable parametersvoid Step(double step) { m_step=step; }
void Maximum(double maximum) { m_maximum=maximum; }
//--- method of creating the indicator and timeseriesvirtualbool InitIndicators(CIndicators *indicators);
//---virtualbool CheckTrailingStopLong(CPositionInfo *position,double &sl,double &tp);
virtualbool 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 pointerif(indicators==NULL)
return(false);
//--- add object to collectionif(!indicators.Add(GetPointer(m_sar)))
{
printf(__FUNCTION__+": error adding object");
return(false);
}
//--- initialize objectif(!m_sar.Create(m_symbol.Name(),m_period,m_step,m_maximum))
{
printf(__FUNCTION__+": error initializing object");
return(false);
}
//--- okreturn(true);
}
//+------------------------------------------------------------------+//| Checking trailing stop and/or profit for long position. |//+------------------------------------------------------------------+bool CTrailingPSAR::CheckTrailingStopLong(CPositionInfo *position,double &sl,double &tp)
{
//--- checkif(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)
{
//--- checkif(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: I have another question)) Please don't send me to read instructions, I have read it many times, I still don't understand all classes) There is a Trailing Stop class for Parabolic SAR, located in Expert\Trailing\ folder and named TrailingParabolicSAR.mqh Please tell me how to use it. I understand it better through examples))) Thanks in advance to those who respond)
An example usage example is given in [dta folder]\MQL5\Experts\Advisors\ExpertMAPSAR.mq5
read it already )
I looked it up now too. The article is from 2011... But, most importantly, there is an explanation of how ticks are generated in "all ticks" mode. And "Based on real ticks" speaks for itself. That's the difference.
In visualisation mode, the prints are not displayed. Is this supposed to be the case, or am I doing something wrong?
And another question))) How do I get the price and date from the X / Y coordinates in the graph window???
https://www.mql5.com/ru/docs/chart_operations/charttimepricetoxy
https://www.mql5.com/ru/docs/chart_operations/chartxytotimeprice
https://www.mql5.com/ru/docs/chart_operations/charttimepricetoxy
https://www.mql5.com/ru/docs/chart_operations/chartxytotimeprice
Thank you!!!
I have another question)) Please don't send me to read instructions, I have read it many times, I still don't understand all classes) There is a Trailing Stop class for Parabolic SAR, located in Expert\Trailing\ folder and named TrailingParabolicSAR.mqh Please tell me how to use it. I understand it better through examples))) Thanks in advance to those who respond)
An example usage example is given in [dta folder]\MQL5\Experts\Advisors\ExpertMAPSAR.mq5
An example usage example is given in [dta folder]\MQL5\Experts\Advisors\ExpertMAPSAR.mq5
Thank you!!!
Question on the tester.
In visualisation mode, the prints are not displayed. Is this supposed to be the case, or am I doing something wrong?