Best day to enter/exit

Category: Indicators By: gabri Created: November 27, 2017, 5:21 PM
November 27, 2017, 5:21 PM
Indicators
0 Comments

This code spots, based on historical data, the day of the week where the market makes the lowest and the highest price. Being a statistical tool, this indicator helps filtering entry and exit periods but cannot be used stand alone. It’s freely inspired bu Williams’ techniques.

Buy when the red line makes a trough and sell when the blue line makes a peak. If the trend is up buy on open and sell on close, if the trend is down buy on close and sell on open.

period=100

if dayofweek=1 then
 BARref=barindex
 refOPEN=open
endif
refHIGH=100*(high-refOPEN)/refOPEN
refLOW=100*(-refOPEN+low)/refOPEN
if barindex<BARref+4 then
 //lunedi
 if dayofweek=1 then
  MONhigh=refHIGH
  MONlow=refLOW
  MONcount=1
 else
  MONhigh=0
  MONlow=0
  MONcount=0
 endif
 //martedi
 if dayofweek=2 then
  TUEhigh=refHIGH
  TUElow=refLOW
  TUEcount=1
 else
  TUEhigh=0
  TUElow=0
  TUEcount=0
 endif
 //mercoledi
 if dayofweek=3 then
  WEDhigh=refHIGH
  WEDlow=refLOW
  WEDcount=1
 else
  WEDhigh=0
  WEDlow=0
  WEDcount=0
 endif
 //giovedi
 if dayofweek=4 then
  THUhigh=refHIGH
  THUlow=refLOW
  THUcount=1
 else
  THUhigh=0  
  THUlow=0
  THUcount=0
 endif
 //venerdi
 if dayofweek=5 then
  FRIhigh=refHIGH
  FRIlow=refLOW
  FRIcount=1
 else
  FRIhigh=0
  FRIlow=0
  FRIcount=0
 endif
ENDIF

monALTO=summation[period](MONhigh)/summation[period](MONcount)
monBASSO=summation[period](MONlow)/summation[period](MONcount)
tueALTO=summation[period](TUEhigh)/summation[period](TUEcount)
tueBASSO=summation[period](TUElow)/summation[period](TUEcount)
wedALTO=summation[period](WEDhigh)/summation[period](WEDcount)
wedBASSO=summation[period](WEDlow)/summation[period](WEDcount)
thuALTO=summation[period](THUhigh)/summation[period](THUcount)
thuBASSO=summation[period](THUlow)/summation[period](THUcount)
friALTO=summation[period](FRIhigh)/summation[period](FRIcount)
friBASSO=summation[period](FRIlow)/summation[period](FRIcount)

if dayofweek=1 then
 refalto=monALTO
 refbasso=monBASSO
elsif dayofweek=2 then
 refalto=tueALTO
 refbasso=tueBASSO
elsif dayofweek=3 then
 refalto=wedALTO
 refbasso=wedBASSO
elsif dayofweek=4 then
 refalto=thuALTO
 refbasso=thuBASSO
elsif dayofweek=5 then
 refalto=friALTO
 refbasso=friBASSO
endif

return refalto coloured (0,0,255) as "Sell", refbasso coloured (205,0,0) as "Buy"//

Blue skies!!

Download
Filename: Best-day-to-enterexit.itf
Downloads: 289
gabri Master
As an architect of digital worlds, my own description remains a mystery. Think of me as an undeclared variable, existing somewhere in the code.
Author’s Profile

Comments

Logo Logo
Loading...