Page 318 of 429

Re: MT4 Indicators with alerts/signals

Posted: Mon Jul 13, 2020 8:59 am
by talaate
hi mrtools
Is it possible to add the set alerts to the given indicator when all moving averages have the same in color, just one times or the price is above or below the moving averages
thanx

Re: MT4 Indicators with alerts/signals

Posted: Mon Jul 13, 2020 9:12 am
by mrtools
talaate wrote: Mon Jul 13, 2020 8:59 am hi mrtools
Is it possible to add the set alerts to the given indicator when all moving averages have the same in color, just one times or the price is above or below the moving averages
thanx
Averages rainbow 1.04.ex4
Don't have the code for that one.

Re: MT4 Indicators with alerts/signals

Posted: Mon Jul 13, 2020 8:04 pm
by talaate
mrtools wrote: Mon Jul 13, 2020 9:12 am

Don't have the code for that one.
Ok, no problem
But if you may create similar one, that will be very appreciated. Any way, it is up to you (your decision)
Thanks

Re: MT4 Indicators with alerts/signals

Posted: Thu Jul 16, 2020 4:00 am
by Broken_Dreams
Good morning,
I'm new to the forum and I'm hoping that someone can modify this indicator by adding alert notification for every fractal formation.
Thank you & have a nice day.

Re: MT4 Indicators with alerts/signals

Posted: Thu Jul 16, 2020 5:19 am
by SK_Rana
Hi MrTools,

Can you please convert this script into mt4 indicator with an arrow and all alert options?

Thanks,
Rana


Script:

Code: Select all

----------------------------------------------------------------------------

            
'#####################################################################################################
'#  Indicator   :   Zwinner Trend                                                                    #
'#  Author      :   V-M-SOFTS                                                                        #
'#  Copyright   :   © V-M-SOFTS                                                                      #
'#  E-mail      :   vladimir.mametov@yandex.ru                                                       #
'#  Date        :   20-Dec-2015                                                                      #
'#  Description :   Forex indicator Zwinner Trend Indicator - a trend indicator, which provides an   #
'#                  excellent opportunity to filter false entries into the market.                   #
'#                  Using this indicator may be determined based on the prevailing market price      # 
'#					trend. The color of the indicator line Zwinner Trend Indicator depends on the    #
'#					current trends:                                                                  #
'#                  * downtrend - red line;                                                          #
'#                  * upward trend - green line.                                                     #
'#                  Forex indicator Zwinner Trend Indicator can be used in trading                   #
'#				    strategies as a filter:                                                          #
'#                  * green line - considering only the position of the purchase;                    #
'#                  * red line - consider only short positions.                                      #
'#                  An additional indicator may appear on the chart signals for purchase and sale in #
'#				    the form of arrows. Red Arrow is a signal to sell, and green arrow signal to buy.#
'#                  The input parameters of the indicator:                                           #
'#                  Const periods (default = 1), the number of bars of a financial instrument        #
'#				    is used to calculate the indicator.                                              #
'#                  Const UseAlert (default = 1) 1 - display signals to buy and sell (arrows);       #
'#				    0 - do not show.                                                                 #
'#                  Const NBars (default = 500) -  It determines the number of bars on which         #
'#				    to build the indicator.                                                          #
'#                                                                                                   #
'#  History     :                                                                                    #
'#       1.00   :   Initial version.                                                                 #
'#####################################################################################################                                                                                                    

'''######################  INPUT PARAMETERS  #########################################################

Const periods  = 8 
Const UseAlert = 1
Const NBars    = 500
 
'''####################################################################################################
 
Dim m_chartID		 
Dim m_chartName			                                                                          
Dim BARS_COUNT			 
Dim PROCESSING	
Dim Point,Filter
Dim indID1, indID2, indID3, indID4, indID5, indID6 	 			 
Dim arrHigh(), arrLow(), arrU(), arrD(), arrL1(), arrL2(), arrUS(), arrDS()	 
 
Const UNDEFINED			= -987654321  
Const VOL_DEFAULT		= 100                      
 
Const PF_CLOSE			= 0				 
Const PF_OPEN			= 1				 
Const PF_HIGH			= 2				 
Const PF_LOW			= 3				 
Const PF_MEDIAN			= 4				 
Const PF_TYPICAL		= 5				 
Const PF_WEIGHTED		= 6				 
Const PF_VOLUME			= 10			 
 
'////////////////////////////////////////////////////////////////////////////////////////
' Main
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub main()

	While (PROCESSING)
	Wend
	
	PROCESSING = 1
	BARS_COUNT = 0
	m_chartID = ChartID()
	m_chartName = ChartSymbol(CLng(m_chartID))

	updateBuffers
	performCalculations 1

 
	indID1 = AddCustomIndicator(0, arrU, 1, TRUE)
	SetDrawingStyle 0, CSTR(indID1), DRAW_ARROWS
	SetArrowStyle 0, CSTR(indID1) , 110
	LineColor 0, CStr(indID1), RGBCOLOR(0,255,0)

	Dim subWindowID
	subWindowID = CLng(GetSubwindow(0, CStr(indID1)))

	indID2 = AddCustomIndicator(0, arrD, 1, 0, CLng(subWindowID))
	SetDrawingStyle 0, CSTR(indID2), DRAW_ARROWS
	SetArrowStyle 0, CSTR(indID2) , 110
	LineColor 0, CStr(indID2), RGBCOLOR(255,0,0)

	indID3 = AddCustomIndicator(0, arrL1, 1, False, CLng(subWindowID))
	SetSeriesStyle 0, CStr(indID3), LINE_CHART
	LineColor 0, CStr(indID3), RGBCOLOR(255,255,255)
	LineWeight 0, CStr(indID3), 2

    indID4 = AddCustomIndicator(0, arrL2, 1, False, CLng(subWindowID))
	SetSeriesStyle 0, CStr(indID4), LINE_CHART
	LineColor 0, CStr(indID4), RGBCOLOR(255,255,255)
	LineWeight 0, CStr(indID4), 2

	indID5 = AddCustomIndicator(0, arrUS, 1, False)
	SetDrawingStyle 0, CSTR(indID5), DRAW_ARROWS
	SetArrowStyle 0, CSTR(indID5) , 233
	LineColor 0, CStr(indID5), RGBCOLOR(0,255,0)

	indID6 = AddCustomIndicator(0, arrDS, 1, False)
	SetDrawingStyle 0, CSTR(indID6), DRAW_ARROWS
	SetArrowStyle 0, CSTR(indID6) , 234
	LineColor 0, CStr(indID6), RGBCOLOR(255,0,0)


	PROCESSING = 0

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' OnTick
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub OnTick(symbolName)

	If( PROCESSING ) Then Exit Sub
	If( symbolName <> ChartSymbol(0) ) Then Exit Sub
	If( CLng(BARS_COUNT) <> CLng(Bars(0)) ) Then Exit Sub


End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' OnCalculate
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub OnCalculate(symbol, symbolPeriod, openVal, highVal, lowVal, closeVal)
	
	If (PROCESSING) Then Exit Sub
	If( symbol <> ChartSymbol(0) ) Then Exit Sub

	PROCESSING = 1

	updateBuffers
	performCalculations 1
 
	SetIndicatorData 0, CStr(indID1), CDbl(arrU(BARS_COUNT)) 
	SetIndicatorData 0, CStr(indID2), CDbl(arrD(BARS_COUNT))
	SetIndicatorData 0, CStr(indID3), CDbl(arrL1(BARS_COUNT))
	SetIndicatorData 0, CStr(indID4), CDbl(arrL2(BARS_COUNT)) 
	SetIndicatorData 0, CStr(indID5), CDbl(arrUS(BARS_COUNT)) 
	SetIndicatorData 0, CStr(indID6), CDbl(arrDS(BARS_COUNT))


	PROCESSING = 0

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' updateBuffers
'////////////////////////////////////////////////////////////////////////////////////////
Private Sub updateBuffers()

	loadPriceSeries PF_HIGH, arrHigh
    loadPriceSeries PF_LOW, arrLow
	loadPriceSeries PF_CLOSE, arrL1
	loadPriceSeries PF_CLOSE, arrL2
	loadPriceSeries PF_CLOSE, arrU
	loadPriceSeries PF_CLOSE, arrD
	loadPriceSeries PF_CLOSE, arrUS
	loadPriceSeries PF_CLOSE, arrDS

	Dim i
	For i = 1 To CLng(Bars(0))
		arrU(i) = UNDEFINED
		arrD(i) = UNDEFINED
		arrL1(i) = UNDEFINED
		arrL2(i) = UNDEFINED
		arrUS(i) = UNDEFINED
		arrDS(i) = UNDEFINED
	Next
 
	BARS_COUNT = CLng(Bars(0))

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' performCalculations
'////////////////////////////////////////////////////////////////////////////////////////
Private Sub performCalculations(Byval startBar)

   Dim i,x0,x,medium,pr,pr0,llv,hhv,arrx() 
 
   pr = 0 
   pr0 = 0 
   llv = 0 
   hhv = 0 

    CopyClose 0, 1, Bars(0), arrx
 
    firstbar=MathMax(CLng(startBar+periods),CLng(BARS_COUNT-NBars+periods))

	For i = CLng(firstbar) To CLng(BARS_COUNT)

    hhv=arrHigh(i)
    For j = 1 To periods
    if arrHigh(i-j)>hhvp Then 
	hhv=arrHigh(i-j) 
	End if
    Next

	llv=arrLow(i)
    For j = 1 To periods
    if arrLow(i-j)<llvp Then 
	llv=arrLow(i-j) 
	End if
    Next
 
      
      medium = (arrHigh(i) + arrLow(i)) / 2 
      
      if (hhv = llv) then 
	  pr = 0.67 * pr0 + (-0.33) 
	  end if     

      if (hhv <> llv) then  
	  pr = 0.66 * ((medium - llv) / (hhv - llv) - 0.5) + 0.67 * pr0 
	  end if
      
      pr = MathMin(MathMax(pr, -0.999), 0.999) 
      
      if (pr = 1) then 
	  arrx(i) = x / 2 + 0.5 
	  end if    

      if (pr <> 1) then 
	  arrx(i) = MathLog((pr + 1) / (1 - pr)) / 2.0 + x / 2.0 
	  end if
      
      pr0 = pr 
      x = arrx(i) 

   Next

   res = 1 

   For i = CLng(firstbar+1) To CLng(BARS_COUNT) 

      x = arrx(i) 
      x0 = arrx(i-1) 

      if ((x < 0 and x0 > 0) or x < 0) then 
	  res = 0 
	  end if

      if ((x > 0 and x0 < 0) or x > 0) then 
	  res = 1
	  end if

      if res=1 then 
	  arrD(i) = 1
	  arrU(i) = UNDEFINED 
	  end if 

      if res=0 then 
	  arrU(i) = 1
	  arrD(i) = UNDEFINED 
	  end if 

	  arrL1(i)=0.0
	  arrL2(i)=2.0

	  
  
   Next

   For i = CLng(firstbar+3) To CLng(BARS_COUNT) 
   if UseAlert = 1 then
   if arrU(i)<>UNDEFINED and arrU(i-1)=UNDEFINED then arrUS(i)=arrLow(i) end if
   if arrD(i)<>UNDEFINED and arrD(i-1)=UNDEFINED then arrDS(i)=arrHigh(i) end if
   end if
   Next


											
End Sub


'////////////////////////////////////////////////////////////////////////////////////////
' MathMax       
'////////////////////////////////////////////////////////////////////////////////////////
Private Function MathMax(Byval a, Byval b)
	If( CDbl(a) > CDbl(b) ) Then
		MathMax = a
	Else
		MathMax = b
	End If
End Function

'////////////////////////////////////////////////////////////////////////////////////////
' MathMin      
'////////////////////////////////////////////////////////////////////////////////////////
Private Function MathMin(Byval a, Byval b)
	If( CDbl(a) < CDbl(b) ) Then
		MathMin = a
	Else
		MathMin = b
	End If
End Function

'////////////////////////////////////////////////////////////////////////////////////////
' loadPriceSeries
'////////////////////////////////////////////////////////////////////////////////////////
Private Sub loadPriceSeries(Byval priceField, Byref array())

	Dim totalBars
	totalBars = CLng(Bars(0))
	Erase array
	CopyClose 0, 1, Bars(0), array
	Dim arrHigh(), arrLow(), arrClose()
	If( priceField = PF_OPEN ) Then				 
		CopyOpen 0, 1, Bars(0), array
	Elseif( priceField = PF_HIGH ) Then				 
		CopyHigh 0, 1, Bars(0), array
	Elseif( priceField = PF_LOW ) Then				 
		CopyLow 0, 1, Bars(0), array
	Elseif( priceField = PF_MEDIAN ) Then			 
		CopyHigh	0, 1, Bars(0), arrHigh
		CopyLow		0, 1, Bars(0), arrLow
		For i = 1 To totalBars
			array(i) = CDbl( (CDbl(arrHigh(i)) + CDbl(arrLow(i))) / 2.0)
		Next
	Elseif( priceField = PF_TYPICAL OR priceField = PF_WEIGHTED ) Then		 
		CopyHigh	0, 1, Bars(0), arrHigh
		CopyLow		0, 1, Bars(0), arrLow
		CopyClose	0, 1, Bars(0), arrClose
		For i = 1 To totalBars
			If( priceField = PF_TYPICAL ) Then
				array(i) = (CDbl(arrHigh(i)) + CDbl(arrLow(i)) + CDbl(arrClose(i))) / 3.0
			Elseif( priceField = PF_WEIGHTED ) Then
				array(i) = (CDbl(arrHigh(i)) + CDbl(arrLow(i)) + 2.0 * CDbl(arrClose(i)))/ 4.0
			End If
		Next 
	Elseif( priceField = PF_VOLUME ) Then		 
		CopyClose  0, 1, Bars(0), array
		For i = 1 To totalBars
			array(i) = CLng(VOL_DEFAULT)
		Next
	Else										 
		CopyClose 0, 1, Bars(0), array
	End If

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' getPriceValue
'////////////////////////////////////////////////////////////////////////////////////////
Private Function getPriceValue(Byval priceField, Byval barNum)
 
	Dim result
	If( priceField = PF_OPEN ) Then				 
		result = GetOpen(0, CLng(barNum))
	Elseif( priceField = PF_HIGH ) Then				 
		result = GetHigh(0, CLng(barNum))
	Elseif( priceField = PF_LOW ) Then			 
		result = GetLow(0, CLng(barNum))
	Elseif( priceField = PF_MEDIAN ) Then		 
		result = (CDbl(GetHigh(0, CLng(barNum))) + CDbl(getLow(0, CLng(barNum)))) / 2.0
	Elseif( priceField = PF_TYPICAL ) Then		 
		result = (CDbl(GetHigh(0, CLng(barNum))) + CDbl(getLow(0, CLng(barNum)) + CDbl(getClose(0, CLng(barNum))))) / 3.0
	Elseif( priceField = PF_WEIGHTED ) Then		 
		result = (CDbl(GetHigh(0, CLng(barNum))) + CDbl(getLow(0, CLng(barNum)) + 2.0 * CDbl(getClose(0, CLng(barNum))))) / 4.0
	Elseif( priceField = PF_VOLUME ) Then
		result = CDbl(VOL_DEFAULT)
	Else											 
		result = GetClose(0, CLng(barNum))
	End If
	getPriceValue = CDbl(result)

End Function

 
'////////////////////////////////////////////////////////////////////////////////////////
' OnInit
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub OnInit()

 Dim pip

 SymbolInfoInteger ChartSymbol(0),SYMBOL_PIP_LOCATION,pip

 	if pip=-1 Then Point=0.1 End if
	if pip=-2 Then Point=0.01 End if
	if pip=-3 Then Point=0.001 End if
	if pip=-4 Then Point=0.0001 End if
	if pip=-5 Then Point=0.00001 End if

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' OnDeInit
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub OnDeInit()
	ObjectDelete 0, CStr(indID1)
	ObjectDelete 0, CStr(indID2)
	ObjectDelete 0, CStr(indID3)
	ObjectDelete 0, CStr(indID4)
	ObjectDelete 0, CStr(indID5)
	ObjectDelete 0, CStr(indID6)
	BARS_COUNT = 0
End Sub

Re: MT4 Indicators with alerts/signals

Posted: Thu Jul 16, 2020 5:51 am
by mrtools
SK_Rana wrote: Thu Jul 16, 2020 5:19 am Hi MrTools,

Can you please convert this script into mt4 indicator with an arrow and all alert options?

Thanks,
Rana


Script:

Code: Select all

----------------------------------------------------------------------------

            
'#####################################################################################################
'#  Indicator   :   Zwinner Trend                                                                    #
'#  Author      :   V-M-SOFTS                                                                        #
'#  Copyright   :   © V-M-SOFTS                                                                      #
'#  E-mail      :   vladimir.mametov@yandex.ru                                                       #
'#  Date        :   20-Dec-2015                                                                      #
'#  Description :   Forex indicator Zwinner Trend Indicator - a trend indicator, which provides an   #
'#                  excellent opportunity to filter false entries into the market.                   #
'#                  Using this indicator may be determined based on the prevailing market price      # 
'#					trend. The color of the indicator line Zwinner Trend Indicator depends on the    #
'#					current trends:                                                                  #
'#                  * downtrend - red line;                                                          #
'#                  * upward trend - green line.                                                     #
'#                  Forex indicator Zwinner Trend Indicator can be used in trading                   #
'#				    strategies as a filter:                                                          #
'#                  * green line - considering only the position of the purchase;                    #
'#                  * red line - consider only short positions.                                      #
'#                  An additional indicator may appear on the chart signals for purchase and sale in #
'#				    the form of arrows. Red Arrow is a signal to sell, and green arrow signal to buy.#
'#                  The input parameters of the indicator:                                           #
'#                  Const periods (default = 1), the number of bars of a financial instrument        #
'#				    is used to calculate the indicator.                                              #
'#                  Const UseAlert (default = 1) 1 - display signals to buy and sell (arrows);       #
'#				    0 - do not show.                                                                 #
'#                  Const NBars (default = 500) -  It determines the number of bars on which         #
'#				    to build the indicator.                                                          #
'#                                                                                                   #
'#  History     :                                                                                    #
'#       1.00   :   Initial version.                                                                 #
'#####################################################################################################                                                                                                    

'''######################  INPUT PARAMETERS  #########################################################

Const periods  = 8 
Const UseAlert = 1
Const NBars    = 500
 
'''####################################################################################################
 
Dim m_chartID		 
Dim m_chartName			                                                                          
Dim BARS_COUNT			 
Dim PROCESSING	
Dim Point,Filter
Dim indID1, indID2, indID3, indID4, indID5, indID6 	 			 
Dim arrHigh(), arrLow(), arrU(), arrD(), arrL1(), arrL2(), arrUS(), arrDS()	 
 
Const UNDEFINED			= -987654321  
Const VOL_DEFAULT		= 100                      
 
Const PF_CLOSE			= 0				 
Const PF_OPEN			= 1				 
Const PF_HIGH			= 2				 
Const PF_LOW			= 3				 
Const PF_MEDIAN			= 4				 
Const PF_TYPICAL		= 5				 
Const PF_WEIGHTED		= 6				 
Const PF_VOLUME			= 10			 
 
'////////////////////////////////////////////////////////////////////////////////////////
' Main
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub main()

	While (PROCESSING)
	Wend
	
	PROCESSING = 1
	BARS_COUNT = 0
	m_chartID = ChartID()
	m_chartName = ChartSymbol(CLng(m_chartID))

	updateBuffers
	performCalculations 1

 
	indID1 = AddCustomIndicator(0, arrU, 1, TRUE)
	SetDrawingStyle 0, CSTR(indID1), DRAW_ARROWS
	SetArrowStyle 0, CSTR(indID1) , 110
	LineColor 0, CStr(indID1), RGBCOLOR(0,255,0)

	Dim subWindowID
	subWindowID = CLng(GetSubwindow(0, CStr(indID1)))

	indID2 = AddCustomIndicator(0, arrD, 1, 0, CLng(subWindowID))
	SetDrawingStyle 0, CSTR(indID2), DRAW_ARROWS
	SetArrowStyle 0, CSTR(indID2) , 110
	LineColor 0, CStr(indID2), RGBCOLOR(255,0,0)

	indID3 = AddCustomIndicator(0, arrL1, 1, False, CLng(subWindowID))
	SetSeriesStyle 0, CStr(indID3), LINE_CHART
	LineColor 0, CStr(indID3), RGBCOLOR(255,255,255)
	LineWeight 0, CStr(indID3), 2

    indID4 = AddCustomIndicator(0, arrL2, 1, False, CLng(subWindowID))
	SetSeriesStyle 0, CStr(indID4), LINE_CHART
	LineColor 0, CStr(indID4), RGBCOLOR(255,255,255)
	LineWeight 0, CStr(indID4), 2

	indID5 = AddCustomIndicator(0, arrUS, 1, False)
	SetDrawingStyle 0, CSTR(indID5), DRAW_ARROWS
	SetArrowStyle 0, CSTR(indID5) , 233
	LineColor 0, CStr(indID5), RGBCOLOR(0,255,0)

	indID6 = AddCustomIndicator(0, arrDS, 1, False)
	SetDrawingStyle 0, CSTR(indID6), DRAW_ARROWS
	SetArrowStyle 0, CSTR(indID6) , 234
	LineColor 0, CStr(indID6), RGBCOLOR(255,0,0)


	PROCESSING = 0

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' OnTick
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub OnTick(symbolName)

	If( PROCESSING ) Then Exit Sub
	If( symbolName <> ChartSymbol(0) ) Then Exit Sub
	If( CLng(BARS_COUNT) <> CLng(Bars(0)) ) Then Exit Sub


End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' OnCalculate
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub OnCalculate(symbol, symbolPeriod, openVal, highVal, lowVal, closeVal)
	
	If (PROCESSING) Then Exit Sub
	If( symbol <> ChartSymbol(0) ) Then Exit Sub

	PROCESSING = 1

	updateBuffers
	performCalculations 1
 
	SetIndicatorData 0, CStr(indID1), CDbl(arrU(BARS_COUNT)) 
	SetIndicatorData 0, CStr(indID2), CDbl(arrD(BARS_COUNT))
	SetIndicatorData 0, CStr(indID3), CDbl(arrL1(BARS_COUNT))
	SetIndicatorData 0, CStr(indID4), CDbl(arrL2(BARS_COUNT)) 
	SetIndicatorData 0, CStr(indID5), CDbl(arrUS(BARS_COUNT)) 
	SetIndicatorData 0, CStr(indID6), CDbl(arrDS(BARS_COUNT))


	PROCESSING = 0

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' updateBuffers
'////////////////////////////////////////////////////////////////////////////////////////
Private Sub updateBuffers()

	loadPriceSeries PF_HIGH, arrHigh
    loadPriceSeries PF_LOW, arrLow
	loadPriceSeries PF_CLOSE, arrL1
	loadPriceSeries PF_CLOSE, arrL2
	loadPriceSeries PF_CLOSE, arrU
	loadPriceSeries PF_CLOSE, arrD
	loadPriceSeries PF_CLOSE, arrUS
	loadPriceSeries PF_CLOSE, arrDS

	Dim i
	For i = 1 To CLng(Bars(0))
		arrU(i) = UNDEFINED
		arrD(i) = UNDEFINED
		arrL1(i) = UNDEFINED
		arrL2(i) = UNDEFINED
		arrUS(i) = UNDEFINED
		arrDS(i) = UNDEFINED
	Next
 
	BARS_COUNT = CLng(Bars(0))

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' performCalculations
'////////////////////////////////////////////////////////////////////////////////////////
Private Sub performCalculations(Byval startBar)

   Dim i,x0,x,medium,pr,pr0,llv,hhv,arrx() 
 
   pr = 0 
   pr0 = 0 
   llv = 0 
   hhv = 0 

    CopyClose 0, 1, Bars(0), arrx
 
    firstbar=MathMax(CLng(startBar+periods),CLng(BARS_COUNT-NBars+periods))

	For i = CLng(firstbar) To CLng(BARS_COUNT)

    hhv=arrHigh(i)
    For j = 1 To periods
    if arrHigh(i-j)>hhvp Then 
	hhv=arrHigh(i-j) 
	End if
    Next

	llv=arrLow(i)
    For j = 1 To periods
    if arrLow(i-j)<llvp Then 
	llv=arrLow(i-j) 
	End if
    Next
 
      
      medium = (arrHigh(i) + arrLow(i)) / 2 
      
      if (hhv = llv) then 
	  pr = 0.67 * pr0 + (-0.33) 
	  end if     

      if (hhv <> llv) then  
	  pr = 0.66 * ((medium - llv) / (hhv - llv) - 0.5) + 0.67 * pr0 
	  end if
      
      pr = MathMin(MathMax(pr, -0.999), 0.999) 
      
      if (pr = 1) then 
	  arrx(i) = x / 2 + 0.5 
	  end if    

      if (pr <> 1) then 
	  arrx(i) = MathLog((pr + 1) / (1 - pr)) / 2.0 + x / 2.0 
	  end if
      
      pr0 = pr 
      x = arrx(i) 

   Next

   res = 1 

   For i = CLng(firstbar+1) To CLng(BARS_COUNT) 

      x = arrx(i) 
      x0 = arrx(i-1) 

      if ((x < 0 and x0 > 0) or x < 0) then 
	  res = 0 
	  end if

      if ((x > 0 and x0 < 0) or x > 0) then 
	  res = 1
	  end if

      if res=1 then 
	  arrD(i) = 1
	  arrU(i) = UNDEFINED 
	  end if 

      if res=0 then 
	  arrU(i) = 1
	  arrD(i) = UNDEFINED 
	  end if 

	  arrL1(i)=0.0
	  arrL2(i)=2.0

	  
  
   Next

   For i = CLng(firstbar+3) To CLng(BARS_COUNT) 
   if UseAlert = 1 then
   if arrU(i)<>UNDEFINED and arrU(i-1)=UNDEFINED then arrUS(i)=arrLow(i) end if
   if arrD(i)<>UNDEFINED and arrD(i-1)=UNDEFINED then arrDS(i)=arrHigh(i) end if
   end if
   Next


											
End Sub


'////////////////////////////////////////////////////////////////////////////////////////
' MathMax       
'////////////////////////////////////////////////////////////////////////////////////////
Private Function MathMax(Byval a, Byval b)
	If( CDbl(a) > CDbl(b) ) Then
		MathMax = a
	Else
		MathMax = b
	End If
End Function

'////////////////////////////////////////////////////////////////////////////////////////
' MathMin      
'////////////////////////////////////////////////////////////////////////////////////////
Private Function MathMin(Byval a, Byval b)
	If( CDbl(a) < CDbl(b) ) Then
		MathMin = a
	Else
		MathMin = b
	End If
End Function

'////////////////////////////////////////////////////////////////////////////////////////
' loadPriceSeries
'////////////////////////////////////////////////////////////////////////////////////////
Private Sub loadPriceSeries(Byval priceField, Byref array())

	Dim totalBars
	totalBars = CLng(Bars(0))
	Erase array
	CopyClose 0, 1, Bars(0), array
	Dim arrHigh(), arrLow(), arrClose()
	If( priceField = PF_OPEN ) Then				 
		CopyOpen 0, 1, Bars(0), array
	Elseif( priceField = PF_HIGH ) Then				 
		CopyHigh 0, 1, Bars(0), array
	Elseif( priceField = PF_LOW ) Then				 
		CopyLow 0, 1, Bars(0), array
	Elseif( priceField = PF_MEDIAN ) Then			 
		CopyHigh	0, 1, Bars(0), arrHigh
		CopyLow		0, 1, Bars(0), arrLow
		For i = 1 To totalBars
			array(i) = CDbl( (CDbl(arrHigh(i)) + CDbl(arrLow(i))) / 2.0)
		Next
	Elseif( priceField = PF_TYPICAL OR priceField = PF_WEIGHTED ) Then		 
		CopyHigh	0, 1, Bars(0), arrHigh
		CopyLow		0, 1, Bars(0), arrLow
		CopyClose	0, 1, Bars(0), arrClose
		For i = 1 To totalBars
			If( priceField = PF_TYPICAL ) Then
				array(i) = (CDbl(arrHigh(i)) + CDbl(arrLow(i)) + CDbl(arrClose(i))) / 3.0
			Elseif( priceField = PF_WEIGHTED ) Then
				array(i) = (CDbl(arrHigh(i)) + CDbl(arrLow(i)) + 2.0 * CDbl(arrClose(i)))/ 4.0
			End If
		Next 
	Elseif( priceField = PF_VOLUME ) Then		 
		CopyClose  0, 1, Bars(0), array
		For i = 1 To totalBars
			array(i) = CLng(VOL_DEFAULT)
		Next
	Else										 
		CopyClose 0, 1, Bars(0), array
	End If

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' getPriceValue
'////////////////////////////////////////////////////////////////////////////////////////
Private Function getPriceValue(Byval priceField, Byval barNum)
 
	Dim result
	If( priceField = PF_OPEN ) Then				 
		result = GetOpen(0, CLng(barNum))
	Elseif( priceField = PF_HIGH ) Then				 
		result = GetHigh(0, CLng(barNum))
	Elseif( priceField = PF_LOW ) Then			 
		result = GetLow(0, CLng(barNum))
	Elseif( priceField = PF_MEDIAN ) Then		 
		result = (CDbl(GetHigh(0, CLng(barNum))) + CDbl(getLow(0, CLng(barNum)))) / 2.0
	Elseif( priceField = PF_TYPICAL ) Then		 
		result = (CDbl(GetHigh(0, CLng(barNum))) + CDbl(getLow(0, CLng(barNum)) + CDbl(getClose(0, CLng(barNum))))) / 3.0
	Elseif( priceField = PF_WEIGHTED ) Then		 
		result = (CDbl(GetHigh(0, CLng(barNum))) + CDbl(getLow(0, CLng(barNum)) + 2.0 * CDbl(getClose(0, CLng(barNum))))) / 4.0
	Elseif( priceField = PF_VOLUME ) Then
		result = CDbl(VOL_DEFAULT)
	Else											 
		result = GetClose(0, CLng(barNum))
	End If
	getPriceValue = CDbl(result)

End Function

 
'////////////////////////////////////////////////////////////////////////////////////////
' OnInit
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub OnInit()

 Dim pip

 SymbolInfoInteger ChartSymbol(0),SYMBOL_PIP_LOCATION,pip

 	if pip=-1 Then Point=0.1 End if
	if pip=-2 Then Point=0.01 End if
	if pip=-3 Then Point=0.001 End if
	if pip=-4 Then Point=0.0001 End if
	if pip=-5 Then Point=0.00001 End if

End Sub

'////////////////////////////////////////////////////////////////////////////////////////
' OnDeInit
'////////////////////////////////////////////////////////////////////////////////////////
Public Sub OnDeInit()
	ObjectDelete 0, CStr(indID1)
	ObjectDelete 0, CStr(indID2)
	ObjectDelete 0, CStr(indID3)
	ObjectDelete 0, CStr(indID4)
	ObjectDelete 0, CStr(indID5)
	ObjectDelete 0, CStr(indID6)
	BARS_COUNT = 0
End Sub
Code wise it looks like a histogram version of ehler's fisher transform.

Re: MT4 Indicators with alerts/signals

Posted: Thu Jul 16, 2020 6:11 am
by mrtools
Broken_Dreams wrote: Thu Jul 16, 2020 4:00 am Good morning,
I'm new to the forum and I'm hoping that someone can modify this indicator by adding alert notification for every fractal formation.
Thank you & have a nice day.
Try it out.

Re: MT4 Indicators with alerts/signals

Posted: Thu Jul 16, 2020 7:15 am
by Michael15
please, someone put the reversal arrows indicator when they reach the pips defined in that indicator

Re: MT4 Indicators with alerts/signals

Posted: Thu Jul 16, 2020 3:10 pm
by Broken_Dreams
mrtools wrote: Thu Jul 16, 2020 6:11 am

Try it out.
Thank you for your quick reply & help.
My bad, I've only recently noticed that you uploaded a MTF version of this indicator, and I would like to ask for help to add an alert to this as well.

Re: MT4 Indicators with alerts/signals

Posted: Thu Jul 16, 2020 8:57 pm
by prasadvikram
Hello Biggies!!

I'm a minnow in fx market. Have been following a free scalping indicator from KARL DITTMANN. Proves quite profitable in m15 m30. However, I have been provided with only .ex4 file...& nothing else.
All i want is a simple alert (TREND CHANGING) at the end of 1st candle of different colors. Thats it.
I m no techno geek in IT n all....but please... u guys r.
Hope someone can help. mladen mrtools mntiwana......