Psychological for Strategy testing


Hello everyone
I’ve made Psychological to be able to adjust some variables for strategy.
When you adjust each parameter of the settings, the strategy tester also comes to work in conjunction with.
so please find your best parameter! ^^

strategy(title="Psychological for strategy", shorttitle="PL+", precision=1)

up = input(type=input.integer, title="Upper line", defval=85)
bot = input(type=input.integer, title="Botom line", defval=15)
pro = input(type=input.integer, title="profit", defval=50)
los = input(type=input.integer, title="loss", defval=250)

calcSource = input(type=input.source, title="Source", defval=close)
days = input(type=input.integer, title="Days", defval=10, minval=1)
transparent =, 100)

isUp(series) =>
    series[1] < series[0] ? 1 : 0

CalcPsycholo(isUp, length) =>
    sum(isUp, length) / length * 100
Psycho = CalcPsycholo(isUp(calcSource), days)
hline(50, linestyle=hline.style_dashed, color=color.gray, linewidth=1)
minLine = hline(0, linestyle=hline.style_dashed, color=transparent)
maxLine = hline(100, linestyle=hline.style_dashed, color=transparent)
downLine = hline(bot, linestyle=hline.style_dashed,
upLine = hline(up, linestyle=hline.style_dashed,
fill(minLine, downLine,
fill(maxLine, upLine,
plot(Psycho, style=plot.style_line, color=color.white, linewidth=1)

if Psycho < bot
    strategy.entry("longEnt", strategy.long)
    strategy.exit("Exit Long", profit=pro, loss=los)
if Psycho > up
    strategy.entry("ShortEnt", strategy.short)
    strategy.exit("Exit Short", profit=pro, loss=los)

Author: ユウスケ


メールアドレスが公開されることはありません。 * が付いている欄は必須項目です