예스스탁
예스스탁 답변
2024-09-27 13:22:19
안녕하세요
예스스탁입니다.
Inputs: ATRLength(NumericSimple), ATRMult(NumericSimple), Strength(NumericSimple), STrend(NumericRef);
Vars: vATR(0), vAvg(0), DN(0), UP(0), Trend(1), flag(0), flagh(0), ST(0), hl(0);
hl = Highest(High, ATRLength) - Lowest(Low, ATRLength);
vATR = Ema(hl, ATRLength);
vAvg = ( Ema(High, Strength) + Ema(Low, Strength) ) / 2;
UP = vAvg + vATR;
DN = vAvg - vATR;
If C > UP[1] And C > Highest(High, Strength)[1] Then Trend = 1;
Else If C < DN[1] And C < Lowest(Low, Strength)[1] Then Trend = -1;;
If Trend < 0 And Trend[1] > 0 Then flag = 1;
Else flag = 0;
If Trend > 0 And Trend[1] < 0 Then flagh = 1;
Else flagh = 0;
If Trend > 0 And DN < DN[1] Then DN = DN[1];
If Trend < 0 And UP > UP[1] Then UP = UP[1];
If flag == 1 Then UP = vAvg + vATR;
If flagh == 1 Then DN = vAvg - vATR;
If Trend == 1 Then ST = DN;
Else ST = UP;
SuperTrend = ST;
STrend = Trend;
즐거운 하루되세요
> 몽탄 님이 쓴 글입니다.
> 제목 : 오류
> 안녕하세요 시그널메이커에서는 대부분 구현이 제대로 되지않아서 예스이용해보려고합니다.
사용자함수 입력하려고합니다 근데 오류가 나옵니다
수정좀 부탁드립니다
Inputs: ATRLength(NumericSimple), ATRMult(NumericSimple), Strength(NumericSimple), STrend(NumericRef);
Vars: vATR(0), vAvg(0), DN(0), UP(0), Trend(1), flag(0), flagh(0), ST(0), hl(0);
hl = Highest(High, ATRLength) - Lowest(Low, ATRLength);
vATR = Ema(hl, ATRLength);
vAvg = ( Ema(High, Strength) + Ema(Low, Strength) ) / 2;
UP = vAvg + vATR;
DN = vAvg - vATR;
If C > UP[1] And C > Highest(High, Strength)[1] Then Trend = 1
Else If C < DN[1] And C < Lowest(Low, Strength)[1] Then Trend = -1;
If Trend < 0 And Trend[1] > 0 Then flag = 1
Else flag = 0;
If Trend > 0 And Trend[1] < 0 Then flagh = 1
Else flagh = 0;
If Trend > 0 And DN < DN[1] Then DN = DN[1];
If Trend < 0 And UP > UP[1] Then UP = UP[1];
If flag = 1 Then UP = vAvg + vATR;
If flagh = 1 Then DN = vAvg - vATR;
If Trend = 1 Then ST = DN
Else ST = UP;
SuperTrend = ST;
STrend = Trend;
이 사용자 함수를 만든뒤 아래 자동매매만들고싶습니다
// Inputs
inputs: ATRLength1(14), ATRMult1(3), Strength1(20);
// Variables
vars: strend1(0), st1(0);
// Calculate SuperTrend
st1 = SuperTrend(ATRLength1, ATRMult1, Strength1, strend1);
// Trading Logic
// Buy when the close price crosses above the SuperTrend
If CrossUp(C, st1) Then
Buy("매수");
// Sell when the close price crosses below the SuperTrend
If CrossDown(C, st1) Then
Sell("매도");
자동매매로 전환하고싶습니다