커뮤니티
수식 문의 드립니다.
2016-12-09 10:45:07
127
글번호 104823
var1 = ma(c,5);
var2 = ma(C,20);
if var2 < var2[1] and NextBarOpen > var1 Then
sell("s",AtStop,NextBarOpen-PriceScale*1);
if var2 > var2[1] and NextBarOpen < var1 Then
buy("b",AtStop,NextBarOpen+PriceScale*1);
if MarketPosition == 1 Then{
ExitLong("b+",atlimit,EntryPrice+PriceScale*45);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*30 Then
ExitLong("b=",AtStop,EntryPrice+PriceScale*15);
Else
ExitLong("b-",AtStop,EntryPrice-PriceScale*1);
}
if MarketPosition == -1 Then{
ExitShort("s+",atlimit,EntryPrice-PriceScale*45);
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*30 Then
ExitShort("s=",AtStop,EntryPrice-PriceScale*15);
Else
ExitShort("s-",AtStop,EntryPrice+PriceScale*1);
}
위 수식에서 PriceScale*45, PriceScale*30, PriceScale*15 를 아래 수식은 RSI 수식인데 14 30 70 처럼 변수가 나오게 해서 최적의 수치를 찾을수 있게 하고 싶습니다. input을 쓰면 될것 같은데 잘 모르겠습니다. 위에 3개 수치(45,30,15)에 대해서 변수편집이 나오게 하고 싶습니다.
Input : Period(14), LPercent(30), SPercent(70);
Var : value(0);
value = RSI(Period);
# 매수/매도청산
If CrossUP(value, LPercent) Then
{
Buy();
}
# 매도/매수청산
If CrossDown(value, SPercent) Then
{
Sell();
}
답변 1
예스스탁 예스스탁 답변
2016-12-09 13:06:44
안녕하세요
예스스탁입니다.
input : 익절틱수(45),손절변경수익틱수(30),변경손절틱수(15);
var1 = ma(c,5);
var2 = ma(C,20);
if var2 < var2[1] and NextBarOpen > var1 Then
sell("s",AtStop,NextBarOpen-PriceScale*1);
if var2 > var2[1] and NextBarOpen < var1 Then
buy("b",AtStop,NextBarOpen+PriceScale*1);
if MarketPosition == 1 Then{
ExitLong("b+",atlimit,EntryPrice+PriceScale*익절틱수);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*손절변경수익틱수 Then
ExitLong("b=",AtStop,EntryPrice+PriceScale*변경손절틱수);
Else
ExitLong("b-",AtStop,EntryPrice-PriceScale*1);
}
if MarketPosition == -1 Then{
ExitShort("s+",atlimit,EntryPrice-PriceScale*익절틱수);
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*손절변경수익틱수 Then
ExitShort("s=",AtStop,EntryPrice-PriceScale*변경손절틱수);
Else
ExitShort("s-",AtStop,EntryPrice+PriceScale*1);
}
즐거운 하루되세요
> 디얼디어 님이 쓴 글입니다.
> 제목 : 수식 문의 드립니다.
> var1 = ma(c,5);
var2 = ma(C,20);
if var2 < var2[1] and NextBarOpen > var1 Then
sell("s",AtStop,NextBarOpen-PriceScale*1);
if var2 > var2[1] and NextBarOpen < var1 Then
buy("b",AtStop,NextBarOpen+PriceScale*1);
if MarketPosition == 1 Then{
ExitLong("b+",atlimit,EntryPrice+PriceScale*45);
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*30 Then
ExitLong("b=",AtStop,EntryPrice+PriceScale*15);
Else
ExitLong("b-",AtStop,EntryPrice-PriceScale*1);
}
if MarketPosition == -1 Then{
ExitShort("s+",atlimit,EntryPrice-PriceScale*45);
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*30 Then
ExitShort("s=",AtStop,EntryPrice-PriceScale*15);
Else
ExitShort("s-",AtStop,EntryPrice+PriceScale*1);
}
위 수식에서 PriceScale*45, PriceScale*30, PriceScale*15 를 아래 수식은 RSI 수식인데 14 30 70 처럼 변수가 나오게 해서 최적의 수치를 찾을수 있게 하고 싶습니다. input을 쓰면 될것 같은데 잘 모르겠습니다. 위에 3개 수치(45,30,15)에 대해서 변수편집이 나오게 하고 싶습니다.
Input : Period(14), LPercent(30), SPercent(70);
Var : value(0);
value = RSI(Period);
# 매수/매도청산
If CrossUP(value, LPercent) Then
{
Buy();
}
# 매도/매수청산
If CrossDown(value, SPercent) Then
{
Sell();
}