This indicator is about Dow’s theory, it detects the highs and lows of a trend to clearly identify trends or periods when the market is in range.
It has major points (based on a long-term calculation) and minor points (calculated on a short term). These periods are of course adjustable, it also includes a moving average of type and adjustable period to match your style of ‘swing trader’.
Converted from an MQL4 code, by a request in the Italian trading indicator’s forum.
//PRC_LastManStandingIndicator | indicator
//14.11.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//translated from MQL4 code
// --- settings
//PeriodsInMajorSwing=13
//PeriodsInMinorSwing=5
//MovingAverageMethod=1
//MovingAveragePeriods= 55
// --- end of settings
EMA = average[MovingAveragePeriods,MovingAverageMethod](close)
hhminorprice=0
llminorprice=close*1000
for i = 1 to PeriodsInMinorSwing*2 do
if high[i]>hhminorprice then
hhminorbar = barindex[i]
hhminorprice = high[i]
endif
if low[i]<llminorprice then
llminorbar=barindex[i]
llminorprice=low[i]
endif
next
hhmajorprice=0
llmajorprice=close*1000
for i = 1 to PeriodsInMajorSwing*2 do
if high[i]>hhmajorprice then
hhmajorbar = barindex[i]
hhmajorprice = high[i]
endif
if low[i]<llmajorprice then
llmajorbar=barindex[i]
llmajorprice=low[i]
endif
next
atr=averagetruerange[14]
if barindex-hhminorbar=PeriodsInMinorSwing then
drawtext("●",hhminorbar,hhminorprice,Dialog,Bold,10) coloured(100,149,237)
endif
if barindex-llminorbar=PeriodsInMinorSwing then
drawtext("●",llminorbar,llminorprice,Dialog,Bold,10) coloured(100,149,237)
endif
if barindex-hhmajorbar=PeriodsInMajorSwing then
drawtext("●",hhmajorbar,hhmajorprice+atr/2,Dialog,Bold,20) coloured(128,0,128)
endif
if barindex-llmajorbar=PeriodsInMajorSwing then
drawtext("●",llmajorbar,llmajorprice-atr/2,Dialog,Bold,20) coloured(128,0,128)
endif
return EMA coloured(184,134,11) as "EMA"