Whats the difference between true , TRUE and True ?

 

Советник Sector открывает сделки по встроенному в него индикатору Trend Strength, он, также как и индикатор, работает с тиковой историей. Фильтрами, позволяющими сократить количество убыточных сделок, служат показания встроенного индикатора.

Советник Sector отслеживает тиковую историю и определяет по ней кратковременные "взрывные" трендовые движения, в сторону которых в последующем идет тренд. Sector использует два типа входа в рынок:

  • советник открывает позицию в момент поступления сигнала от встроенного индикатора;
  • советник входит в рынок по цене открытия следующего бара, после поступления сигнала.
Рекомендуется использовать агрессивное соотношение Stop Loss и Take Profit, чтобы прибыль могла расти при последующем развитии тренда. Параметры советника по умолчанию настроены для торговли на паре USDCAD на временном периоде D1, в параметрах по умолчанию Take Profit в два раза превышает Stop Loss.


Особенности советника Sector

  • не использует рисковых стратегий торговли: сетку ордеров, хеджирование, мартингейл;
  • всегда использует стоп-лосс;
  • использует только собственный интегрированный индикатор;
  • для торговли подходят долларовые и центовые счета со спредом 2 пункта и более;
  • скорость исполнения ордеров брокером не играет большой роли;
  • необходимо наличие VPS сервера.


Входные параметры

Параметры перенесенные из индикатора Trend Strength:

  • Fixed numbers of the trend - заданное значение силы тренда;
  • Number of bars to calculate average numbers - заданное количество баров с наибольшими значениями силы тренда;
  • Number of bars for analysis - выбранный исторический период;
  • Signal type - настройка условия подачи сигналов: при превышении заданной силы тренда (Signal type = FixNumber), при пересечении зеленой или пурпурной линий индикатора (Signal type = SignalLine), либо если соблюдены первое и второе условие (Signal type = SignalLine_and_FixNumber).

Добавлен параметр Length of history определяющий интервал в минутах для отслеживания тиковой истории.

Параметр Min. numbers of the trend отражает минимальное абсолютное значение силы тренда, при котором может быть открыта сделка.

Торговые параметры: StopLoss, TakeProfit, Lot, Slippage, Magic. Параметры: StopLoss 2, TakeProfit 2, Magic 2 - открытых по входу 2.

Параметры TradeMon и TradeFr определяют торговлю по понедельникам и пятницам.

Советник Sector может сопровождать открытые сделки Trailing Stop (TS), параметры TS:

  • TS start– прибыль в пунктах, при которой сделки начинают сопровождаться TS;
  • Step TS – шаг TS;
  • StopLoss TS;
  • TS on Trend Strength – абсолютное значение Trend Strength, при котором Take Profit позиций удаляется и она продолжает сопровождаться TS. Используется только если параметр Use Trail принимает значение TrailingOnIndicator;
  • Use Trail – может принимать значения TrailingOFF (позиции не сопровождаются TS), TrailingToTP (сопровождение TS до уровня TakeProfit) и TrailingOnIndicator (при приближении цены к уровню TakeProfit он удаляется, если Trend Strength больше или равно параметру TS on Trend Strength).

На рынке возможны ситуации, когда возникает сигнал на покупку или продажу в то время, как открыта противоположная сигналу позиция. Параметр Signal Inverted определяет действие советника в такой ситуации:

  1. Signal Inverted = ReTrade. Текущая позиция закрывается и открывается противоположная;
  2. Signal Inverted = OnlyClose. Текущая позиция закрывается;
  3. Signal Inverted = Ignoring. Советник не выполняет никаких торговых операций.

На таймфреймах H4 и D1 эффективно повторно открывать позицию на следующем баре, советник открывает такие позиции при соблюдении следующих условий:

  1. Должна быть разрешена торговля на втором баре, параметр Trade on the second bar;
  2. Величина бара (без тени), на котором была открыта первая позиция, должна быть равной или превышать значение, заданное в параметре Min. size of the first bar;
  3. Соотношение величины бара к суммарному размеру верхней и нижней тени не должно превышать значение, заданное в параметре Ratio bar/shadow.
 

If the compiler doesn't complain - no difference.

 
ок
 
2017/10/12 15:00:27 Locked #2270307 sunnyho38
 
Ex Ovo Omnia:

Not really important, just the 'true' seems to be a 1-byte boolean constant, while TRUE and True are 4-byte integer constants of value 1.

(Massively pedantic answer...

Yes, it's MT4 inheriting from Windows, which in turn is reflecting the historic differences between C and C++. C has - strictly, had - no boolean data type and no "true" constant. Therefore, the Windows API fills the gap by defining a BOOL, which is simply "typedef int BOOL", and by defining the constant TRUE, which is simply "#define TRUE 1". C++ does have a bool data type, and does have a "true" constant. MQL4 inherits these two separate things. This has been tidied up in MQL5, which only has "true", and doesn't have "TRUE" or "True".)

 
JC:

(Massively pedantic answer...

Yes, it's MT4 inheriting from Windows, which in turn is reflecting the historic differences between C and C++. C has - strictly, had - no boolean data type and no "true" constant. Therefore, the Windows API fills the gap by defining a BOOL, which is simply "typedef int BOOL", and by defining the constant TRUE, which is simply "#define TRUE 1". C++ does have a bool data type, and does have a "true" constant. MQL4 inherits these two separate things. This has been tidied up in MQL5, which only has "true", and doesn't have "TRUE" or "True".)

MQL4 is loosely based on C++ which has always had a bool type.

ANSI C did not have a bool until 1999. The current ANSI standard is C11 (2011)

Many compilers did not implement all the C99 features and so C90 may still be the most portable version

https://stackoverflow.com/questions/1608318/is-bool-a-native-c-type

Is bool a native C type?
Is bool a native C type?
  • stackoverflow.com
I've noticed that the Linux kernel code uses bool, but I thought that bool was a C++ type. Is bool a standard C extension (e.g., ISO C90) or a GCC extension?
 
James Cater:

ANSI C did not have a bool until 1999. The current ANSI standard is C11 (2011)

Yes, that is indeed what I meant by "C has - strictly, had - no boolean data type". From Windows's point of view, C doesn't have a bool because the core of the Windows API predates 1999.

 
JC:

Yes, that is indeed what I meant by "C has - strictly, had - no boolean data type". From Windows's point of view, C doesn't have a bool because the core of the Windows API predates 1999.

Seems like Microsoft finally implemented the bool type in their C compiler with the release of  Visual Studio 2013...

https://msdn.microsoft.com/en-us/library/hh409293(v=vs.120).aspx

 
James Cater:

Seems like Microsoft finally implemented the bool type in their C compiler with the release of  Visual Studio 2013...

Windows API obviously continues to use its own definition of BOOL; too late to change that.

Digressing almost completely, my favourite Windows->MQL4 legacy is one I've mentioned a couple of times before on this forum...

Question: why isn't is possible for an indicator or a line object in MT4 to be dashed, dotted etc if it is more than 1 pixel wide? Answer: it's almost certainly inheriting the limitations of the Windows CreatePen() function. That dates back at least to 1995, and may well derive from Windows 3, or even beyond - I can no longer remember.

Reason: