Skip to content

Commit 09c0170

Browse files
author
EarnForex
authored
1.12
Fixed a bug that messed up trading in trendline mode with horizontal line chart objects.
1 parent 4b6e1ac commit 09c0170

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

ChartPatternHelper.mq4

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//+------------------------------------------------------------------+
22
//| Chart Pattern Helper |
3-
//| Copyright © 2013-2022, EarnForex.com |
3+
//| Copyright © 2013-2023, EarnForex.com |
44
//| https://www.earnforex.com/ |
55
//+------------------------------------------------------------------+
6-
#property copyright "Copyright © 2013-2022, EarnForex"
6+
#property copyright "Copyright © 2013-2023, EarnForex"
77
#property link "https://www.earnforex.com/metatrader-expert-advisors/ChartPatternHelper/"
8-
#property version "1.11"
8+
#property version "1.12"
99
#property strict
1010

1111
#include <stdlib.mqh>
@@ -756,7 +756,8 @@ void AdjustUpperAndLowerOrders()
756756
{
757757
if (ObjectFind(0, LowerBorderLine) >= 0) // Line.
758758
{
759-
BorderLevel = NormalizeDouble(ObjectGetValueByShift(LowerBorderLine, 1), _Digits);
759+
if (ObjectGetInteger(ChartID(), LowerBorderLine, OBJPROP_TYPE) == OBJ_HLINE) BorderLevel = NormalizeDouble(ObjectGetDouble(0, LowerBorderLine, OBJPROP_PRICE1), _Digits);
760+
else BorderLevel = NormalizeDouble(ObjectGetValueByShift(LowerBorderLine, 1), _Digits);
760761
}
761762
else // Channel
762763
{
@@ -776,7 +777,8 @@ void AdjustUpperAndLowerOrders()
776777
{
777778
if (ObjectFind(0, UpperBorderLine) >= 0) // Line.
778779
{
779-
BorderLevel = NormalizeDouble(ObjectGetValueByShift(UpperBorderLine, 1), _Digits);
780+
if (ObjectGetInteger(ChartID(), UpperBorderLine, OBJPROP_TYPE) == OBJ_HLINE) BorderLevel = NormalizeDouble(ObjectGetDouble(0, UpperBorderLine, OBJPROP_PRICE1), _Digits);
781+
else BorderLevel = NormalizeDouble(ObjectGetValueByShift(UpperBorderLine, 1), _Digits);
780782
}
781783
else // Channel
782784
{

ChartPatternHelper.mq5

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//+------------------------------------------------------------------+
22
//| Chart Pattern Helper |
3-
//| Copyright © 2013-2022, EarnForex.com |
3+
//| Copyright © 2013-2023, EarnForex.com |
44
//| https://www.earnforex.com/ |
55
//+------------------------------------------------------------------+
6-
#property copyright "Copyright © 2013-2022, EarnForex"
6+
#property copyright "Copyright © 2013-2023, EarnForex"
77
#property link "https://www.earnforex.com/metatrader-expert-advisors/ChartPatternHelper/"
8-
#property version "1.11"
8+
#property version "1.12"
99

1010
#property description "Uses graphic objects (horizontal/trend lines, channels) to enter trades."
1111
#property description "Works in two modes:"
@@ -767,7 +767,8 @@ void AdjustUpperAndLowerOrders()
767767
{
768768
if (ObjectFind(0, LowerBorderLine) >= 0) // Line.
769769
{
770-
BorderLevel = NormalizeDouble(ObjectGetValueByTime(ChartID(), LowerBorderLine, Time[1]), _Digits);
770+
if (ObjectGetInteger(ChartID(), LowerBorderLine, OBJPROP_TYPE) == OBJ_HLINE) BorderLevel = NormalizeDouble(ObjectGetDouble(0, LowerBorderLine, OBJPROP_PRICE, 0), _Digits);
771+
else BorderLevel = NormalizeDouble(ObjectGetValueByTime(ChartID(), LowerBorderLine, Time[1]), _Digits);
771772
}
772773
else // Channel
773774
{
@@ -786,7 +787,8 @@ void AdjustUpperAndLowerOrders()
786787
{
787788
if (ObjectFind(0, UpperBorderLine) >= 0) // Line.
788789
{
789-
BorderLevel = NormalizeDouble(ObjectGetValueByTime(ChartID(), UpperBorderLine, Time[1]), _Digits);
790+
if (ObjectGetInteger(ChartID(), UpperBorderLine, OBJPROP_TYPE) == OBJ_HLINE) BorderLevel = NormalizeDouble(ObjectGetDouble(0, UpperBorderLine, OBJPROP_PRICE, 0), _Digits);
791+
else BorderLevel = NormalizeDouble(ObjectGetValueByTime(ChartID(), UpperBorderLine, Time[1]), _Digits);
790792
}
791793
else // Channel
792794
{

0 commit comments

Comments
 (0)