커뮤니티

수식 변환 부탁드립니다.

프로필 이미지
몬스터
2024-02-20 00:11:04
744
글번호 176775
답변완료
안녕하세요. 아래의 파인스크립트를 예스로 변환 부탁드립니다. ====================================================== //@version=5 strategy("BBdir", overlay=true) source = low + ((high-low)/2) length = input.int(20, minval=1) mult = input.float(2.0, minval=0.001, maxval=50) direction = input.int(0, title = "Strategy Direction", minval=-1, maxval=1) strategy.risk.allow_entry_in(direction == 0 ? strategy.direction.all : (direction < 0 ? strategy.direction.short : strategy.direction.long)) basis = ta.sma(source, length) dev = mult * ta.stdev(source, length) upper = basis + dev lower = basis - dev if (ta.crossover(source, lower)) strategy.entry("B", strategy.long, stop=lower, oca_name="BollingerBands", oca_type=strategy.oca.cancel, comment="B") else strategy.cancel(id="B") if (ta.crossunder(source, upper)) strategy.entry("S", strategy.short, stop=upper, oca_name="BollingerBands", oca_type=strategy.oca.cancel, comment="S") else strategy.cancel(id="S")
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2024-02-20 10:00:42

안녕하세요 예스스탁입니다. input : length(20),mult(2.0),direction(0); var : source(0),basis(0),dev(0),upper(0),lower(0); source = low + ((high-low)/2); basis = ma(source, length); dev = mult * std(source, length); upper = basis + dev; lower = basis - dev; if direction >= 0 and CrossUp(source, lower) Then Buy("B"); if MarketPosition == 1 and CrossDown(source, lower) Then ExitLong("bx"); if direction <= 0 and CrossDown(source, upper) Then Sell("S"); if MarketPosition == -1 and CrossUp(source, lower) Then ExitShort("sx"); 즐거운 하루되세요 > 몬스터 님이 쓴 글입니다. > 제목 : 수식 변환 부탁드립니다. > 안녕하세요. 아래의 파인스크립트를 예스로 변환 부탁드립니다. ====================================================== //@version=5 strategy("BBdir", overlay=true) source = low + ((high-low)/2) length = input.int(20, minval=1) mult = input.float(2.0, minval=0.001, maxval=50) direction = input.int(0, title = "Strategy Direction", minval=-1, maxval=1) strategy.risk.allow_entry_in(direction == 0 ? strategy.direction.all : (direction < 0 ? strategy.direction.short : strategy.direction.long)) basis = ta.sma(source, length) dev = mult * ta.stdev(source, length) upper = basis + dev lower = basis - dev if (ta.crossover(source, lower)) strategy.entry("B", strategy.long, stop=lower, oca_name="BollingerBands", oca_type=strategy.oca.cancel, comment="B") else strategy.cancel(id="B") if (ta.crossunder(source, upper)) strategy.entry("S", strategy.short, stop=upper, oca_name="BollingerBands", oca_type=strategy.oca.cancel, comment="S") else strategy.cancel(id="S")